Class: Ingenico::Direct::SDK::Domain::ValueMappingElement
- Inherits:
-
Ingenico::Direct::SDK::DataObject
- Object
- Ingenico::Direct::SDK::DataObject
- Ingenico::Direct::SDK::Domain::ValueMappingElement
- Defined in:
- lib/ingenico/direct/sdk/domain/value_mapping_element.rb
Instance Attribute Summary collapse
-
#display_elements ⇒ Array<Ingenico::Direct::SDK::Domain::PaymentProductFieldDisplayElement>
The current value of display_elements.
-
#value ⇒ String
The current value of value.
Instance Method Summary collapse
Methods inherited from Ingenico::Direct::SDK::DataObject
Instance Attribute Details
#display_elements ⇒ Array<Ingenico::Direct::SDK::Domain::PaymentProductFieldDisplayElement>
Returns the current value of display_elements.
13 14 15 |
# File 'lib/ingenico/direct/sdk/domain/value_mapping_element.rb', line 13 def display_elements @display_elements end |
#value ⇒ String
Returns the current value of value.
13 14 15 |
# File 'lib/ingenico/direct/sdk/domain/value_mapping_element.rb', line 13 def value @value 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/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 ⇒ Hash
18 19 20 21 22 23 |
# 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 |