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.
-
#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_discounts = SKIP, service_credits = SKIP, prepayments = SKIP) ⇒ AccountBalances
constructor
A new instance of AccountBalances.
Methods inherited from BaseModel
Constructor Details
#initialize(open_invoices = SKIP, pending_discounts = SKIP, service_credits = SKIP, prepayments = SKIP) ⇒ AccountBalances
Returns a new instance of AccountBalances.
54 55 56 57 58 59 60 |
# File 'lib/advanced_billing/models/account_balances.rb', line 54 def initialize(open_invoices = SKIP, pending_discounts = SKIP, service_credits = SKIP, prepayments = SKIP) @open_invoices = open_invoices unless open_invoices == SKIP @pending_discounts = pending_discounts unless pending_discounts == SKIP @service_credits = service_credits unless service_credits == SKIP @prepayments = prepayments unless prepayments == SKIP 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.
19 20 21 |
# File 'lib/advanced_billing/models/account_balances.rb', line 19 def pending_discounts @pending_discounts end |
#prepayments ⇒ AccountBalance
The balance, in cents, of the subscription’s Prepayment account.
27 28 29 |
# File 'lib/advanced_billing/models/account_balances.rb', line 27 def prepayments @prepayments end |
#service_credits ⇒ AccountBalance
The balance, in cents, of the subscription’s Service Credit account.
23 24 25 |
# File 'lib/advanced_billing/models/account_balances.rb', line 23 def service_credits @service_credits end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/advanced_billing/models/account_balances.rb', line 63 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_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'] # Create object from extracted values. AccountBalances.new(open_invoices, pending_discounts, service_credits, prepayments) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 |
# File 'lib/advanced_billing/models/account_balances.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['open_invoices'] = 'open_invoices' @_hash['pending_discounts'] = 'pending_discounts' @_hash['service_credits'] = 'service_credits' @_hash['prepayments'] = 'prepayments' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/advanced_billing/models/account_balances.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 46 47 |
# File 'lib/advanced_billing/models/account_balances.rb', line 40 def self.optionals %w[ open_invoices pending_discounts service_credits prepayments ] end |