Class: ZaakpayRuby::Response
- Inherits:
-
Object
- Object
- ZaakpayRuby::Response
- Defined in:
- lib/zaakpay_ruby/response.rb
Overview
This class creates wrappers around the Zaakpay response
Instance Attribute Summary collapse
-
#all_params ⇒ Object
readonly
Returns the value of attribute all_params.
-
#checksum ⇒ Object
readonly
Returns the value of attribute checksum.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#posted_checksum ⇒ Object
readonly
Returns the value of attribute posted_checksum.
Instance Method Summary collapse
-
#initialize(args_str) ⇒ Response
constructor
A new instance of Response.
- #valid? ⇒ Boolean
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_params ⇒ Object (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 |
#checksum ⇒ Object (readonly)
Returns the value of attribute checksum.
4 5 6 |
# File 'lib/zaakpay_ruby/response.rb', line 4 def checksum @checksum end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'lib/zaakpay_ruby/response.rb', line 4 def params @params end |
#posted_checksum ⇒ Object (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
12 13 14 15 |
# File 'lib/zaakpay_ruby/response.rb', line 12 def valid? @checksum = ZaakpayRuby.generate_checksum(@params) @posted_checksum == @checksum end |