class Ingenico::Direct::SDK::Domain::ValueMappingElement

@attr [Array<Ingenico::Direct::SDK::Domain::PaymentProductFieldDisplayElement>] display_elements @attr [String] value

Attributes

display_elements[RW]
value[RW]

Public Instance Methods

from_hash(hash) click to toggle source
# File lib/ingenico/direct/sdk/domain/value_mapping_element.rb, line 25
def from_hash(hash)
  super
  if hash.key? 'displayElements'
    raise TypeError, "value '%s' is not an Array" % [hash['displayElements']] unless hash['displayElements'].is_a? Array
    @display_elements = []
    hash['displayElements'].each do |e|
      @display_elements << Ingenico::Direct::SDK::Domain::PaymentProductFieldDisplayElement.new_from_hash(e)
    end
  end
  @value = hash['value'] if hash.key? 'value'
end
to_h() click to toggle source

@return (Hash)

Calls superclass method Ingenico::Direct::SDK::DataObject#to_h
# File lib/ingenico/direct/sdk/domain/value_mapping_element.rb, line 18
def to_h
  hash = super
  hash['displayElements'] = @display_elements.collect(&:to_h) if @display_elements
  hash['value'] = @value unless @value.nil?
  hash
end