Class: AdvancedBilling::PrepaidSubscriptionBalanceChanged
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::PrepaidSubscriptionBalanceChanged
- Defined in:
- lib/advanced_billing/models/prepaid_subscription_balance_changed.rb
Overview
PrepaidSubscriptionBalanceChanged Model.
Instance Attribute Summary collapse
-
#current_account_balance_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#current_usage_amount_in_cents ⇒ Integer
TODO: Write general description for this method.
-
#prepayment_account_balance_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:, current_account_balance_in_cents:, prepayment_account_balance_in_cents:, current_usage_amount_in_cents:, additional_properties: {}) ⇒ PrepaidSubscriptionBalanceChanged
constructor
A new instance of PrepaidSubscriptionBalanceChanged.
Methods inherited from BaseModel
Constructor Details
#initialize(reason:, current_account_balance_in_cents:, prepayment_account_balance_in_cents:, current_usage_amount_in_cents:, additional_properties: {}) ⇒ PrepaidSubscriptionBalanceChanged
Returns a new instance of PrepaidSubscriptionBalanceChanged.
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/advanced_billing/models/prepaid_subscription_balance_changed.rb', line 51 def initialize(reason:, current_account_balance_in_cents:, prepayment_account_balance_in_cents:, current_usage_amount_in_cents:, additional_properties: {}) @reason = reason @current_account_balance_in_cents = current_account_balance_in_cents @prepayment_account_balance_in_cents = prepayment_account_balance_in_cents @current_usage_amount_in_cents = current_usage_amount_in_cents # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#current_account_balance_in_cents ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/prepaid_subscription_balance_changed.rb', line 18 def current_account_balance_in_cents @current_account_balance_in_cents end |
#current_usage_amount_in_cents ⇒ Integer
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/prepaid_subscription_balance_changed.rb', line 26 def current_usage_amount_in_cents @current_usage_amount_in_cents end |
#prepayment_account_balance_in_cents ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/prepaid_subscription_balance_changed.rb', line 22 def prepayment_account_balance_in_cents @prepayment_account_balance_in_cents end |
#reason ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/prepaid_subscription_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.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/advanced_billing/models/prepaid_subscription_balance_changed.rb', line 66 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. reason = hash.key?('reason') ? hash['reason'] : nil current_account_balance_in_cents = hash.key?('current_account_balance_in_cents') ? hash['current_account_balance_in_cents'] : nil prepayment_account_balance_in_cents = hash.key?('prepayment_account_balance_in_cents') ? hash['prepayment_account_balance_in_cents'] : nil current_usage_amount_in_cents = hash.key?('current_usage_amount_in_cents') ? hash['current_usage_amount_in_cents'] : nil # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. PrepaidSubscriptionBalanceChanged.new(reason: reason, current_account_balance_in_cents: current_account_balance_in_cents, prepayment_account_balance_in_cents: prepayment_account_balance_in_cents, current_usage_amount_in_cents: current_usage_amount_in_cents, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/advanced_billing/models/prepaid_subscription_balance_changed.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['reason'] = 'reason' @_hash['current_account_balance_in_cents'] = 'current_account_balance_in_cents' @_hash['prepayment_account_balance_in_cents'] = 'prepayment_account_balance_in_cents' @_hash['current_usage_amount_in_cents'] = 'current_usage_amount_in_cents' @_hash end |
.nullables ⇒ Object
An array for nullable fields
47 48 49 |
# File 'lib/advanced_billing/models/prepaid_subscription_balance_changed.rb', line 47 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
42 43 44 |
# File 'lib/advanced_billing/models/prepaid_subscription_balance_changed.rb', line 42 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
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 116 117 |
# File 'lib/advanced_billing/models/prepaid_subscription_balance_changed.rb', line 91 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.current_account_balance_in_cents, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.prepayment_account_balance_in_cents, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.current_usage_amount_in_cents, ->(val) { val.instance_of? Integer }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['reason'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['current_account_balance_in_cents'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['prepayment_account_balance_in_cents'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['current_usage_amount_in_cents'], ->(val) { val.instance_of? Integer }) ) end |