Class: AdvancedBilling::CreditAccountBalanceChanged
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreditAccountBalanceChanged
- Defined in:
- lib/advanced_billing/models/credit_account_balance_changed.rb
Overview
CreditAccountBalanceChanged Model.
Instance Attribute Summary collapse
-
#at_time ⇒ DateTime
TODO: Write general description for this method.
-
#currency_code ⇒ String
TODO: Write general description for this method.
-
#reason ⇒ String
TODO: Write general description for this method.
-
#service_credit_account_balance_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#service_credit_balance_change_in_cents ⇒ Integer
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:, service_credit_account_balance_in_cents:, service_credit_balance_change_in_cents:, currency_code:, at_time:, additional_properties: {}) ⇒ CreditAccountBalanceChanged
constructor
A new instance of CreditAccountBalanceChanged.
- #to_custom_at_time ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(reason:, service_credit_account_balance_in_cents:, service_credit_balance_change_in_cents:, currency_code:, at_time:, additional_properties: {}) ⇒ CreditAccountBalanceChanged
Returns a new instance of CreditAccountBalanceChanged.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 56 def initialize(reason:, service_credit_account_balance_in_cents:, service_credit_balance_change_in_cents:, currency_code:, at_time:, additional_properties: {}) @reason = reason @service_credit_account_balance_in_cents = service_credit_account_balance_in_cents @service_credit_balance_change_in_cents = service_credit_balance_change_in_cents @currency_code = currency_code @at_time = at_time # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#at_time ⇒ DateTime
TODO: Write general description for this method
31 32 33 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 31 def at_time @at_time end |
#currency_code ⇒ String
TODO: Write general description for this method
27 28 29 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 27 def currency_code @currency_code end |
#reason ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 15 def reason @reason end |
#service_credit_account_balance_in_cents ⇒ Integer
TODO: Write general description for this method
19 20 21 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 19 def service_credit_account_balance_in_cents @service_credit_account_balance_in_cents end |
#service_credit_balance_change_in_cents ⇒ Integer
TODO: Write general description for this method
23 24 25 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 23 def service_credit_balance_change_in_cents @service_credit_balance_change_in_cents end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 72 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. reason = hash.key?('reason') ? hash['reason'] : nil service_credit_account_balance_in_cents = hash.key?('service_credit_account_balance_in_cents') ? hash['service_credit_account_balance_in_cents'] : nil service_credit_balance_change_in_cents = hash.key?('service_credit_balance_change_in_cents') ? hash['service_credit_balance_change_in_cents'] : nil currency_code = hash.key?('currency_code') ? hash['currency_code'] : nil at_time = if hash.key?('at_time') (DateTimeHelper.from_rfc3339(hash['at_time']) if hash['at_time']) end # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. CreditAccountBalanceChanged.new(reason: reason, service_credit_account_balance_in_cents: service_credit_account_balance_in_cents, service_credit_balance_change_in_cents: service_credit_balance_change_in_cents, currency_code: currency_code, at_time: at_time, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['reason'] = 'reason' @_hash['service_credit_account_balance_in_cents'] = 'service_credit_account_balance_in_cents' @_hash['service_credit_balance_change_in_cents'] = 'service_credit_balance_change_in_cents' @_hash['currency_code'] = 'currency_code' @_hash['at_time'] = 'at_time' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 52 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
47 48 49 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 47 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 104 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.service_credit_account_balance_in_cents, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.service_credit_balance_change_in_cents, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.currency_code, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.at_time, ->(val) { val.instance_of? DateTime }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['reason'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['service_credit_account_balance_in_cents'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['service_credit_balance_change_in_cents'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['currency_code'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['at_time'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#to_custom_at_time ⇒ Object
98 99 100 |
# File 'lib/advanced_billing/models/credit_account_balance_changed.rb', line 98 def to_custom_at_time DateTimeHelper.to_rfc3339(at_time) end |