Class: OnlinePayments::SDK::Domain::PaymentProductFieldFormElement
- Inherits:
-
DataObject
- Object
- DataObject
- OnlinePayments::SDK::Domain::PaymentProductFieldFormElement
- Defined in:
- lib/onlinepayments/sdk/domain/payment_product_field_form_element.rb
Instance Attribute Summary collapse
-
#type ⇒ String
The current value of type.
-
#value_mapping ⇒ Object
deprecated
Deprecated.
This field is not used by any payment product
Instance Method Summary collapse
Methods inherited from DataObject
Instance Attribute Details
#type ⇒ String
Returns the current value of type.
12 13 14 |
# File 'lib/onlinepayments/sdk/domain/payment_product_field_form_element.rb', line 12 def type @type end |
#value_mapping ⇒ Object
Deprecated.
This field is not used by any payment product
12 13 14 |
# File 'lib/onlinepayments/sdk/domain/payment_product_field_form_element.rb', line 12 def value_mapping @value_mapping end |
Instance Method Details
#from_hash(hash) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/onlinepayments/sdk/domain/payment_product_field_form_element.rb', line 27 def from_hash(hash) super if hash.has_key? 'type' @type = hash['type'] end if hash.has_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 << OnlinePayments::SDK::Domain::ValueMappingElement.new_from_hash(e) end end end |
#to_h ⇒ Hash
20 21 22 23 24 25 |
# File 'lib/onlinepayments/sdk/domain/payment_product_field_form_element.rb', line 20 def to_h hash = super hash['type'] = @type unless @type.nil? hash['valueMapping'] = @value_mapping.collect{|val| val.to_h} unless @value_mapping.nil? hash end |