Class: Ingenico::Connect::SDK::Domain::Token::CreateTokenRequest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

new_from_hash

Instance Attribute Details

#cardObject



18
19
20
# File 'lib/ingenico/connect/sdk/domain/token/create_token_request.rb', line 18

def card
  @card
end

#e_walletObject



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

def e_wallet
  @e_wallet
end

#non_sepa_direct_debitObject



24
25
26
# File 'lib/ingenico/connect/sdk/domain/token/create_token_request.rb', line 24

def non_sepa_direct_debit
  @non_sepa_direct_debit
end

#payment_product_idObject

Integer



27
28
29
# File 'lib/ingenico/connect/sdk/domain/token/create_token_request.rb', line 27

def payment_product_id
  @payment_product_id
end

#sepa_direct_debitObject



30
31
32
# File 'lib/ingenico/connect/sdk/domain/token/create_token_request.rb', line 30

def sepa_direct_debit
  @sepa_direct_debit
end

Instance Method Details

#from_hash(hash) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/ingenico/connect/sdk/domain/token/create_token_request.rb', line 42

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

#to_hObject



32
33
34
35
36
37
38
39
40
# File 'lib/ingenico/connect/sdk/domain/token/create_token_request.rb', line 32

def to_h
  hash = super
  add_to_hash(hash, 'card', @card)
  add_to_hash(hash, 'eWallet', @e_wallet)
  add_to_hash(hash, 'nonSepaDirectDebit', @non_sepa_direct_debit)
  add_to_hash(hash, 'paymentProductId', @payment_product_id)
  add_to_hash(hash, 'sepaDirectDebit', @sepa_direct_debit)
  hash
end