Class: SwaggerPetstore::Order
- Defined in:
- lib/swagger_petstore/models/order.rb
Overview
Order Model.
Instance Attribute Summary collapse
-
#complete ⇒ TrueClass | FalseClass
TODO: Write general description for this method.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#pet_id ⇒ Integer
TODO: Write general description for this method.
-
#quantity ⇒ Integer
TODO: Write general description for this method.
-
#ship_date ⇒ DateTime
TODO: Write general description for this method.
-
#status ⇒ Status1Enum
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, pet_id = SKIP, quantity = SKIP, ship_date = SKIP, status = SKIP, complete = SKIP) ⇒ Order
constructor
A new instance of Order.
- #to_custom_ship_date ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(id = SKIP, pet_id = SKIP, quantity = SKIP, ship_date = SKIP, status = SKIP, complete = SKIP) ⇒ Order
Returns a new instance of Order.
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/swagger_petstore/models/order.rb', line 66 def initialize(id = SKIP, pet_id = SKIP, quantity = SKIP, ship_date = SKIP, status = SKIP, complete = SKIP) @id = id unless id == SKIP @pet_id = pet_id unless pet_id == SKIP @quantity = quantity unless quantity == SKIP @ship_date = ship_date unless ship_date == SKIP @status = status unless status == SKIP @complete = complete unless complete == SKIP end |
Instance Attribute Details
#complete ⇒ TrueClass | FalseClass
TODO: Write general description for this method
35 36 37 |
# File 'lib/swagger_petstore/models/order.rb', line 35 def complete @complete end |
#id ⇒ Integer
TODO: Write general description for this method
15 16 17 |
# File 'lib/swagger_petstore/models/order.rb', line 15 def id @id end |
#pet_id ⇒ Integer
TODO: Write general description for this method
19 20 21 |
# File 'lib/swagger_petstore/models/order.rb', line 19 def pet_id @pet_id end |
#quantity ⇒ Integer
TODO: Write general description for this method
23 24 25 |
# File 'lib/swagger_petstore/models/order.rb', line 23 def quantity @quantity end |
#ship_date ⇒ DateTime
TODO: Write general description for this method
27 28 29 |
# File 'lib/swagger_petstore/models/order.rb', line 27 def ship_date @ship_date end |
#status ⇒ Status1Enum
TODO: Write general description for this method
31 32 33 |
# File 'lib/swagger_petstore/models/order.rb', line 31 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/swagger_petstore/models/order.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP pet_id = hash.key?('petId') ? hash['petId'] : SKIP quantity = hash.key?('quantity') ? hash['quantity'] : SKIP ship_date = if hash.key?('shipDate') (DateTimeHelper.from_rfc3339(hash['shipDate']) if hash['shipDate']) else SKIP end status = hash.key?('status') ? hash['status'] : SKIP complete = hash.key?('complete') ? hash['complete'] : SKIP # Create object from extracted values. Order.new(id, pet_id, quantity, ship_date, status, complete) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/swagger_petstore/models/order.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['pet_id'] = 'petId' @_hash['quantity'] = 'quantity' @_hash['ship_date'] = 'shipDate' @_hash['status'] = 'status' @_hash['complete'] = 'complete' @_hash end |
.nullables ⇒ Object
An array for nullable fields
62 63 64 |
# File 'lib/swagger_petstore/models/order.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/swagger_petstore/models/order.rb', line 50 def self.optionals %w[ id pet_id quantity ship_date status complete ] end |
Instance Method Details
#to_custom_ship_date ⇒ Object
105 106 107 |
# File 'lib/swagger_petstore/models/order.rb', line 105 def to_custom_ship_date DateTimeHelper.to_rfc3339(ship_date) end |