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.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #get_additional_properties, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
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: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @allocation_id = allocation_id unless allocation_id == SKIP @charge_id = charge_id unless charge_id == SKIP @usage_quantity = usage_quantity unless usage_quantity == SKIP 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. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. PrepaidUsageAllocationDetail.new(allocation_id: allocation_id, charge_id: charge_id, usage_quantity: usage_quantity, 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/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 |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
97 98 99 100 101 102 |
# File 'lib/advanced_billing/models/prepaid_usage_allocation_detail.rb', line 97 def inspect class_name = self.class.name.split('::').last "<#{class_name} allocation_id: #{@allocation_id.inspect}, charge_id: #{@charge_id.inspect},"\ " usage_quantity: #{@usage_quantity.inspect}, additional_properties:"\ " #{get_additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
90 91 92 93 94 |
# File 'lib/advanced_billing/models/prepaid_usage_allocation_detail.rb', line 90 def to_s class_name = self.class.name.split('::').last "<#{class_name} allocation_id: #{@allocation_id}, charge_id: #{@charge_id}, usage_quantity:"\ " #{@usage_quantity}, additional_properties: #{get_additional_properties}>" end |