Class: AdvancedBilling::AccountBalances
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::AccountBalances
- Defined in:
- lib/advanced_billing/models/account_balances.rb
Overview
AccountBalances Model.
Instance Attribute Summary collapse
-
#open_invoices ⇒ AccountBalance
The balance, in cents, of the sum of the subscription’s open, payable invoices.
-
#pending_discounts ⇒ AccountBalance
The balance, in cents, of the subscription’s Pending Discount account.
-
#pending_invoices ⇒ AccountBalance
The balance, in cents, of the sum of the subscription’s pending, payable invoices.
-
#prepayments ⇒ AccountBalance
The balance, in cents, of the subscription’s Prepayment account.
-
#service_credits ⇒ AccountBalance
The balance, in cents, of the subscription’s Service Credit 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(open_invoices: SKIP, pending_invoices: SKIP, pending_discounts: SKIP, service_credits: SKIP, prepayments: SKIP, additional_properties: {}) ⇒ AccountBalances
constructor
A new instance of AccountBalances.
Methods inherited from BaseModel
Constructor Details
#initialize(open_invoices: SKIP, pending_invoices: SKIP, pending_discounts: SKIP, service_credits: SKIP, prepayments: SKIP, additional_properties: {}) ⇒ AccountBalances
Returns a new instance of AccountBalances.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/advanced_billing/models/account_balances.rb', line 61 def initialize(open_invoices: SKIP, pending_invoices: SKIP, pending_discounts: SKIP, service_credits: SKIP, prepayments: SKIP, additional_properties: {}) @open_invoices = open_invoices unless open_invoices == SKIP @pending_invoices = pending_invoices unless pending_invoices == SKIP @pending_discounts = pending_discounts unless pending_discounts == SKIP @service_credits = service_credits unless service_credits == SKIP @prepayments = prepayments unless prepayments == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#open_invoices ⇒ AccountBalance
The balance, in cents, of the sum of the subscription’s open, payable invoices.
15 16 17 |
# File 'lib/advanced_billing/models/account_balances.rb', line 15 def open_invoices @open_invoices end |
#pending_discounts ⇒ AccountBalance
The balance, in cents, of the subscription’s Pending Discount account.
24 25 26 |
# File 'lib/advanced_billing/models/account_balances.rb', line 24 def pending_discounts @pending_discounts end |
#pending_invoices ⇒ AccountBalance
The balance, in cents, of the sum of the subscription’s pending, payable invoices.
20 21 22 |
# File 'lib/advanced_billing/models/account_balances.rb', line 20 def pending_invoices @pending_invoices end |
#prepayments ⇒ AccountBalance
The balance, in cents, of the subscription’s Prepayment account.
32 33 34 |
# File 'lib/advanced_billing/models/account_balances.rb', line 32 def prepayments @prepayments end |
#service_credits ⇒ AccountBalance
The balance, in cents, of the subscription’s Service Credit account.
28 29 30 |
# File 'lib/advanced_billing/models/account_balances.rb', line 28 def service_credits @service_credits end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/advanced_billing/models/account_balances.rb', line 77 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. open_invoices = AccountBalance.from_hash(hash['open_invoices']) if hash['open_invoices'] pending_invoices = AccountBalance.from_hash(hash['pending_invoices']) if hash['pending_invoices'] pending_discounts = AccountBalance.from_hash(hash['pending_discounts']) if hash['pending_discounts'] service_credits = AccountBalance.from_hash(hash['service_credits']) if hash['service_credits'] prepayments = AccountBalance.from_hash(hash['prepayments']) if hash['prepayments'] # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. AccountBalances.new(open_invoices: open_invoices, pending_invoices: pending_invoices, pending_discounts: pending_discounts, service_credits: service_credits, prepayments: prepayments, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 43 |
# File 'lib/advanced_billing/models/account_balances.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['open_invoices'] = 'open_invoices' @_hash['pending_invoices'] = 'pending_invoices' @_hash['pending_discounts'] = 'pending_discounts' @_hash['service_credits'] = 'service_credits' @_hash['prepayments'] = 'prepayments' @_hash end |
.nullables ⇒ Object
An array for nullable fields
57 58 59 |
# File 'lib/advanced_billing/models/account_balances.rb', line 57 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 52 53 54 |
# File 'lib/advanced_billing/models/account_balances.rb', line 46 def self.optionals %w[ open_invoices pending_invoices pending_discounts service_credits prepayments ] end |