Class: SwaggerPetstoreOpenApi30::Customer
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SwaggerPetstoreOpenApi30::Customer
- Defined in:
- lib/swagger_petstore_open_api30/models/customer.rb
Overview
Customer Model.
Instance Attribute Summary collapse
-
#address ⇒ Array[Address]
TODO: Write general description for this method.
-
#id ⇒ Integer
TODO: Write general description for this method.
-
#username ⇒ String
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, username = SKIP, address = SKIP) ⇒ Customer
constructor
A new instance of Customer.
Methods inherited from BaseModel
Constructor Details
#initialize(id = SKIP, username = SKIP, address = SKIP) ⇒ Customer
Returns a new instance of Customer.
47 48 49 50 51 |
# File 'lib/swagger_petstore_open_api30/models/customer.rb', line 47 def initialize(id = SKIP, username = SKIP, address = SKIP) @id = id unless id == SKIP @username = username unless username == SKIP @address = address unless address == SKIP end |
Instance Attribute Details
#address ⇒ Array[Address]
TODO: Write general description for this method
22 23 24 |
# File 'lib/swagger_petstore_open_api30/models/customer.rb', line 22 def address @address end |
#id ⇒ Integer
TODO: Write general description for this method
14 15 16 |
# File 'lib/swagger_petstore_open_api30/models/customer.rb', line 14 def id @id end |
#username ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/swagger_petstore_open_api30/models/customer.rb', line 18 def username @username end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/swagger_petstore_open_api30/models/customer.rb', line 54 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP username = hash.key?('username') ? hash['username'] : SKIP # Parameter is an array, so we need to iterate through it address = nil unless hash['address'].nil? address = [] hash['address'].each do |structure| address << (Address.from_hash(structure) if structure) end end address = SKIP unless hash.key?('address') # Create object from extracted values. Customer.new(id, username, address) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/swagger_petstore_open_api30/models/customer.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['username'] = 'username' @_hash['address'] = 'address' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/swagger_petstore_open_api30/models/customer.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 40 |
# File 'lib/swagger_petstore_open_api30/models/customer.rb', line 34 def self.optionals %w[ id username address ] end |