class Ingenico::Direct::SDK::Domain::TokenResponse

@attr [Ingenico::Direct::SDK::Domain::TokenCard] card @attr [Ingenico::Direct::SDK::Domain::TokenEWallet] e_wallet @attr [Ingenico::Direct::SDK::Domain::ExternalTokenLinked] external_token_linked @attr [String] id @attr [true/false] is_temporary @attr [Integer] payment_product_id

Attributes

card[RW]
e_wallet[RW]
external_token_linked[RW]
id[RW]
is_temporary[RW]
payment_product_id[RW]

Public Instance Methods

from_hash(hash) click to toggle source
# File lib/ingenico/direct/sdk/domain/token_response.rb, line 39
def from_hash(hash)
  super
  if hash.key? 'card'
    raise TypeError, "value '%s' is not a Hash" % [hash['card']] unless hash['card'].is_a? Hash
    @card = Ingenico::Direct::SDK::Domain::TokenCard.new_from_hash(hash['card'])
  end
  if hash.key? 'eWallet'
    raise TypeError, "value '%s' is not a Hash" % [hash['eWallet']] unless hash['eWallet'].is_a? Hash
    @e_wallet = Ingenico::Direct::SDK::Domain::TokenEWallet.new_from_hash(hash['eWallet'])
  end
  if hash.key? 'externalTokenLinked'
    raise TypeError, "value '%s' is not a Hash" % [hash['externalTokenLinked']] unless hash['externalTokenLinked'].is_a? Hash
    @external_token_linked = Ingenico::Direct::SDK::Domain::ExternalTokenLinked.new_from_hash(hash['externalTokenLinked'])
  end
  @id = hash['id'] if hash.key? 'id'
  @is_temporary = hash['isTemporary'] if hash.key? 'isTemporary'
  @payment_product_id = hash['paymentProductId'] if hash.key? 'paymentProductId'
end
to_h() click to toggle source

@return (Hash)

Calls superclass method Ingenico::Direct::SDK::DataObject#to_h
# File lib/ingenico/direct/sdk/domain/token_response.rb, line 28
def to_h
  hash = super
  hash['card'] = @card.to_h if @card
  hash['eWallet'] = @e_wallet.to_h if @e_wallet
  hash['externalTokenLinked'] = @external_token_linked.to_h if @external_token_linked
  hash['id'] = @id unless @id.nil?
  hash['isTemporary'] = @is_temporary unless @is_temporary.nil?
  hash['paymentProductId'] = @payment_product_id unless @payment_product_id.nil?
  hash
end