Class: OnlinePayments::SDK::Domain::ValueMappingElement
- Inherits:
-
OnlinePayments::SDK::DataObject
- Object
- OnlinePayments::SDK::DataObject
- OnlinePayments::SDK::Domain::ValueMappingElement
- Defined in:
- lib/onlinepayments/sdk/domain/value_mapping_element.rb
Instance Attribute Summary collapse
-
#display_elements ⇒ Array<OnlinePayments::SDK::Domain::PaymentProductFieldDisplayElement>
The current value of display_elements.
-
#value ⇒ String
The current value of value.
Instance Method Summary collapse
Methods inherited from OnlinePayments::SDK::DataObject
Instance Attribute Details
#display_elements ⇒ Array<OnlinePayments::SDK::Domain::PaymentProductFieldDisplayElement>
Returns the current value of display_elements.
12 13 14 |
# File 'lib/onlinepayments/sdk/domain/value_mapping_element.rb', line 12 def display_elements @display_elements end |
#value ⇒ String
Returns 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
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/onlinepayments/sdk/domain/value_mapping_element.rb', line 24 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 << OnlinePayments::SDK::Domain::PaymentProductFieldDisplayElement.new_from_hash(e) end end @value = hash['value'] if hash.key? 'value' end |
#to_h ⇒ Hash
17 18 19 20 21 22 |
# File 'lib/onlinepayments/sdk/domain/value_mapping_element.rb', line 17 def to_h hash = super hash['displayElements'] = @display_elements.collect(&:to_h) if @display_elements hash['value'] = @value unless @value.nil? hash end |