Class: AdvancedBilling::CreateUsage
- Defined in:
- lib/advanced_billing/models/create_usage.rb
Overview
CreateUsage Model.
Instance Attribute Summary collapse
-
#memo ⇒ String
integer by default or decimal number if fractional quantities are enabled for the component.
-
#price_point_id ⇒ String
integer by default or decimal number if fractional quantities are enabled for the component.
-
#quantity ⇒ Float
integer by default or decimal number if fractional quantities are enabled for the component.
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.
Instance Method Summary collapse
-
#initialize(quantity = SKIP, price_point_id = SKIP, memo = SKIP) ⇒ CreateUsage
constructor
A new instance of CreateUsage.
Methods inherited from BaseModel
Constructor Details
#initialize(quantity = SKIP, price_point_id = SKIP, memo = SKIP) ⇒ CreateUsage
Returns a new instance of CreateUsage.
50 51 52 53 54 |
# File 'lib/advanced_billing/models/create_usage.rb', line 50 def initialize(quantity = SKIP, price_point_id = SKIP, memo = SKIP) @quantity = quantity unless quantity == SKIP @price_point_id = price_point_id unless price_point_id == SKIP @memo = memo unless memo == SKIP end |
Instance Attribute Details
#memo ⇒ String
integer by default or decimal number if fractional quantities are enabled for the component
25 26 27 |
# File 'lib/advanced_billing/models/create_usage.rb', line 25 def memo @memo end |
#price_point_id ⇒ String
integer by default or decimal number if fractional quantities are enabled for the component
20 21 22 |
# File 'lib/advanced_billing/models/create_usage.rb', line 20 def price_point_id @price_point_id end |
#quantity ⇒ Float
integer by default or decimal number if fractional quantities are enabled for the component
15 16 17 |
# File 'lib/advanced_billing/models/create_usage.rb', line 15 def quantity @quantity end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/advanced_billing/models/create_usage.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. quantity = hash.key?('quantity') ? hash['quantity'] : SKIP price_point_id = hash.key?('price_point_id') ? hash['price_point_id'] : SKIP memo = hash.key?('memo') ? hash['memo'] : SKIP # Create object from extracted values. CreateUsage.new(quantity, price_point_id, memo) end |
.names ⇒ Object
A mapping from model property names to API property names.
28 29 30 31 32 33 34 |
# File 'lib/advanced_billing/models/create_usage.rb', line 28 def self.names @_hash = {} if @_hash.nil? @_hash['quantity'] = 'quantity' @_hash['price_point_id'] = 'price_point_id' @_hash['memo'] = 'memo' @_hash end |
.nullables ⇒ Object
An array for nullable fields
46 47 48 |
# File 'lib/advanced_billing/models/create_usage.rb', line 46 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
37 38 39 40 41 42 43 |
# File 'lib/advanced_billing/models/create_usage.rb', line 37 def self.optionals %w[ quantity price_point_id memo ] end |