Class: Dotpay::Response
- Inherits:
-
Object
- Object
- Dotpay::Response
- Defined in:
- lib/dotpay/response.rb
Constant Summary collapse
- CHECKSUM_KEYS =
%w(id control t_id amount email service code username password t_status)
- STATUS_NEW =
1
- STATUS_DONE =
2
- STATUS_REJECTED =
3
- STATUS_REFUND =
4
- STATUS_COMPLAINT =
5
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #amount ⇒ Object
- #authorized? ⇒ Boolean
- #control ⇒ Object
-
#initialize(params) ⇒ Response
constructor
A new instance of Response.
- #status ⇒ Object
- #status_complaint? ⇒ Boolean
- #status_done? ⇒ Boolean
- #status_new? ⇒ Boolean
- #status_refund? ⇒ Boolean
- #status_rejected? ⇒ Boolean
- #t_id ⇒ Object
Constructor Details
#initialize(params) ⇒ Response
Returns a new instance of Response.
15 16 17 |
# File 'lib/dotpay/response.rb', line 15 def initialize(params) @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
13 14 15 |
# File 'lib/dotpay/response.rb', line 13 def params @params end |
Instance Method Details
#amount ⇒ Object
27 28 29 |
# File 'lib/dotpay/response.rb', line 27 def amount params['amount'] end |
#authorized? ⇒ Boolean
31 32 33 |
# File 'lib/dotpay/response.rb', line 31 def params['md5'] == calculate_checksum end |
#control ⇒ Object
23 24 25 |
# File 'lib/dotpay/response.rb', line 23 def control params['control'] end |
#status ⇒ Object
35 36 37 |
# File 'lib/dotpay/response.rb', line 35 def status params['t_status'].to_i end |
#status_complaint? ⇒ Boolean
55 56 57 |
# File 'lib/dotpay/response.rb', line 55 def status_complaint? status == STATUS_COMPLAINT end |
#status_done? ⇒ Boolean
43 44 45 |
# File 'lib/dotpay/response.rb', line 43 def status_done? status == STATUS_DONE end |
#status_new? ⇒ Boolean
39 40 41 |
# File 'lib/dotpay/response.rb', line 39 def status_new? status == STATUS_NEW end |
#status_refund? ⇒ Boolean
51 52 53 |
# File 'lib/dotpay/response.rb', line 51 def status_refund? status == STATUS_REFUND end |
#status_rejected? ⇒ Boolean
47 48 49 |
# File 'lib/dotpay/response.rb', line 47 def status_rejected? status == STATUS_REJECTED end |
#t_id ⇒ Object
19 20 21 |
# File 'lib/dotpay/response.rb', line 19 def t_id params['t_id'] end |