Class: SixSaferpay::MastercardIssuerInstallments

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/models/mastercard_issuer_installments.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(installment_plans: nil, custom_plan: nil, chosen_plan: nil, receipt_free_text: nil) ⇒ MastercardIssuerInstallments

Returns a new instance of MastercardIssuerInstallments.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/six_saferpay/models/mastercard_issuer_installments.rb', line 11

def initialize(
    installment_plans: nil,
    custom_plan: nil,
    chosen_plan: nil,
    receipt_free_text: nil
  )
  if installment_plans
    @installment_plans = SixSaferpay::InstallmentPlans
      .new(**installment_plans.to_h)
  end
  if custom_plan
    @custom_plan = SixSaferpay::CustomPlan
      .new(**custom_plan.to_h)
  end
  if chosen_plan
    @chosen_plan = SixSaferpay::ChosenPlan
      .new(**chosen_plan.to_h)
  end
  @receipt_free_text = receipt_free_text
end

Instance Attribute Details

#chosen_planObject

Returns the value of attribute chosen_plan.



4
5
6
# File 'lib/six_saferpay/models/mastercard_issuer_installments.rb', line 4

def chosen_plan
  @chosen_plan
end

#custom_planObject

Returns the value of attribute custom_plan.



4
5
6
# File 'lib/six_saferpay/models/mastercard_issuer_installments.rb', line 4

def custom_plan
  @custom_plan
end

#installment_plansObject

Returns the value of attribute installment_plans.



4
5
6
# File 'lib/six_saferpay/models/mastercard_issuer_installments.rb', line 4

def installment_plans
  @installment_plans
end

#receipt_free_textObject

Returns the value of attribute receipt_free_text.



4
5
6
# File 'lib/six_saferpay/models/mastercard_issuer_installments.rb', line 4

def receipt_free_text
  @receipt_free_text
end

Instance Method Details

#to_hashObject Also known as: to_h



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/six_saferpay/models/mastercard_issuer_installments.rb', line 32

def to_hash
  hash = Hash.new
  if @installment_plans
    hash.merge!(installment_plans: @installment_plans.to_h)
  end
  if @custom_plan
    hash.merge!(custom_plan: @custom_plan.to_h)
  end
  if @chosen_plan
    hash.merge!(chosen_plan: @chosen_plan.to_h)
  end
  hash.merge!(receipt_free_text: @receipt_free_text)
  hash
end