Class: SplititWebApiV4::InstallmentPlanDetailsResponse

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

Overview

InstallmentPlanDetailsResponse 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(date_created:, status:, installment_provider:, purchase_method:, purchase_amount:, total_amount:, total_fees:, installment_plan_number: SKIP, merchant_order_reference: SKIP, currency: SKIP, apr: SKIP, authorization: SKIP, shopper_details: SKIP, payment_method: SKIP, installments: SKIP, refunds: SKIP, links: SKIP, metadata: SKIP, additional_properties: nil) ⇒ InstallmentPlanDetailsResponse

Returns a new instance of InstallmentPlanDetailsResponse.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 131

def initialize(date_created:, status:, installment_provider:,
               purchase_method:, purchase_amount:, total_amount:,
               total_fees:, installment_plan_number: SKIP,
               merchant_order_reference: SKIP, currency: SKIP, apr: SKIP,
               authorization: SKIP, shopper_details: SKIP,
               payment_method: SKIP, installments: SKIP, refunds: SKIP,
               links: SKIP, metadata: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @date_created = date_created
  @status = status
  @installment_plan_number = installment_plan_number unless installment_plan_number == SKIP
  @merchant_order_reference = merchant_order_reference unless merchant_order_reference == SKIP
  @installment_provider = installment_provider
  @purchase_method = purchase_method
  @currency = currency unless currency == SKIP
  @purchase_amount = purchase_amount
  @total_amount = total_amount
  @total_fees = total_fees
  @apr = apr unless apr == SKIP
  @authorization = authorization unless authorization == SKIP
  @shopper_details = shopper_details unless shopper_details == SKIP
  @payment_method = payment_method unless payment_method == SKIP
  @installments = installments unless installments == SKIP
  @refunds = refunds unless refunds == SKIP
  @links = links unless links == SKIP
  @metadata =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#aprAprData

TODO: Write general description for this method

Returns:



55
56
57
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 55

def apr
  @apr
end

#authorizationPlanAuthorizationData

TODO: Write general description for this method



59
60
61
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 59

def authorization
  @authorization
end

#currencyString

TODO: Write general description for this method

Returns:

  • (String)


39
40
41
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 39

def currency
  @currency
end

#date_createdDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


15
16
17
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 15

def date_created
  @date_created
end

#installment_plan_numberString

TODO: Write general description for this method

Returns:

  • (String)


23
24
25
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 23

def installment_plan_number
  @installment_plan_number
end

#installment_providerExternalProviderTypes

TODO: Write general description for this method



31
32
33
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 31

def installment_provider
  @installment_provider
end

#installmentsArray[InstallmentItem]

TODO: Write general description for this method

Returns:



71
72
73
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 71

def installments
  @installments
end

TODO: Write general description for this method

Returns:



79
80
81
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 79

def links
  @links
end

#merchant_order_referenceString

TODO: Write general description for this method

Returns:

  • (String)


27
28
29
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 27

def merchant_order_reference
  @merchant_order_reference
end

#metadataArray[MetadataItem]

TODO: Write general description for this method

Returns:



83
84
85
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 83

def 
  @metadata
end

#payment_methodPaymentMethodData

TODO: Write general description for this method

Returns:



67
68
69
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 67

def payment_method
  @payment_method
end

#purchase_amountFloat

TODO: Write general description for this method

Returns:

  • (Float)


43
44
45
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 43

def purchase_amount
  @purchase_amount
end

#purchase_methodPurchaseMethod

TODO: Write general description for this method

Returns:



35
36
37
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 35

def purchase_method
  @purchase_method
end

#refundsArray[RefundItem]

TODO: Write general description for this method

Returns:



75
76
77
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 75

def refunds
  @refunds
end

#shopper_detailsShopperDetailsData

TODO: Write general description for this method

Returns:



63
64
65
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 63

def shopper_details
  @shopper_details
end

#statusInstallmentPlanStatus

TODO: Write general description for this method



19
20
21
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 19

def status
  @status
end

#total_amountFloat

TODO: Write general description for this method

Returns:

  • (Float)


47
48
49
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 47

def total_amount
  @total_amount
end

#total_feesFloat

TODO: Write general description for this method

Returns:

  • (Float)


51
52
53
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 51

def total_fees
  @total_fees
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 163

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  date_created = if hash.key?('DateCreated')
                   (DateTimeHelper.from_rfc3339(hash['DateCreated']) if hash['DateCreated'])
                 end
  status = hash.key?('Status') ? hash['Status'] : nil
  installment_provider =
    hash.key?('InstallmentProvider') ? hash['InstallmentProvider'] : nil
  purchase_method =
    hash.key?('PurchaseMethod') ? hash['PurchaseMethod'] : nil
  purchase_amount =
    hash.key?('PurchaseAmount') ? hash['PurchaseAmount'] : nil
  total_amount = hash.key?('TotalAmount') ? hash['TotalAmount'] : nil
  total_fees = hash.key?('TotalFees') ? hash['TotalFees'] : nil
  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
  apr = AprData.from_hash(hash['Apr']) if hash['Apr']
  authorization = PlanAuthorizationData.from_hash(hash['Authorization']) if
    hash['Authorization']
  shopper_details = ShopperDetailsData.from_hash(hash['ShopperDetails']) if
    hash['ShopperDetails']
  payment_method = PaymentMethodData.from_hash(hash['PaymentMethod']) if hash['PaymentMethod']
  # Parameter is an array, so we need to iterate through it
  installments = nil
  unless hash['Installments'].nil?
    installments = []
    hash['Installments'].each do |structure|
      installments << (InstallmentItem.from_hash(structure) if structure)
    end
  end

  installments = SKIP unless hash.key?('Installments')
  # Parameter is an array, so we need to iterate through it
  refunds = nil
  unless hash['Refunds'].nil?
    refunds = []
    hash['Refunds'].each do |structure|
      refunds << (RefundItem.from_hash(structure) if structure)
    end
  end

  refunds = SKIP unless hash.key?('Refunds')
  # Parameter is an array, so we need to iterate through it
  links = nil
  unless hash['Links'].nil?
    links = []
    hash['Links'].each do |structure|
      links << (PlanLinksData.from_hash(structure) if structure)
    end
  end

  links = SKIP unless hash.key?('Links')
  # Parameter is an array, so we need to iterate through it
   = nil
  unless hash['Metadata'].nil?
     = []
    hash['Metadata'].each do |structure|
       << (MetadataItem.from_hash(structure) if structure)
    end
  end

   = SKIP unless hash.key?('Metadata')

  # 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.
  InstallmentPlanDetailsResponse.new(date_created: date_created,
                                     status: status,
                                     installment_provider: installment_provider,
                                     purchase_method: purchase_method,
                                     purchase_amount: purchase_amount,
                                     total_amount: total_amount,
                                     total_fees: total_fees,
                                     installment_plan_number: installment_plan_number,
                                     merchant_order_reference: merchant_order_reference,
                                     currency: currency,
                                     apr: apr,
                                     authorization: authorization,
                                     shopper_details: shopper_details,
                                     payment_method: payment_method,
                                     installments: installments,
                                     refunds: refunds,
                                     links: links,
                                     metadata: ,
                                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 86

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['date_created'] = 'DateCreated'
  @_hash['status'] = 'Status'
  @_hash['installment_plan_number'] = 'InstallmentPlanNumber'
  @_hash['merchant_order_reference'] = 'MerchantOrderReference'
  @_hash['installment_provider'] = 'InstallmentProvider'
  @_hash['purchase_method'] = 'PurchaseMethod'
  @_hash['currency'] = 'Currency'
  @_hash['purchase_amount'] = 'PurchaseAmount'
  @_hash['total_amount'] = 'TotalAmount'
  @_hash['total_fees'] = 'TotalFees'
  @_hash['apr'] = 'Apr'
  @_hash['authorization'] = 'Authorization'
  @_hash['shopper_details'] = 'ShopperDetails'
  @_hash['payment_method'] = 'PaymentMethod'
  @_hash['installments'] = 'Installments'
  @_hash['refunds'] = 'Refunds'
  @_hash['links'] = 'Links'
  @_hash['metadata'] = 'Metadata'
  @_hash
end

.nullablesObject

An array for nullable fields



127
128
129
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 127

def self.nullables
  []
end

.optionalsObject

An array for optional fields



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 110

def self.optionals
  %w[
    installment_plan_number
    merchant_order_reference
    currency
    apr
    authorization
    shopper_details
    payment_method
    installments
    refunds
    links
    metadata
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 279

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} date_created: #{@date_created.inspect}, status: #{@status.inspect},"\
  " installment_plan_number: #{@installment_plan_number.inspect}, merchant_order_reference:"\
  " #{@merchant_order_reference.inspect}, installment_provider:"\
  " #{@installment_provider.inspect}, purchase_method: #{@purchase_method.inspect}, currency:"\
  " #{@currency.inspect}, purchase_amount: #{@purchase_amount.inspect}, total_amount:"\
  " #{@total_amount.inspect}, total_fees: #{@total_fees.inspect}, apr: #{@apr.inspect},"\
  " authorization: #{@authorization.inspect}, shopper_details: #{@shopper_details.inspect},"\
  " payment_method: #{@payment_method.inspect}, installments: #{@installments.inspect},"\
  " refunds: #{@refunds.inspect}, links: #{@links.inspect}, metadata: #{@metadata.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_date_createdObject



260
261
262
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 260

def to_custom_date_created
  DateTimeHelper.to_rfc3339(date_created)
end

#to_sObject

Provides a human-readable string representation of the object.



265
266
267
268
269
270
271
272
273
274
275
276
# File 'lib/splitit_web_api_v4/models/installment_plan_details_response.rb', line 265

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} date_created: #{@date_created}, status: #{@status},"\
  " installment_plan_number: #{@installment_plan_number}, merchant_order_reference:"\
  " #{@merchant_order_reference}, installment_provider: #{@installment_provider},"\
  " purchase_method: #{@purchase_method}, currency: #{@currency}, purchase_amount:"\
  " #{@purchase_amount}, total_amount: #{@total_amount}, total_fees: #{@total_fees}, apr:"\
  " #{@apr}, authorization: #{@authorization}, shopper_details: #{@shopper_details},"\
  " payment_method: #{@payment_method}, installments: #{@installments}, refunds: #{@refunds},"\
  " links: #{@links}, metadata: #{@metadata}, additional_properties:"\
  " #{@additional_properties}>"
end