Class: QiwiObserver::PaymentsResponse
- Defined in:
- lib/qiwi_observer/payments/payments_response.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(success:, body:) ⇒ PaymentsResponse
constructor
A new instance of PaymentsResponse.
- #short_info ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(success:, body:) ⇒ PaymentsResponse
Returns a new instance of PaymentsResponse.
5 6 7 8 9 10 11 12 13 |
# File 'lib/qiwi_observer/payments/payments_response.rb', line 5 def initialize(success:, body:) @success = success if @success @value = parse_body(body) else @error = error_description(body) end end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
3 4 5 |
# File 'lib/qiwi_observer/payments/payments_response.rb', line 3 def error @error end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/qiwi_observer/payments/payments_response.rb', line 3 def value @value end |
Instance Method Details
#short_info ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/qiwi_observer/payments/payments_response.rb', line 19 def short_info output = [] hash = @value hash[:data].each do |tran| output << { account_id: tran[:account], amount: tran[:total][:amount], date: tran[:date], comment: tran[:comment] } end output end |
#success? ⇒ Boolean
15 16 17 |
# File 'lib/qiwi_observer/payments/payments_response.rb', line 15 def success? @success end |