Class: AdvancedBilling::AccountBalance
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::AccountBalance
- Defined in:
- lib/advanced_billing/models/account_balance.rb
Overview
AccountBalance Model.
Instance Attribute Summary collapse
-
#automatic_balance_in_cents ⇒ Integer
The automatic balance in cents.
-
#balance_in_cents ⇒ Integer
The balance in cents.
-
#remittance_balance_in_cents ⇒ Integer
The remittance balance in cents.
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(balance_in_cents: SKIP, automatic_balance_in_cents: SKIP, remittance_balance_in_cents: SKIP, additional_properties: {}) ⇒ AccountBalance
constructor
A new instance of AccountBalance.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(balance_in_cents: SKIP, automatic_balance_in_cents: SKIP, remittance_balance_in_cents: SKIP, additional_properties: {}) ⇒ AccountBalance
Returns a new instance of AccountBalance.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/advanced_billing/models/account_balance.rb', line 50 def initialize(balance_in_cents: SKIP, automatic_balance_in_cents: SKIP, remittance_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 @balance_in_cents = balance_in_cents unless balance_in_cents == SKIP unless automatic_balance_in_cents == SKIP @automatic_balance_in_cents = automatic_balance_in_cents end unless remittance_balance_in_cents == SKIP @remittance_balance_in_cents = remittance_balance_in_cents end end |
Instance Attribute Details
#automatic_balance_in_cents ⇒ Integer
The automatic balance in cents.
18 19 20 |
# File 'lib/advanced_billing/models/account_balance.rb', line 18 def automatic_balance_in_cents @automatic_balance_in_cents end |
#balance_in_cents ⇒ Integer
The balance in cents.
14 15 16 |
# File 'lib/advanced_billing/models/account_balance.rb', line 14 def balance_in_cents @balance_in_cents end |
#remittance_balance_in_cents ⇒ Integer
The remittance balance in cents.
22 23 24 |
# File 'lib/advanced_billing/models/account_balance.rb', line 22 def remittance_balance_in_cents @remittance_balance_in_cents end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/advanced_billing/models/account_balance.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. balance_in_cents = hash.key?('balance_in_cents') ? hash['balance_in_cents'] : SKIP automatic_balance_in_cents = hash.key?('automatic_balance_in_cents') ? hash['automatic_balance_in_cents'] : SKIP remittance_balance_in_cents = hash.key?('remittance_balance_in_cents') ? hash['remittance_balance_in_cents'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. AccountBalance.new(balance_in_cents: balance_in_cents, automatic_balance_in_cents: automatic_balance_in_cents, remittance_balance_in_cents: remittance_balance_in_cents, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/advanced_billing/models/account_balance.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['balance_in_cents'] = 'balance_in_cents' @_hash['automatic_balance_in_cents'] = 'automatic_balance_in_cents' @_hash['remittance_balance_in_cents'] = 'remittance_balance_in_cents' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 46 47 48 |
# File 'lib/advanced_billing/models/account_balance.rb', line 43 def self.nullables %w[ automatic_balance_in_cents remittance_balance_in_cents ] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 40 |
# File 'lib/advanced_billing/models/account_balance.rb', line 34 def self.optionals %w[ balance_in_cents automatic_balance_in_cents remittance_balance_in_cents ] end |