class Ingenico::Connect::SDK::Domain::Payment::PaymentErrorResponse

@attr [String] error_id @attr [Array<Ingenico::Connect::SDK::Domain::Errors::APIError>] errors @attr [Ingenico::Connect::SDK::Domain::Payment::CreatePaymentResult] payment_result

Attributes

error_id[RW]
errors[RW]
payment_result[RW]

Public Instance Methods

from_hash(hash) click to toggle source
# File lib/ingenico/connect/sdk/domain/payment/payment_error_response.rb, line 33
def from_hash(hash)
  super
  if hash.has_key? 'errorId'
    @error_id = hash['errorId']
  end
  if hash.has_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 << Ingenico::Connect::SDK::Domain::Errors::APIError.new_from_hash(e)
    end
  end
  if hash.has_key? 'paymentResult'
    raise TypeError, "value '%s' is not a Hash" % [hash['paymentResult']] unless hash['paymentResult'].is_a? Hash
    @payment_result = Ingenico::Connect::SDK::Domain::Payment::CreatePaymentResult.new_from_hash(hash['paymentResult'])
  end
end
to_h() click to toggle source

@return (Hash)

Calls superclass method Ingenico::Connect::SDK::DataObject#to_h
# File lib/ingenico/connect/sdk/domain/payment/payment_error_response.rb, line 25
def to_h
  hash = super
  hash['errorId'] = @error_id unless @error_id.nil?
  hash['errors'] = @errors.collect{|val| val.to_h} unless @errors.nil?
  hash['paymentResult'] = @payment_result.to_h unless @payment_result.nil?
  hash
end