Class: AdvancedBilling::PrepaidUsageAllocationDetail
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::PrepaidUsageAllocationDetail
- Defined in:
- lib/advanced_billing/models/prepaid_usage_allocation_detail.rb
Overview
PrepaidUsageAllocationDetail Model.
Instance Attribute Summary collapse
-
#allocation_id ⇒ Integer
TODO: Write general description for this method.
-
#charge_id ⇒ Integer
TODO: Write general description for this method.
-
#usage_quantity ⇒ 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(allocation_id: SKIP, charge_id: SKIP, usage_quantity: SKIP, additional_properties: {}) ⇒ PrepaidUsageAllocationDetail
constructor
A new instance of PrepaidUsageAllocationDetail.
Methods inherited from BaseModel
Constructor Details
#initialize(allocation_id: SKIP, charge_id: SKIP, usage_quantity: SKIP, additional_properties: {}) ⇒ PrepaidUsageAllocationDetail
Returns a new instance of PrepaidUsageAllocationDetail.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/advanced_billing/models/prepaid_usage_allocation_detail.rb', line 47 def initialize(allocation_id: SKIP, charge_id: SKIP, usage_quantity: SKIP, additional_properties: {}) @allocation_id = allocation_id unless allocation_id == SKIP @charge_id = charge_id unless charge_id == SKIP @usage_quantity = usage_quantity unless usage_quantity == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#allocation_id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/prepaid_usage_allocation_detail.rb', line 14 def allocation_id @allocation_id end |
#charge_id ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/prepaid_usage_allocation_detail.rb', line 18 def charge_id @charge_id end |
#usage_quantity ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/prepaid_usage_allocation_detail.rb', line 22 def usage_quantity @usage_quantity end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/advanced_billing/models/prepaid_usage_allocation_detail.rb', line 60 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. allocation_id = hash.key?('allocation_id') ? hash['allocation_id'] : SKIP charge_id = hash.key?('charge_id') ? hash['charge_id'] : SKIP usage_quantity = hash.key?('usage_quantity') ? hash['usage_quantity'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. PrepaidUsageAllocationDetail.new(allocation_id: allocation_id, charge_id: charge_id, usage_quantity: usage_quantity, additional_properties: hash) 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/prepaid_usage_allocation_detail.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['allocation_id'] = 'allocation_id' @_hash['charge_id'] = 'charge_id' @_hash['usage_quantity'] = 'usage_quantity' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/advanced_billing/models/prepaid_usage_allocation_detail.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 40 |
# File 'lib/advanced_billing/models/prepaid_usage_allocation_detail.rb', line 34 def self.optionals %w[ allocation_id charge_id usage_quantity ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
81 82 83 84 85 86 87 |
# File 'lib/advanced_billing/models/prepaid_usage_allocation_detail.rb', line 81 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |