Class: AdvancedBilling::ComponentCostDataRateTier
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::ComponentCostDataRateTier
- Defined in:
- lib/advanced_billing/models/component_cost_data_rate_tier.rb
Overview
ComponentCostDataRateTier Model.
Instance Attribute Summary collapse
-
#amount ⇒ String
TODO: Write general description for this method.
-
#ending_quantity ⇒ Integer
TODO: Write general description for this method.
-
#quantity ⇒ String
TODO: Write general description for this method.
-
#starting_quantity ⇒ Integer
TODO: Write general description for this method.
-
#unit_price ⇒ 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(starting_quantity: SKIP, ending_quantity: SKIP, quantity: SKIP, unit_price: SKIP, amount: SKIP, additional_properties: {}) ⇒ ComponentCostDataRateTier
constructor
A new instance of ComponentCostDataRateTier.
Methods inherited from BaseModel
Constructor Details
#initialize(starting_quantity: SKIP, ending_quantity: SKIP, quantity: SKIP, unit_price: SKIP, amount: SKIP, additional_properties: {}) ⇒ ComponentCostDataRateTier
Returns a new instance of ComponentCostDataRateTier.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/advanced_billing/models/component_cost_data_rate_tier.rb', line 61 def initialize(starting_quantity: SKIP, ending_quantity: SKIP, quantity: SKIP, unit_price: SKIP, amount: SKIP, additional_properties: {}) @starting_quantity = starting_quantity unless starting_quantity == SKIP @ending_quantity = ending_quantity unless ending_quantity == SKIP @quantity = quantity unless quantity == SKIP @unit_price = unit_price unless unit_price == SKIP @amount = amount unless amount == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#amount ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/component_cost_data_rate_tier.rb', line 30 def amount @amount end |
#ending_quantity ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/component_cost_data_rate_tier.rb', line 18 def ending_quantity @ending_quantity end |
#quantity ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/component_cost_data_rate_tier.rb', line 22 def quantity @quantity end |
#starting_quantity ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/component_cost_data_rate_tier.rb', line 14 def starting_quantity @starting_quantity end |
#unit_price ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/component_cost_data_rate_tier.rb', line 26 def unit_price @unit_price end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/advanced_billing/models/component_cost_data_rate_tier.rb', line 77 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. starting_quantity = hash.key?('starting_quantity') ? hash['starting_quantity'] : SKIP ending_quantity = hash.key?('ending_quantity') ? hash['ending_quantity'] : SKIP quantity = hash.key?('quantity') ? hash['quantity'] : SKIP unit_price = hash.key?('unit_price') ? hash['unit_price'] : SKIP amount = hash.key?('amount') ? hash['amount'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. ComponentCostDataRateTier.new(starting_quantity: starting_quantity, ending_quantity: ending_quantity, quantity: quantity, unit_price: unit_price, amount: amount, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/advanced_billing/models/component_cost_data_rate_tier.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['starting_quantity'] = 'starting_quantity' @_hash['ending_quantity'] = 'ending_quantity' @_hash['quantity'] = 'quantity' @_hash['unit_price'] = 'unit_price' @_hash['amount'] = 'amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 58 59 |
# File 'lib/advanced_billing/models/component_cost_data_rate_tier.rb', line 55 def self.nullables %w[ ending_quantity ] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/advanced_billing/models/component_cost_data_rate_tier.rb', line 44 def self.optionals %w[ starting_quantity ending_quantity quantity unit_price amount ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
103 104 105 106 107 108 109 |
# File 'lib/advanced_billing/models/component_cost_data_rate_tier.rb', line 103 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |