Class: AdvancedBilling::MultiInvoicePayment

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

Overview

MultiInvoicePayment Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(transaction_id: SKIP, total_amount: SKIP, currency_code: SKIP, applications: SKIP, additional_properties: {}) ⇒ MultiInvoicePayment

Returns a new instance of MultiInvoicePayment.



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/advanced_billing/models/multi_invoice_payment.rb', line 55

def initialize(transaction_id: SKIP, total_amount: SKIP,
               currency_code: SKIP, applications: SKIP,
               additional_properties: {})
  @transaction_id = transaction_id unless transaction_id == SKIP
  @total_amount = total_amount unless total_amount == SKIP
  @currency_code = currency_code unless currency_code == SKIP
  @applications = applications unless applications == SKIP

  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end
end

Instance Attribute Details

#applicationsArray[InvoicePaymentApplication]

The ISO 4217 currency code (3 character string) representing the currency of invoice transaction.

Returns:



28
29
30
# File 'lib/advanced_billing/models/multi_invoice_payment.rb', line 28

def applications
  @applications
end

#currency_codeString

The ISO 4217 currency code (3 character string) representing the currency of invoice transaction.

Returns:

  • (String)


23
24
25
# File 'lib/advanced_billing/models/multi_invoice_payment.rb', line 23

def currency_code
  @currency_code
end

#total_amountString

Dollar amount of the sum of the paid invoices.

Returns:

  • (String)


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

def total_amount
  @total_amount
end

#transaction_idInteger

The numeric ID of the transaction.

Returns:

  • (Integer)


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

def transaction_id
  @transaction_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



70
71
72
73
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
# File 'lib/advanced_billing/models/multi_invoice_payment.rb', line 70

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_id'] : SKIP
  total_amount = hash.key?('total_amount') ? hash['total_amount'] : SKIP
  currency_code = hash.key?('currency_code') ? hash['currency_code'] : SKIP
  # Parameter is an array, so we need to iterate through it
  applications = nil
  unless hash['applications'].nil?
    applications = []
    hash['applications'].each do |structure|
      applications << (InvoicePaymentApplication.from_hash(structure) if structure)
    end
  end

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

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.
  MultiInvoicePayment.new(transaction_id: transaction_id,
                          total_amount: total_amount,
                          currency_code: currency_code,
                          applications: applications,
                          additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/advanced_billing/models/multi_invoice_payment.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['transaction_id'] = 'transaction_id'
  @_hash['total_amount'] = 'total_amount'
  @_hash['currency_code'] = 'currency_code'
  @_hash['applications'] = 'applications'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/advanced_billing/models/multi_invoice_payment.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
47
48
# File 'lib/advanced_billing/models/multi_invoice_payment.rb', line 41

def self.optionals
  %w[
    transaction_id
    total_amount
    currency_code
    applications
  ]
end