Class: ZaakpayRuby::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/zaakpay_ruby/response.rb

Overview

This class creates wrappers around the Zaakpay response

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args_str) ⇒ Response

Returns a new instance of Response.



6
7
8
9
10
# File 'lib/zaakpay_ruby/response.rb', line 6

def initialize(args_str)
  @all_params = Rack::Utils.parse_query(args_str)
  @posted_checksum = @all_params['checksum']
  @params = @all_params.reject{|k,v| k=='checksum'}
end

Instance Attribute Details

#all_paramsObject (readonly)

Returns the value of attribute all_params.



4
5
6
# File 'lib/zaakpay_ruby/response.rb', line 4

def all_params
  @all_params
end

#checksumObject (readonly)

Returns the value of attribute checksum.



4
5
6
# File 'lib/zaakpay_ruby/response.rb', line 4

def checksum
  @checksum
end

#paramsObject (readonly)

Returns the value of attribute params.



4
5
6
# File 'lib/zaakpay_ruby/response.rb', line 4

def params
  @params
end

#posted_checksumObject (readonly)

Returns the value of attribute posted_checksum.



4
5
6
# File 'lib/zaakpay_ruby/response.rb', line 4

def posted_checksum
  @posted_checksum
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/zaakpay_ruby/response.rb', line 12

def valid?
  @checksum = ZaakpayRuby.generate_checksum(@params)
  @posted_checksum == @checksum
end