Class: AdvancedBilling::InvoicePrePayment
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::InvoicePrePayment
- Defined in:
- lib/advanced_billing/models/invoice_pre_payment.rb
Overview
InvoicePrePayment Model.
Instance Attribute Summary collapse
-
#amount_in_cents ⇒ Integer
The amount in cents of the prepayment that was created as a result of this payment.
-
#ending_balance_in_cents ⇒ Integer
The total balance of the prepayment account for this subscription including any prior prepayments.
-
#subscription_id ⇒ Integer
The subscription id for the prepayment account.
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.
Instance Method Summary collapse
-
#initialize(subscription_id: SKIP, amount_in_cents: SKIP, ending_balance_in_cents: SKIP, additional_properties: {}) ⇒ InvoicePrePayment
constructor
A new instance of InvoicePrePayment.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(subscription_id: SKIP, amount_in_cents: SKIP, ending_balance_in_cents: SKIP, additional_properties: {}) ⇒ InvoicePrePayment
Returns a new instance of InvoicePrePayment.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/advanced_billing/models/invoice_pre_payment.rb', line 49 def initialize(subscription_id: SKIP, amount_in_cents: SKIP, ending_balance_in_cents: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @subscription_id = subscription_id unless subscription_id == SKIP @amount_in_cents = amount_in_cents unless amount_in_cents == SKIP @ending_balance_in_cents = ending_balance_in_cents unless ending_balance_in_cents == SKIP end |
Instance Attribute Details
#amount_in_cents ⇒ Integer
The amount in cents of the prepayment that was created as a result of this payment.
19 20 21 |
# File 'lib/advanced_billing/models/invoice_pre_payment.rb', line 19 def amount_in_cents @amount_in_cents end |
#ending_balance_in_cents ⇒ Integer
The total balance of the prepayment account for this subscription including any prior prepayments
24 25 26 |
# File 'lib/advanced_billing/models/invoice_pre_payment.rb', line 24 def ending_balance_in_cents @ending_balance_in_cents end |
#subscription_id ⇒ Integer
The subscription id for the prepayment account
14 15 16 |
# File 'lib/advanced_billing/models/invoice_pre_payment.rb', line 14 def subscription_id @subscription_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/advanced_billing/models/invoice_pre_payment.rb', line 62 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. subscription_id = hash.key?('subscription_id') ? hash['subscription_id'] : SKIP amount_in_cents = hash.key?('amount_in_cents') ? hash['amount_in_cents'] : SKIP ending_balance_in_cents = hash.key?('ending_balance_in_cents') ? hash['ending_balance_in_cents'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. InvoicePrePayment.new(subscription_id: subscription_id, amount_in_cents: amount_in_cents, ending_balance_in_cents: ending_balance_in_cents, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 33 |
# File 'lib/advanced_billing/models/invoice_pre_payment.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['subscription_id'] = 'subscription_id' @_hash['amount_in_cents'] = 'amount_in_cents' @_hash['ending_balance_in_cents'] = 'ending_balance_in_cents' @_hash end |
.nullables ⇒ Object
An array for nullable fields
45 46 47 |
# File 'lib/advanced_billing/models/invoice_pre_payment.rb', line 45 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
36 37 38 39 40 41 42 |
# File 'lib/advanced_billing/models/invoice_pre_payment.rb', line 36 def self.optionals %w[ subscription_id amount_in_cents ending_balance_in_cents ] end |