Class: SplititWebApiV4::PaymentLinkResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/splitit_web_api_v4/models/payment_link_response.rb

Overview

PaymentLinkResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(purchase_amount:, checkout_url: SKIP, installment_plan_number: SKIP, merchant_order_reference: SKIP, currency: SKIP, additional_properties: nil) ⇒ PaymentLinkResponse

Returns a new instance of PaymentLinkResponse.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 58

def initialize(purchase_amount:, checkout_url: SKIP,
               installment_plan_number: SKIP,
               merchant_order_reference: SKIP, currency: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @checkout_url = checkout_url unless checkout_url == SKIP
  @installment_plan_number = installment_plan_number unless installment_plan_number == SKIP
  @merchant_order_reference = merchant_order_reference unless merchant_order_reference == SKIP
  @purchase_amount = purchase_amount
  @currency = currency unless currency == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#checkout_urlCheckoutUrlData

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 14

def checkout_url
  @checkout_url
end

#currencyString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 30

def currency
  @currency
end

#installment_plan_numberString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 18

def installment_plan_number
  @installment_plan_number
end

#merchant_order_referenceString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 22

def merchant_order_reference
  @merchant_order_reference
end

#purchase_amountFloat

TODO: Write general description for this method

Returns:

  • (Float)


26
27
28
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 26

def purchase_amount
  @purchase_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  purchase_amount =
    hash.key?('PurchaseAmount') ? hash['PurchaseAmount'] : nil
  checkout_url = CheckoutUrlData.from_hash(hash['CheckoutUrl']) if hash['CheckoutUrl']
  installment_plan_number =
    hash.key?('InstallmentPlanNumber') ? hash['InstallmentPlanNumber'] : SKIP
  merchant_order_reference =
    hash.key?('MerchantOrderReference') ? hash['MerchantOrderReference'] : SKIP
  currency = hash.key?('Currency') ? hash['Currency'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  PaymentLinkResponse.new(purchase_amount: purchase_amount,
                          checkout_url: checkout_url,
                          installment_plan_number: installment_plan_number,
                          merchant_order_reference: merchant_order_reference,
                          currency: currency,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['checkout_url'] = 'CheckoutUrl'
  @_hash['installment_plan_number'] = 'InstallmentPlanNumber'
  @_hash['merchant_order_reference'] = 'MerchantOrderReference'
  @_hash['purchase_amount'] = 'PurchaseAmount'
  @_hash['currency'] = 'Currency'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 44

def self.optionals
  %w[
    checkout_url
    installment_plan_number
    merchant_order_reference
    currency
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



113
114
115
116
117
118
119
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 113

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} checkout_url: #{@checkout_url.inspect}, installment_plan_number:"\
  " #{@installment_plan_number.inspect}, merchant_order_reference:"\
  " #{@merchant_order_reference.inspect}, purchase_amount: #{@purchase_amount.inspect},"\
  " currency: #{@currency.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



104
105
106
107
108
109
110
# File 'lib/splitit_web_api_v4/models/payment_link_response.rb', line 104

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} checkout_url: #{@checkout_url}, installment_plan_number:"\
  " #{@installment_plan_number}, merchant_order_reference: #{@merchant_order_reference},"\
  " purchase_amount: #{@purchase_amount}, currency: #{@currency}, additional_properties:"\
  " #{@additional_properties}>"
end