Class: Ingenico::Direct::SDK::Domain::PaymentProductFieldFormElement

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

new_from_hash

Instance Attribute Details

#typeString

Returns the current value of type.

Returns:

  • (String)

    the current value of type



13
14
15
# File 'lib/ingenico/direct/sdk/domain/payment_product_field_form_element.rb', line 13

def type
  @type
end

#value_mappingArray<Ingenico::Direct::SDK::Domain::ValueMappingElement>

Returns the current value of value_mapping.

Returns:



13
14
15
# File 'lib/ingenico/direct/sdk/domain/payment_product_field_form_element.rb', line 13

def value_mapping
  @value_mapping
end

Instance Method Details

#from_hash(hash) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ingenico/direct/sdk/domain/payment_product_field_form_element.rb', line 25

def from_hash(hash)
  super
  @type = hash['type'] if hash.key? 'type'
  if hash.key? 'valueMapping'
    raise TypeError, "value '%s' is not an Array" % [hash['valueMapping']] unless hash['valueMapping'].is_a? Array
    @value_mapping = []
    hash['valueMapping'].each do |e|
      @value_mapping << Ingenico::Direct::SDK::Domain::ValueMappingElement.new_from_hash(e)
    end
  end
end

#to_hHash

Returns:

  • (Hash)


18
19
20
21
22
23
# File 'lib/ingenico/direct/sdk/domain/payment_product_field_form_element.rb', line 18

def to_h
  hash = super
  hash['type'] = @type unless @type.nil?
  hash['valueMapping'] = @value_mapping.collect(&:to_h) if @value_mapping
  hash
end