Class: Worldline::Connect::SDK::V1::Domain::InstallmentOptions

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Domain::DataObject

new_from_hash

Instance Attribute Details

#display_hintsWorldline::Connect::SDK::V1::Domain::InstallmentDisplayHints

Returns the current value of display_hints.

Returns:



17
18
19
# File 'lib/worldline/connect/sdk/v1/domain/installment_options.rb', line 17

def display_hints
  @display_hints
end

#idString

Returns the current value of id.

Returns:

  • (String)

    the current value of id



17
18
19
# File 'lib/worldline/connect/sdk/v1/domain/installment_options.rb', line 17

def id
  @id
end

#installment_plansArray<Worldline::Connect::SDK::V1::Domain::Installments>

Returns the current value of installment_plans.

Returns:



17
18
19
# File 'lib/worldline/connect/sdk/v1/domain/installment_options.rb', line 17

def installment_plans
  @installment_plans
end

Instance Method Details

#from_hash(hash) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/worldline/connect/sdk/v1/domain/installment_options.rb', line 34

def from_hash(hash)
  super
  if hash.has_key? 'displayHints'
    raise TypeError, "value '%s' is not a Hash" % [hash['displayHints']] unless hash['displayHints'].is_a? Hash
    @display_hints = Worldline::Connect::SDK::V1::Domain::InstallmentDisplayHints.new_from_hash(hash['displayHints'])
  end
  if hash.has_key? 'id'
    @id = hash['id']
  end
  if hash.has_key? 'installmentPlans'
    raise TypeError, "value '%s' is not an Array" % [hash['installmentPlans']] unless hash['installmentPlans'].is_a? Array
    @installment_plans = []
    hash['installmentPlans'].each do |e|
      @installment_plans << Worldline::Connect::SDK::V1::Domain::Installments.new_from_hash(e)
    end
  end
end

#to_hHash

Returns:

  • (Hash)


26
27
28
29
30
31
32
# File 'lib/worldline/connect/sdk/v1/domain/installment_options.rb', line 26

def to_h
  hash = super
  hash['displayHints'] = @display_hints.to_h unless @display_hints.nil?
  hash['id'] = @id unless @id.nil?
  hash['installmentPlans'] = @installment_plans.collect{|val| val.to_h} unless @installment_plans.nil?
  hash
end