Class: AdvancedBilling::ProformaInvoicePreview

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/proforma_invoice_preview.rb

Overview

ProformaInvoicePreview Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(uid = SKIP, site_id = SKIP, customer_id = SKIP, subscription_id = SKIP, number = SKIP, sequence_number = SKIP, created_at = SKIP, delivery_date = SKIP, status = SKIP, collection_method = SKIP, payment_instructions = SKIP, currency = SKIP, consolidation_level = SKIP, product_name = SKIP, product_family_name = SKIP, role = SKIP, seller = SKIP, customer = SKIP, memo = SKIP, billing_address = SKIP, shipping_address = SKIP, subtotal_amount = SKIP, discount_amount = SKIP, tax_amount = SKIP, total_amount = SKIP, credit_amount = SKIP, paid_amount = SKIP, refund_amount = SKIP, due_amount = SKIP, line_items = SKIP, discounts = SKIP, taxes = SKIP, credits = SKIP, payments = SKIP, custom_fields = SKIP, public_url = SKIP) ⇒ ProformaInvoicePreview

Returns a new instance of ProformaInvoicePreview.



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 265

def initialize(uid = SKIP, site_id = SKIP, customer_id = SKIP,
               subscription_id = SKIP, number = SKIP,
               sequence_number = SKIP, created_at = SKIP,
               delivery_date = SKIP, status = SKIP,
               collection_method = SKIP, payment_instructions = SKIP,
               currency = SKIP, consolidation_level = SKIP,
               product_name = SKIP, product_family_name = SKIP, role = SKIP,
               seller = SKIP, customer = SKIP, memo = SKIP,
               billing_address = SKIP, shipping_address = SKIP,
               subtotal_amount = SKIP, discount_amount = SKIP,
               tax_amount = SKIP, total_amount = SKIP, credit_amount = SKIP,
               paid_amount = SKIP, refund_amount = SKIP, due_amount = SKIP,
               line_items = SKIP, discounts = SKIP, taxes = SKIP,
               credits = SKIP, payments = SKIP, custom_fields = SKIP,
               public_url = SKIP)
  @uid = uid unless uid == SKIP
  @site_id = site_id unless site_id == SKIP
  @customer_id = customer_id unless customer_id == SKIP
  @subscription_id = subscription_id unless subscription_id == SKIP
  @number = number unless number == SKIP
  @sequence_number = sequence_number unless sequence_number == SKIP
  @created_at = created_at unless created_at == SKIP
  @delivery_date = delivery_date unless delivery_date == SKIP
  @status = status unless status == SKIP
  @collection_method = collection_method unless collection_method == SKIP
  @payment_instructions = payment_instructions unless payment_instructions == SKIP
  @currency = currency unless currency == SKIP
  @consolidation_level = consolidation_level unless consolidation_level == SKIP
  @product_name = product_name unless product_name == SKIP
  @product_family_name = product_family_name unless product_family_name == SKIP
  @role = role unless role == SKIP
  @seller = seller unless seller == SKIP
  @customer = customer unless customer == SKIP
  @memo = memo unless memo == SKIP
  @billing_address = billing_address unless billing_address == SKIP
  @shipping_address = shipping_address unless shipping_address == SKIP
  @subtotal_amount = subtotal_amount unless subtotal_amount == SKIP
  @discount_amount = discount_amount unless discount_amount == SKIP
  @tax_amount = tax_amount unless tax_amount == SKIP
  @total_amount = total_amount unless total_amount == SKIP
  @credit_amount = credit_amount unless credit_amount == SKIP
  @paid_amount = paid_amount unless paid_amount == SKIP
  @refund_amount = refund_amount unless refund_amount == SKIP
  @due_amount = due_amount unless due_amount == SKIP
  @line_items = line_items unless line_items == SKIP
  @discounts = discounts unless discounts == SKIP
  @taxes = taxes unless taxes == SKIP
  @credits = credits unless credits == SKIP
  @payments = payments unless payments == SKIP
  @custom_fields = custom_fields unless custom_fields == SKIP
  @public_url = public_url unless public_url == SKIP
end

Instance Attribute Details

#billing_addressInvoiceAddress

Information about the customer who is owner or recipient the invoiced subscription.

Returns:



94
95
96
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 94

def billing_address
  @billing_address
end

#collection_methodString

TODO: Write general description for this method

Returns:

  • (String)


50
51
52
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 50

def collection_method
  @collection_method
end

#consolidation_levelString

TODO: Write general description for this method

Returns:

  • (String)


62
63
64
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 62

def consolidation_level
  @consolidation_level
end

#created_atString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 38

def created_at
  @created_at
end

#credit_amountString

Information about the customer who is owner or recipient the invoiced subscription.

Returns:

  • (String)


124
125
126
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 124

def credit_amount
  @credit_amount
end

#creditsArray[ProformaInvoiceCredit]

Information about the customer who is owner or recipient the invoiced subscription.

Returns:



159
160
161
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 159

def credits
  @credits
end

#currencyString

TODO: Write general description for this method

Returns:

  • (String)


58
59
60
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 58

def currency
  @currency
end

#custom_fieldsArray[ProformaCustomField]

Information about the customer who is owner or recipient the invoiced subscription.

Returns:



169
170
171
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 169

def custom_fields
  @custom_fields
end

#customerInvoiceCustomer

Information about the customer who is owner or recipient the invoiced subscription.

Returns:



84
85
86
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 84

def customer
  @customer
end

#customer_idFloat

TODO: Write general description for this method

Returns:

  • (Float)


22
23
24
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 22

def customer_id
  @customer_id
end

#delivery_dateString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 42

def delivery_date
  @delivery_date
end

#discount_amountString

Information about the customer who is owner or recipient the invoiced subscription.

Returns:

  • (String)


109
110
111
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 109

def discount_amount
  @discount_amount
end

#discountsArray[ProformaInvoiceDiscount]

Information about the customer who is owner or recipient the invoiced subscription.

Returns:



149
150
151
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 149

def discounts
  @discounts
end

#due_amountString

Information about the customer who is owner or recipient the invoiced subscription.

Returns:

  • (String)


139
140
141
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 139

def due_amount
  @due_amount
end

#line_itemsArray[InvoiceLineItem]

Information about the customer who is owner or recipient the invoiced subscription.

Returns:



144
145
146
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 144

def line_items
  @line_items
end

#memoString

Information about the customer who is owner or recipient the invoiced subscription.

Returns:

  • (String)


89
90
91
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 89

def memo
  @memo
end

#numberString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 30

def number
  @number
end

Information about the customer who is owner or recipient the invoiced subscription.

Returns:

  • (String)


129
130
131
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 129

def paid_amount
  @paid_amount
end

#payment_instructionsString

TODO: Write general description for this method

Returns:

  • (String)


54
55
56
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 54

def payment_instructions
  @payment_instructions
end

#paymentsArray[ProformaInvoicePayment]

Information about the customer who is owner or recipient the invoiced subscription.

Returns:



164
165
166
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 164

def payments
  @payments
end

#product_family_nameString

TODO: Write general description for this method

Returns:

  • (String)


70
71
72
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 70

def product_family_name
  @product_family_name
end

#product_nameString

TODO: Write general description for this method

Returns:

  • (String)


66
67
68
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 66

def product_name
  @product_name
end

#public_urlString

Information about the customer who is owner or recipient the invoiced subscription.

Returns:

  • (String)


174
175
176
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 174

def public_url
  @public_url
end

#refund_amountString

Information about the customer who is owner or recipient the invoiced subscription.

Returns:

  • (String)


134
135
136
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 134

def refund_amount
  @refund_amount
end

#roleString

TODO: Write general description for this method

Returns:

  • (String)


74
75
76
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 74

def role
  @role
end

#sellerInvoiceSeller

Information about the seller (merchant) listed on the masthead of the invoice.

Returns:



79
80
81
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 79

def seller
  @seller
end

#sequence_numberInteger

TODO: Write general description for this method

Returns:

  • (Integer)


34
35
36
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 34

def sequence_number
  @sequence_number
end

#shipping_addressInvoiceAddress

Information about the customer who is owner or recipient the invoiced subscription.

Returns:



99
100
101
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 99

def shipping_address
  @shipping_address
end

#site_idFloat

TODO: Write general description for this method

Returns:

  • (Float)


18
19
20
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 18

def site_id
  @site_id
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


46
47
48
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 46

def status
  @status
end

#subscription_idFloat

TODO: Write general description for this method

Returns:

  • (Float)


26
27
28
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 26

def subscription_id
  @subscription_id
end

#subtotal_amountString

Information about the customer who is owner or recipient the invoiced subscription.

Returns:

  • (String)


104
105
106
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 104

def subtotal_amount
  @subtotal_amount
end

#tax_amountString

Information about the customer who is owner or recipient the invoiced subscription.

Returns:

  • (String)


114
115
116
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 114

def tax_amount
  @tax_amount
end

#taxesArray[ProformaInvoiceTax]

Information about the customer who is owner or recipient the invoiced subscription.

Returns:



154
155
156
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 154

def taxes
  @taxes
end

#total_amountString

Information about the customer who is owner or recipient the invoiced subscription.

Returns:

  • (String)


119
120
121
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 119

def total_amount
  @total_amount
end

#uidString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 14

def uid
  @uid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 319

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  uid = hash.key?('uid') ? hash['uid'] : SKIP
  site_id = hash.key?('site_id') ? hash['site_id'] : SKIP
  customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP
  subscription_id =
    hash.key?('subscription_id') ? hash['subscription_id'] : SKIP
  number = hash.key?('number') ? hash['number'] : SKIP
  sequence_number =
    hash.key?('sequence_number') ? hash['sequence_number'] : SKIP
  created_at = hash.key?('created_at') ? hash['created_at'] : SKIP
  delivery_date = hash.key?('delivery_date') ? hash['delivery_date'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  collection_method =
    hash.key?('collection_method') ? hash['collection_method'] : SKIP
  payment_instructions =
    hash.key?('payment_instructions') ? hash['payment_instructions'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP
  consolidation_level =
    hash.key?('consolidation_level') ? hash['consolidation_level'] : SKIP
  product_name = hash.key?('product_name') ? hash['product_name'] : SKIP
  product_family_name =
    hash.key?('product_family_name') ? hash['product_family_name'] : SKIP
  role = hash.key?('role') ? hash['role'] : SKIP
  seller = InvoiceSeller.from_hash(hash['seller']) if hash['seller']
  customer = InvoiceCustomer.from_hash(hash['customer']) if hash['customer']
  memo = hash.key?('memo') ? hash['memo'] : SKIP
  billing_address = InvoiceAddress.from_hash(hash['billing_address']) if
    hash['billing_address']
  shipping_address = InvoiceAddress.from_hash(hash['shipping_address']) if
    hash['shipping_address']
  subtotal_amount =
    hash.key?('subtotal_amount') ? hash['subtotal_amount'] : SKIP
  discount_amount =
    hash.key?('discount_amount') ? hash['discount_amount'] : SKIP
  tax_amount = hash.key?('tax_amount') ? hash['tax_amount'] : SKIP
  total_amount = hash.key?('total_amount') ? hash['total_amount'] : SKIP
  credit_amount = hash.key?('credit_amount') ? hash['credit_amount'] : SKIP
  paid_amount = hash.key?('paid_amount') ? hash['paid_amount'] : SKIP
  refund_amount = hash.key?('refund_amount') ? hash['refund_amount'] : SKIP
  due_amount = hash.key?('due_amount') ? hash['due_amount'] : SKIP
  # Parameter is an array, so we need to iterate through it

  line_items = nil
  unless hash['line_items'].nil?
    line_items = []
    hash['line_items'].each do |structure|
      line_items << (InvoiceLineItem.from_hash(structure) if structure)
    end
  end

  line_items = SKIP unless hash.key?('line_items')
  # Parameter is an array, so we need to iterate through it

  discounts = nil
  unless hash['discounts'].nil?
    discounts = []
    hash['discounts'].each do |structure|
      discounts << (ProformaInvoiceDiscount.from_hash(structure) if structure)
    end
  end

  discounts = SKIP unless hash.key?('discounts')
  # Parameter is an array, so we need to iterate through it

  taxes = nil
  unless hash['taxes'].nil?
    taxes = []
    hash['taxes'].each do |structure|
      taxes << (ProformaInvoiceTax.from_hash(structure) if structure)
    end
  end

  taxes = SKIP unless hash.key?('taxes')
  # Parameter is an array, so we need to iterate through it

  credits = nil
  unless hash['credits'].nil?
    credits = []
    hash['credits'].each do |structure|
      credits << (ProformaInvoiceCredit.from_hash(structure) if structure)
    end
  end

  credits = SKIP unless hash.key?('credits')
  # Parameter is an array, so we need to iterate through it

  payments = nil
  unless hash['payments'].nil?
    payments = []
    hash['payments'].each do |structure|
      payments << (ProformaInvoicePayment.from_hash(structure) if structure)
    end
  end

  payments = SKIP unless hash.key?('payments')
  # Parameter is an array, so we need to iterate through it

  custom_fields = nil
  unless hash['custom_fields'].nil?
    custom_fields = []
    hash['custom_fields'].each do |structure|
      custom_fields << (ProformaCustomField.from_hash(structure) if structure)
    end
  end

  custom_fields = SKIP unless hash.key?('custom_fields')
  public_url = hash.key?('public_url') ? hash['public_url'] : SKIP

  # Create object from extracted values.

  ProformaInvoicePreview.new(uid,
                             site_id,
                             customer_id,
                             subscription_id,
                             number,
                             sequence_number,
                             created_at,
                             delivery_date,
                             status,
                             collection_method,
                             payment_instructions,
                             currency,
                             consolidation_level,
                             product_name,
                             product_family_name,
                             role,
                             seller,
                             customer,
                             memo,
                             billing_address,
                             shipping_address,
                             subtotal_amount,
                             discount_amount,
                             tax_amount,
                             total_amount,
                             credit_amount,
                             paid_amount,
                             refund_amount,
                             due_amount,
                             line_items,
                             discounts,
                             taxes,
                             credits,
                             payments,
                             custom_fields,
                             public_url)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 177

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['uid'] = 'uid'
  @_hash['site_id'] = 'site_id'
  @_hash['customer_id'] = 'customer_id'
  @_hash['subscription_id'] = 'subscription_id'
  @_hash['number'] = 'number'
  @_hash['sequence_number'] = 'sequence_number'
  @_hash['created_at'] = 'created_at'
  @_hash['delivery_date'] = 'delivery_date'
  @_hash['status'] = 'status'
  @_hash['collection_method'] = 'collection_method'
  @_hash['payment_instructions'] = 'payment_instructions'
  @_hash['currency'] = 'currency'
  @_hash['consolidation_level'] = 'consolidation_level'
  @_hash['product_name'] = 'product_name'
  @_hash['product_family_name'] = 'product_family_name'
  @_hash['role'] = 'role'
  @_hash['seller'] = 'seller'
  @_hash['customer'] = 'customer'
  @_hash['memo'] = 'memo'
  @_hash['billing_address'] = 'billing_address'
  @_hash['shipping_address'] = 'shipping_address'
  @_hash['subtotal_amount'] = 'subtotal_amount'
  @_hash['discount_amount'] = 'discount_amount'
  @_hash['tax_amount'] = 'tax_amount'
  @_hash['total_amount'] = 'total_amount'
  @_hash['credit_amount'] = 'credit_amount'
  @_hash['paid_amount'] = 'paid_amount'
  @_hash['refund_amount'] = 'refund_amount'
  @_hash['due_amount'] = 'due_amount'
  @_hash['line_items'] = 'line_items'
  @_hash['discounts'] = 'discounts'
  @_hash['taxes'] = 'taxes'
  @_hash['credits'] = 'credits'
  @_hash['payments'] = 'payments'
  @_hash['custom_fields'] = 'custom_fields'
  @_hash['public_url'] = 'public_url'
  @_hash
end

.nullablesObject

An array for nullable fields



261
262
263
# File 'lib/advanced_billing/models/proforma_invoice_preview.rb', line 261

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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/advanced_billing/models/proforma_invoice_preview.rb', line 219

def self.optionals
  %w[
    uid
    site_id
    customer_id
    subscription_id
    number
    sequence_number
    created_at
    delivery_date
    status
    collection_method
    payment_instructions
    currency
    consolidation_level
    product_name
    product_family_name
    role
    seller
    customer
    memo
    billing_address
    shipping_address
    subtotal_amount
    discount_amount
    tax_amount
    total_amount
    credit_amount
    paid_amount
    refund_amount
    due_amount
    line_items
    discounts
    taxes
    credits
    payments
    custom_fields
    public_url
  ]
end