Class: Ingenico::Connect::SDK::Domain::Token::TokenCard

Inherits:
AbstractToken show all
Defined in:
lib/ingenico/connect/sdk/domain/token/token_card.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractToken

#alias

Instance Method Summary collapse

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

new_from_hash

Instance Attribute Details

#customerObject



16
17
18
# File 'lib/ingenico/connect/sdk/domain/token/token_card.rb', line 16

def customer
  @customer
end

#dataObject



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

def data
  @data
end

Instance Method Details

#from_hash(hash) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ingenico/connect/sdk/domain/token/token_card.rb', line 28

def from_hash(hash)
  super
  if hash.has_key?('customer')
    if !(hash['customer'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['customer']]
    end
    @customer = Ingenico::Connect::SDK::Domain::Token::CustomerToken.new_from_hash(hash['customer'])
  end
  if hash.has_key?('data')
    if !(hash['data'].is_a? Hash)
      raise TypeError, "value '%s' is not a Hash" % [hash['data']]
    end
    @data = Ingenico::Connect::SDK::Domain::Token::TokenCardData.new_from_hash(hash['data'])
  end
end

#to_hObject



21
22
23
24
25
26
# File 'lib/ingenico/connect/sdk/domain/token/token_card.rb', line 21

def to_h
  hash = super
  add_to_hash(hash, 'customer', @customer)
  add_to_hash(hash, 'data', @data)
  hash
end