Class: AdvancedBilling::CreateInvoicePaymentApplication
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreateInvoicePaymentApplication
- Defined in:
- lib/advanced_billing/models/create_invoice_payment_application.rb
Overview
CreateInvoicePaymentApplication Model.
Instance Attribute Summary collapse
-
#amount ⇒ String
Dollar amount of the invoice payment (eg. “10.50” => $10.50).
-
#invoice_uid ⇒ String
Unique identifier for the invoice.
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(invoice_uid:, amount:, additional_properties: {}) ⇒ CreateInvoicePaymentApplication
constructor
A new instance of CreateInvoicePaymentApplication.
Methods inherited from BaseModel
Constructor Details
#initialize(invoice_uid:, amount:, additional_properties: {}) ⇒ CreateInvoicePaymentApplication
Returns a new instance of CreateInvoicePaymentApplication.
39 40 41 42 43 44 45 46 47 |
# File 'lib/advanced_billing/models/create_invoice_payment_application.rb', line 39 def initialize(invoice_uid:, amount:, additional_properties: {}) @invoice_uid = invoice_uid @amount = amount # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#amount ⇒ String
Dollar amount of the invoice payment (eg. “10.50” => $10.50).
19 20 21 |
# File 'lib/advanced_billing/models/create_invoice_payment_application.rb', line 19 def amount @amount end |
#invoice_uid ⇒ String
Unique identifier for the invoice. It has the prefix “inv_” followed by alphanumeric characters.
15 16 17 |
# File 'lib/advanced_billing/models/create_invoice_payment_application.rb', line 15 def invoice_uid @invoice_uid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/advanced_billing/models/create_invoice_payment_application.rb', line 50 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. invoice_uid = hash.key?('invoice_uid') ? hash['invoice_uid'] : nil amount = hash.key?('amount') ? hash['amount'] : nil # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. CreateInvoicePaymentApplication.new(invoice_uid: invoice_uid, amount: amount, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
22 23 24 25 26 27 |
# File 'lib/advanced_billing/models/create_invoice_payment_application.rb', line 22 def self.names @_hash = {} if @_hash.nil? @_hash['invoice_uid'] = 'invoice_uid' @_hash['amount'] = 'amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
35 36 37 |
# File 'lib/advanced_billing/models/create_invoice_payment_application.rb', line 35 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
30 31 32 |
# File 'lib/advanced_billing/models/create_invoice_payment_application.rb', line 30 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/advanced_billing/models/create_invoice_payment_application.rb', line 68 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.invoice_uid, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.amount, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['invoice_uid'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['amount'], ->(val) { val.instance_of? String }) ) end |