Class: SwaggerPetstore::StoreOrderRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/swagger_petstore/models/store_order_request.rb

Overview

StoreOrderRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = SKIP, pet_id = SKIP, quantity = SKIP, ship_date = SKIP, status = SKIP, complete = SKIP) ⇒ StoreOrderRequest

Returns a new instance of StoreOrderRequest.



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/swagger_petstore/models/store_order_request.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

#completeTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


35
36
37
# File 'lib/swagger_petstore/models/store_order_request.rb', line 35

def complete
  @complete
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


15
16
17
# File 'lib/swagger_petstore/models/store_order_request.rb', line 15

def id
  @id
end

#pet_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


19
20
21
# File 'lib/swagger_petstore/models/store_order_request.rb', line 19

def pet_id
  @pet_id
end

#quantityInteger

TODO: Write general description for this method

Returns:

  • (Integer)


23
24
25
# File 'lib/swagger_petstore/models/store_order_request.rb', line 23

def quantity
  @quantity
end

#ship_dateDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


27
28
29
# File 'lib/swagger_petstore/models/store_order_request.rb', line 27

def ship_date
  @ship_date
end

#statusStatus1Enum

TODO: Write general description for this method

Returns:



31
32
33
# File 'lib/swagger_petstore/models/store_order_request.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/store_order_request.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.
  StoreOrderRequest.new(id,
                        pet_id,
                        quantity,
                        ship_date,
                        status,
                        complete)
end

.namesObject

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/store_order_request.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

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/swagger_petstore/models/store_order_request.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
56
57
58
59
# File 'lib/swagger_petstore/models/store_order_request.rb', line 50

def self.optionals
  %w[
    id
    pet_id
    quantity
    ship_date
    status
    complete
  ]
end

Instance Method Details

#to_custom_ship_dateObject



105
106
107
# File 'lib/swagger_petstore/models/store_order_request.rb', line 105

def to_custom_ship_date
  DateTimeHelper.to_rfc3339(ship_date)
end