Class: Ingenico::Connect::SDK::Domain::Token::TokenResponse

Inherits:
Ingenico::Connect::SDK::DataObject show all
Defined in:
lib/ingenico/connect/sdk/domain/token/token_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Ingenico::Connect::SDK::DataObject

new_from_hash

Instance Attribute Details

#cardIngenico::Connect::SDK::Domain::Token::TokenCard

Returns the current value of card.

Returns:



22
23
24
# File 'lib/ingenico/connect/sdk/domain/token/token_response.rb', line 22

def card
  @card
end

#e_walletIngenico::Connect::SDK::Domain::Token::TokenEWallet

Returns the current value of e_wallet.

Returns:



22
23
24
# File 'lib/ingenico/connect/sdk/domain/token/token_response.rb', line 22

def e_wallet
  @e_wallet
end

#idString

Returns the current value of id.

Returns:

  • (String)

    the current value of id



22
23
24
# File 'lib/ingenico/connect/sdk/domain/token/token_response.rb', line 22

def id
  @id
end

#non_sepa_direct_debitIngenico::Connect::SDK::Domain::Token::TokenNonSepaDirectDebit

Returns the current value of non_sepa_direct_debit.

Returns:



22
23
24
# File 'lib/ingenico/connect/sdk/domain/token/token_response.rb', line 22

def non_sepa_direct_debit
  @non_sepa_direct_debit
end

#original_payment_idString

Returns the current value of original_payment_id.

Returns:

  • (String)

    the current value of original_payment_id



22
23
24
# File 'lib/ingenico/connect/sdk/domain/token/token_response.rb', line 22

def original_payment_id
  @original_payment_id
end

#payment_product_idInteger

Returns the current value of payment_product_id.

Returns:

  • (Integer)

    the current value of payment_product_id



22
23
24
# File 'lib/ingenico/connect/sdk/domain/token/token_response.rb', line 22

def payment_product_id
  @payment_product_id
end

#sepa_direct_debitIngenico::Connect::SDK::Domain::Token::TokenSepaDirectDebit

Returns the current value of sepa_direct_debit.

Returns:



22
23
24
# File 'lib/ingenico/connect/sdk/domain/token/token_response.rb', line 22

def sepa_direct_debit
  @sepa_direct_debit
end

Instance Method Details

#from_hash(hash) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/ingenico/connect/sdk/domain/token/token_response.rb', line 51

def from_hash(hash)
  super
  if hash.has_key? 'card'
    raise TypeError, "value '%s' is not a Hash" % [hash['card']] unless hash['card'].is_a? Hash
    @card = Ingenico::Connect::SDK::Domain::Token::TokenCard.new_from_hash(hash['card'])
  end
  if hash.has_key? 'eWallet'
    raise TypeError, "value '%s' is not a Hash" % [hash['eWallet']] unless hash['eWallet'].is_a? Hash
    @e_wallet = Ingenico::Connect::SDK::Domain::Token::TokenEWallet.new_from_hash(hash['eWallet'])
  end
  if hash.has_key? 'id'
    @id = hash['id']
  end
  if hash.has_key? 'nonSepaDirectDebit'
    raise TypeError, "value '%s' is not a Hash" % [hash['nonSepaDirectDebit']] unless hash['nonSepaDirectDebit'].is_a? Hash
    @non_sepa_direct_debit = Ingenico::Connect::SDK::Domain::Token::TokenNonSepaDirectDebit.new_from_hash(hash['nonSepaDirectDebit'])
  end
  if hash.has_key? 'originalPaymentId'
    @original_payment_id = hash['originalPaymentId']
  end
  if hash.has_key? 'paymentProductId'
    @payment_product_id = hash['paymentProductId']
  end
  if hash.has_key? 'sepaDirectDebit'
    raise TypeError, "value '%s' is not a Hash" % [hash['sepaDirectDebit']] unless hash['sepaDirectDebit'].is_a? Hash
    @sepa_direct_debit = Ingenico::Connect::SDK::Domain::Token::TokenSepaDirectDebit.new_from_hash(hash['sepaDirectDebit'])
  end
end

#to_hHash

Returns:

  • (Hash)


39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ingenico/connect/sdk/domain/token/token_response.rb', line 39

def to_h
  hash = super
  hash['card'] = @card.to_h unless @card.nil?
  hash['eWallet'] = @e_wallet.to_h unless @e_wallet.nil?
  hash['id'] = @id unless @id.nil?
  hash['nonSepaDirectDebit'] = @non_sepa_direct_debit.to_h unless @non_sepa_direct_debit.nil?
  hash['originalPaymentId'] = @original_payment_id unless @original_payment_id.nil?
  hash['paymentProductId'] = @payment_product_id unless @payment_product_id.nil?
  hash['sepaDirectDebit'] = @sepa_direct_debit.to_h unless @sepa_direct_debit.nil?
  hash
end