Class: Ingenico::Direct::SDK::Domain::AccountOnFile

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

new_from_hash

Instance Attribute Details

#attributesArray<Ingenico::Direct::SDK::Domain::AccountOnFileAttribute>

Returns the current value of attributes.

Returns:



16
17
18
# File 'lib/ingenico/direct/sdk/domain/account_on_file.rb', line 16

def attributes
  @attributes
end

#display_hintsIngenico::Direct::SDK::Domain::AccountOnFileDisplayHints

Returns the current value of display_hints.

Returns:



16
17
18
# File 'lib/ingenico/direct/sdk/domain/account_on_file.rb', line 16

def display_hints
  @display_hints
end

#idInteger

Returns the current value of id.

Returns:

  • (Integer)

    the current value of id



16
17
18
# File 'lib/ingenico/direct/sdk/domain/account_on_file.rb', line 16

def id
  @id
end

#payment_product_idInteger

Returns the current value of payment_product_id.

Returns:

  • (Integer)

    the current value of payment_product_id



16
17
18
# File 'lib/ingenico/direct/sdk/domain/account_on_file.rb', line 16

def payment_product_id
  @payment_product_id
end

Instance Method Details

#from_hash(hash) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ingenico/direct/sdk/domain/account_on_file.rb', line 32

def from_hash(hash)
  super
  if hash.key? 'attributes'
    raise TypeError, "value '%s' is not an Array" % [hash['attributes']] unless hash['attributes'].is_a? Array
    @attributes = []
    hash['attributes'].each do |e|
      @attributes << Ingenico::Direct::SDK::Domain::AccountOnFileAttribute.new_from_hash(e)
    end
  end
  if hash.key? 'displayHints'
    raise TypeError, "value '%s' is not a Hash" % [hash['displayHints']] unless hash['displayHints'].is_a? Hash
    @display_hints = Ingenico::Direct::SDK::Domain::AccountOnFileDisplayHints.new_from_hash(hash['displayHints'])
  end
  @id = hash['id'] if hash.key? 'id'
  @payment_product_id = hash['paymentProductId'] if hash.key? 'paymentProductId'
end

#to_hHash

Returns:

  • (Hash)


23
24
25
26
27
28
29
30
# File 'lib/ingenico/direct/sdk/domain/account_on_file.rb', line 23

def to_h
  hash = super
  hash['attributes'] = @attributes.collect(&:to_h) if @attributes
  hash['displayHints'] = @display_hints.to_h if @display_hints
  hash['id'] = @id unless @id.nil?
  hash['paymentProductId'] = @payment_product_id unless @payment_product_id.nil?
  hash
end