Class: OnlinePayments::SDK::Domain::ValueMappingElement

Inherits:
DataObject
  • Object
show all
Defined in:
lib/onlinepayments/sdk/domain/value_mapping_element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

new_from_hash

Instance Attribute Details

#display_elementsArray<OnlinePayments::SDK::Domain::PaymentProductFieldDisplayElement>

Returns the current value of display_elements.

Returns:



12
13
14
# File 'lib/onlinepayments/sdk/domain/value_mapping_element.rb', line 12

def display_elements
  @display_elements
end

#valueString

Returns the current value of value.

Returns:

  • (String)

    the current value of value



12
13
14
# File 'lib/onlinepayments/sdk/domain/value_mapping_element.rb', line 12

def value
  @value
end

Instance Method Details

#from_hash(hash) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/onlinepayments/sdk/domain/value_mapping_element.rb', line 26

def from_hash(hash)
  super
  if hash.has_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 << OnlinePayments::SDK::Domain::PaymentProductFieldDisplayElement.new_from_hash(e)
    end
  end
  if hash.has_key? 'value'
    @value = hash['value']
  end
end

#to_hHash

Returns:

  • (Hash)


19
20
21
22
23
24
# File 'lib/onlinepayments/sdk/domain/value_mapping_element.rb', line 19

def to_h
  hash = super
  hash['displayElements'] = @display_elements.collect{|val| val.to_h} unless @display_elements.nil?
  hash['value'] = @value unless @value.nil?
  hash
end