Class: AdvancedBilling::UpdatePrice
- Defined in:
- lib/advanced_billing/models/update_price.rb
Overview
UpdatePrice Model.
Instance Attribute Summary collapse
-
#destroy ⇒ String
TODO: Write general description for this method.
-
#ending_quantity ⇒ Integer
TODO: Write general description for this method.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#starting_quantity ⇒ Integer
TODO: Write general description for this method.
-
#unit_price ⇒ 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.
Instance Method Summary collapse
-
#initialize(id = SKIP, ending_quantity = SKIP, unit_price = SKIP, destroy = SKIP, starting_quantity = SKIP) ⇒ UpdatePrice
constructor
A new instance of UpdatePrice.
Methods inherited from BaseModel
Constructor Details
#initialize(id = SKIP, ending_quantity = SKIP, unit_price = SKIP, destroy = SKIP, starting_quantity = SKIP) ⇒ UpdatePrice
Returns a new instance of UpdatePrice.
59 60 61 62 63 64 65 66 |
# File 'lib/advanced_billing/models/update_price.rb', line 59 def initialize(id = SKIP, ending_quantity = SKIP, unit_price = SKIP, destroy = SKIP, starting_quantity = SKIP) @id = id unless id == SKIP @ending_quantity = ending_quantity unless ending_quantity == SKIP @unit_price = unit_price unless unit_price == SKIP @destroy = destroy unless destroy == SKIP @starting_quantity = starting_quantity unless starting_quantity == SKIP end |
Instance Attribute Details
#destroy ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/models/update_price.rb', line 26 def destroy @destroy end |
#ending_quantity ⇒ Integer
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/models/update_price.rb', line 18 def ending_quantity @ending_quantity end |
#id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/models/update_price.rb', line 14 def id @id end |
#starting_quantity ⇒ Integer
TODO: Write general description for this method
30 31 32 |
# File 'lib/advanced_billing/models/update_price.rb', line 30 def starting_quantity @starting_quantity end |
#unit_price ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/models/update_price.rb', line 22 def unit_price @unit_price end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/advanced_billing/models/update_price.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP ending_quantity = hash.key?('ending_quantity') ? hash['ending_quantity'] : SKIP unit_price = hash.key?('unit_price') ? hash['unit_price'] : SKIP destroy = hash.key?('_destroy') ? hash['_destroy'] : SKIP starting_quantity = hash.key?('starting_quantity') ? hash['starting_quantity'] : SKIP # Create object from extracted values. UpdatePrice.new(id, ending_quantity, unit_price, destroy, starting_quantity) 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/update_price.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['ending_quantity'] = 'ending_quantity' @_hash['unit_price'] = 'unit_price' @_hash['destroy'] = '_destroy' @_hash['starting_quantity'] = 'starting_quantity' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/advanced_billing/models/update_price.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/advanced_billing/models/update_price.rb', line 44 def self.optionals %w[ id ending_quantity unit_price destroy starting_quantity ] end |