Class: AdvancedBilling::PrepaymentAccountBalanceChanged
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::PrepaymentAccountBalanceChanged
- Defined in:
- lib/advanced_billing/models/prepayment_account_balance_changed.rb
Overview
PrepaymentAccountBalanceChanged Model.
Instance Attribute Summary collapse
-
#currency_code ⇒ String
TODO: Write general description for this method.
-
#prepayment_account_balance_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#prepayment_balance_change_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#reason ⇒ String
TODO: Write general description for this method.
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(reason:, prepayment_account_balance_in_cents:, prepayment_balance_change_in_cents:, currency_code:, additional_properties: {}) ⇒ PrepaymentAccountBalanceChanged
constructor
A new instance of PrepaymentAccountBalanceChanged.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(reason:, prepayment_account_balance_in_cents:, prepayment_balance_change_in_cents:, currency_code:, additional_properties: {}) ⇒ PrepaymentAccountBalanceChanged
Returns a new instance of PrepaymentAccountBalanceChanged.
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/advanced_billing/models/prepayment_account_balance_changed.rb', line 50 def initialize(reason:, prepayment_account_balance_in_cents:, prepayment_balance_change_in_cents:, currency_code:, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @reason = reason @prepayment_account_balance_in_cents = prepayment_account_balance_in_cents @prepayment_balance_change_in_cents = prepayment_balance_change_in_cents @currency_code = currency_code end |
Instance Attribute Details
#currency_code ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/prepayment_account_balance_changed.rb', line 26 def currency_code @currency_code end |
#prepayment_account_balance_in_cents ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/prepayment_account_balance_changed.rb', line 18 def prepayment_account_balance_in_cents @prepayment_account_balance_in_cents end |
#prepayment_balance_change_in_cents ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/prepayment_account_balance_changed.rb', line 22 def prepayment_balance_change_in_cents @prepayment_balance_change_in_cents end |
#reason ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/prepayment_account_balance_changed.rb', line 14 def reason @reason end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/advanced_billing/models/prepayment_account_balance_changed.rb', line 65 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. reason = hash.key?('reason') ? hash['reason'] : nil prepayment_account_balance_in_cents = hash.key?('prepayment_account_balance_in_cents') ? hash['prepayment_account_balance_in_cents'] : nil prepayment_balance_change_in_cents = hash.key?('prepayment_balance_change_in_cents') ? hash['prepayment_balance_change_in_cents'] : nil currency_code = hash.key?('currency_code') ? hash['currency_code'] : nil # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. PrepaymentAccountBalanceChanged.new(reason: reason, prepayment_account_balance_in_cents: prepayment_account_balance_in_cents, prepayment_balance_change_in_cents: prepayment_balance_change_in_cents, currency_code: currency_code, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/advanced_billing/models/prepayment_account_balance_changed.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['reason'] = 'reason' @_hash['prepayment_account_balance_in_cents'] = 'prepayment_account_balance_in_cents' @_hash['prepayment_balance_change_in_cents'] = 'prepayment_balance_change_in_cents' @_hash['currency_code'] = 'currency_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
46 47 48 |
# File 'lib/advanced_billing/models/prepayment_account_balance_changed.rb', line 46 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 |
# File 'lib/advanced_billing/models/prepayment_account_balance_changed.rb', line 41 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/advanced_billing/models/prepayment_account_balance_changed.rb', line 89 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.reason, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.prepayment_account_balance_in_cents, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.prepayment_balance_change_in_cents, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.currency_code, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['reason'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['prepayment_account_balance_in_cents'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['prepayment_balance_change_in_cents'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['currency_code'], ->(val) { val.instance_of? String }) ) end |