Class: OnlinePayments::SDK::Domain::RefundErrorResponse
- Inherits:
-
OnlinePayments::SDK::DataObject
- Object
- OnlinePayments::SDK::DataObject
- OnlinePayments::SDK::Domain::RefundErrorResponse
- Defined in:
- lib/onlinepayments/sdk/domain/refund_error_response.rb
Instance Attribute Summary collapse
-
#error_id ⇒ String
The current value of error_id.
-
#errors ⇒ Array<OnlinePayments::SDK::Domain::APIError>
The current value of errors.
-
#refund_result ⇒ OnlinePayments::SDK::Domain::RefundResponse
The current value of refund_result.
Instance Method Summary collapse
Methods inherited from OnlinePayments::SDK::DataObject
Instance Attribute Details
#error_id ⇒ String
Returns the current value of error_id.
14 15 16 |
# File 'lib/onlinepayments/sdk/domain/refund_error_response.rb', line 14 def error_id @error_id end |
#errors ⇒ Array<OnlinePayments::SDK::Domain::APIError>
Returns the current value of errors.
14 15 16 |
# File 'lib/onlinepayments/sdk/domain/refund_error_response.rb', line 14 def errors @errors end |
#refund_result ⇒ OnlinePayments::SDK::Domain::RefundResponse
Returns the current value of refund_result.
14 15 16 |
# File 'lib/onlinepayments/sdk/domain/refund_error_response.rb', line 14 def refund_result @refund_result end |
Instance Method Details
#from_hash(hash) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/onlinepayments/sdk/domain/refund_error_response.rb', line 28 def from_hash(hash) super @error_id = hash['errorId'] if hash.key? 'errorId' if hash.key? 'errors' raise TypeError, "value '%s' is not an Array" % [hash['errors']] unless hash['errors'].is_a? Array @errors = [] hash['errors'].each do |e| @errors << OnlinePayments::SDK::Domain::APIError.new_from_hash(e) end end if hash.key? 'refundResult' raise TypeError, "value '%s' is not a Hash" % [hash['refundResult']] unless hash['refundResult'].is_a? Hash @refund_result = OnlinePayments::SDK::Domain::RefundResponse.new_from_hash(hash['refundResult']) end end |
#to_h ⇒ Hash
20 21 22 23 24 25 26 |
# File 'lib/onlinepayments/sdk/domain/refund_error_response.rb', line 20 def to_h hash = super hash['errorId'] = @error_id unless @error_id.nil? hash['errors'] = @errors.collect(&:to_h) if @errors hash['refundResult'] = @refund_result.to_h if @refund_result hash end |