Class: SwaggerPetstore::PetRequest
- Defined in:
- lib/swagger_petstore/models/pet_request.rb
Overview
PetRequest Model.
Instance Attribute Summary collapse
-
#category ⇒ Category2
TODO: Write general description for this method.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
-
#photo_urls ⇒ Array[String]
TODO: Write general description for this method.
-
#status ⇒ StatusEnum
TODO: Write general description for this method.
-
#tags ⇒ Array[Tag]
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(name = nil, photo_urls = nil, id = SKIP, category = SKIP, tags = SKIP, status = SKIP) ⇒ PetRequest
constructor
A new instance of PetRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(name = nil, photo_urls = nil, id = SKIP, category = SKIP, tags = SKIP, status = SKIP) ⇒ PetRequest
Returns a new instance of PetRequest.
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/swagger_petstore/models/pet_request.rb', line 63 def initialize(name = nil, photo_urls = nil, id = SKIP, category = SKIP, = SKIP, status = SKIP) @id = id unless id == SKIP @category = category unless category == SKIP @name = name @photo_urls = photo_urls @tags = unless == SKIP @status = status unless status == SKIP end |
Instance Attribute Details
#category ⇒ Category2
TODO: Write general description for this method
18 19 20 |
# File 'lib/swagger_petstore/models/pet_request.rb', line 18 def category @category end |
#id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/swagger_petstore/models/pet_request.rb', line 14 def id @id end |
#name ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/swagger_petstore/models/pet_request.rb', line 22 def name @name end |
#photo_urls ⇒ Array[String]
TODO: Write general description for this method
26 27 28 |
# File 'lib/swagger_petstore/models/pet_request.rb', line 26 def photo_urls @photo_urls end |
#status ⇒ StatusEnum
TODO: Write general description for this method
34 35 36 |
# File 'lib/swagger_petstore/models/pet_request.rb', line 34 def status @status end |
#tags ⇒ Array[Tag]
TODO: Write general description for this method
30 31 32 |
# File 'lib/swagger_petstore/models/pet_request.rb', line 30 def @tags end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/swagger_petstore/models/pet_request.rb', line 78 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil photo_urls = hash.key?('photoUrls') ? hash['photoUrls'] : nil id = hash.key?('id') ? hash['id'] : SKIP category = Category2.from_hash(hash['category']) if hash['category'] # Parameter is an array, so we need to iterate through it = nil unless hash['tags'].nil? = [] hash['tags'].each do |structure| << (Tag.from_hash(structure) if structure) end end = SKIP unless hash.key?('tags') status = hash.key?('status') ? hash['status'] : SKIP # Create object from extracted values. PetRequest.new(name, photo_urls, id, category, , status) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/swagger_petstore/models/pet_request.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['category'] = 'category' @_hash['name'] = 'name' @_hash['photo_urls'] = 'photoUrls' @_hash['tags'] = 'tags' @_hash['status'] = 'status' @_hash end |
.nullables ⇒ Object
An array for nullable fields
59 60 61 |
# File 'lib/swagger_petstore/models/pet_request.rb', line 59 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 |
# File 'lib/swagger_petstore/models/pet_request.rb', line 49 def self.optionals %w[ id category tags status ] end |