Class: AdvancedBilling::CreateMultiInvoicePayment
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreateMultiInvoicePayment
- Defined in:
- lib/advanced_billing/models/create_multi_invoice_payment.rb
Overview
CreateMultiInvoicePayment Model.
Instance Attribute Summary collapse
-
#amount ⇒ Object
Dollar amount of the sum of the invoices payment (eg. “10.50” => $10.50).
-
#applications ⇒ Array[CreateInvoicePaymentApplication]
Date reflecting when the payment was received from a customer.
-
#details ⇒ String
Additional information related to the payment method (eg. Check #).
-
#memo ⇒ String
A description to be attached to the payment.
-
#method ⇒ InvoicePaymentMethodType
The type of payment method used.
-
#received_on ⇒ String
Date reflecting when the payment was received from a customer.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(amount:, applications:, memo: SKIP, details: SKIP, method: SKIP, received_on: SKIP, additional_properties: {}) ⇒ CreateMultiInvoicePayment
constructor
A new instance of CreateMultiInvoicePayment.
Methods inherited from BaseModel
Constructor Details
#initialize(amount:, applications:, memo: SKIP, details: SKIP, method: SKIP, received_on: SKIP, additional_properties: {}) ⇒ CreateMultiInvoicePayment
Returns a new instance of CreateMultiInvoicePayment.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 65 def initialize(amount:, applications:, memo: SKIP, details: SKIP, method: SKIP, received_on: SKIP, additional_properties: {}) @memo = memo unless memo == SKIP @details = details unless details == SKIP @method = method unless method == SKIP @amount = amount @received_on = received_on unless received_on == SKIP @applications = applications # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#amount ⇒ Object
Dollar amount of the sum of the invoices payment (eg. “10.50” => $10.50).
26 27 28 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 26 def amount @amount end |
#applications ⇒ Array[CreateInvoicePaymentApplication]
Date reflecting when the payment was received from a customer. Must be in the past.
36 37 38 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 36 def applications @applications end |
#details ⇒ String
Additional information related to the payment method (eg. Check #).
18 19 20 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 18 def details @details end |
#memo ⇒ String
A description to be attached to the payment.
14 15 16 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 14 def memo @memo end |
#method ⇒ InvoicePaymentMethodType
The type of payment method used. Defaults to other.
22 23 24 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 22 def method @method end |
#received_on ⇒ String
Date reflecting when the payment was received from a customer. Must be in the past.
31 32 33 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 31 def received_on @received_on end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. amount = hash.key?('amount') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreateMultiInvoicePaymentAmount), hash['amount'] ) : nil # Parameter is an array, so we need to iterate through it applications = nil unless hash['applications'].nil? applications = [] hash['applications'].each do |structure| applications << (CreateInvoicePaymentApplication.from_hash(structure) if structure) end end applications = nil unless hash.key?('applications') memo = hash.key?('memo') ? hash['memo'] : SKIP details = hash.key?('details') ? hash['details'] : SKIP method = hash.key?('method') ? hash['method'] : SKIP received_on = hash.key?('received_on') ? hash['received_on'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. CreateMultiInvoicePayment.new(amount: amount, applications: applications, memo: memo, details: details, method: method, received_on: received_on, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['memo'] = 'memo' @_hash['details'] = 'details' @_hash['method'] = 'method' @_hash['amount'] = 'amount' @_hash['received_on'] = 'received_on' @_hash['applications'] = 'applications' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 54 55 56 57 58 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 51 def self.optionals %w[ memo details method received_on ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/advanced_billing/models/create_multi_invoice_payment.rb', line 118 def self.validate(value) if value.instance_of? self return ( UnionTypeLookUp.get(:CreateMultiInvoicePaymentAmount) .validate(value.amount) and APIHelper.valid_type?(value.applications, ->(val) { CreateInvoicePaymentApplication.validate(val) }, is_model_hash: true, is_inner_model_hash: true) ) end return false unless value.instance_of? Hash ( UnionTypeLookUp.get(:CreateMultiInvoicePaymentAmount) .validate(value['amount']) and APIHelper.valid_type?(value['applications'], ->(val) { CreateInvoicePaymentApplication.validate(val) }, is_model_hash: true, is_inner_model_hash: true) ) end |