Class: Worldline::Connect::SDK::V1::Domain::PaymentProductFieldFormElement

Inherits:
Domain::DataObject
  • Object
show all
Defined in:
lib/worldline/connect/sdk/v1/domain/payment_product_field_form_element.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Domain::DataObject

new_from_hash

Instance Attribute Details

#typeString

Returns the current value of type.

Returns:

  • (String)

    the current value of type



15
16
17
# File 'lib/worldline/connect/sdk/v1/domain/payment_product_field_form_element.rb', line 15

def type
  @type
end

#value_mappingArray<Worldline::Connect::SDK::V1::Domain::ValueMappingElement>

Returns the current value of value_mapping.

Returns:



15
16
17
# File 'lib/worldline/connect/sdk/v1/domain/payment_product_field_form_element.rb', line 15

def value_mapping
  @value_mapping
end

Instance Method Details

#from_hash(hash) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/worldline/connect/sdk/v1/domain/payment_product_field_form_element.rb', line 29

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 << Worldline::Connect::SDK::V1::Domain::ValueMappingElement.new_from_hash(e)
    end
  end
end

#to_hHash

Returns:

  • (Hash)


22
23
24
25
26
27
# File 'lib/worldline/connect/sdk/v1/domain/payment_product_field_form_element.rb', line 22

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