Class: Ingenico::Direct::SDK::Domain::TokenResponse

Inherits:
Ingenico::Direct::SDK::DataObject show all
Defined in:
lib/ingenico/direct/sdk/domain/token_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Ingenico::Direct::SDK::DataObject

new_from_hash

Instance Attribute Details

#cardIngenico::Direct::SDK::Domain::TokenCard

Returns the current value of card.

Returns:



19
20
21
# File 'lib/ingenico/direct/sdk/domain/token_response.rb', line 19

def card
  @card
end

#e_walletIngenico::Direct::SDK::Domain::TokenEWallet

Returns the current value of e_wallet.

Returns:



19
20
21
# File 'lib/ingenico/direct/sdk/domain/token_response.rb', line 19

def e_wallet
  @e_wallet
end

#external_token_linkedIngenico::Direct::SDK::Domain::ExternalTokenLinked

Returns the current value of external_token_linked.

Returns:



19
20
21
# File 'lib/ingenico/direct/sdk/domain/token_response.rb', line 19

def external_token_linked
  @external_token_linked
end

#idString

Returns the current value of id.

Returns:

  • (String)

    the current value of id



19
20
21
# File 'lib/ingenico/direct/sdk/domain/token_response.rb', line 19

def id
  @id
end

#is_temporarytrue/false

Returns the current value of is_temporary.

Returns:

  • (true/false)

    the current value of is_temporary



19
20
21
# File 'lib/ingenico/direct/sdk/domain/token_response.rb', line 19

def is_temporary
  @is_temporary
end

#payment_product_idInteger

Returns the current value of payment_product_id.

Returns:

  • (Integer)

    the current value of payment_product_id



19
20
21
# File 'lib/ingenico/direct/sdk/domain/token_response.rb', line 19

def payment_product_id
  @payment_product_id
end

Instance Method Details

#from_hash(hash) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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_hHash

Returns:

  • (Hash)


28
29
30
31
32
33
34
35
36
37
# 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