Class: SwaggerPetstoreOpenApi30::User

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/swagger_petstore_open_api30/models/user.rb

Overview

User 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, username = SKIP, first_name = SKIP, last_name = SKIP, email = SKIP, password = SKIP, phone = SKIP, user_status = SKIP) ⇒ User

Returns a new instance of User.



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 77

def initialize(id = SKIP, username = SKIP, first_name = SKIP,
               last_name = SKIP, email = SKIP, password = SKIP,
               phone = SKIP, user_status = SKIP)
  @id = id unless id == SKIP
  @username = username unless username == SKIP
  @first_name = first_name unless first_name == SKIP
  @last_name = last_name unless last_name == SKIP
  @email = email unless email == SKIP
  @password = password unless password == SKIP
  @phone = phone unless phone == SKIP
  @user_status = user_status unless user_status == SKIP
end

Instance Attribute Details

#emailString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 30

def email
  @email
end

#first_nameString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 22

def first_name
  @first_name
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 14

def id
  @id
end

#last_nameString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 26

def last_name
  @last_name
end

#passwordString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 34

def password
  @password
end

#phoneString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 38

def phone
  @phone
end

#user_statusInteger

User Status

Returns:

  • (Integer)


42
43
44
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 42

def user_status
  @user_status
end

#usernameString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 18

def username
  @username
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 91

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
  first_name = hash.key?('firstName') ? hash['firstName'] : SKIP
  last_name = hash.key?('lastName') ? hash['lastName'] : SKIP
  email = hash.key?('email') ? hash['email'] : SKIP
  password = hash.key?('password') ? hash['password'] : SKIP
  phone = hash.key?('phone') ? hash['phone'] : SKIP
  user_status = hash.key?('userStatus') ? hash['userStatus'] : SKIP

  # Create object from extracted values.
  User.new(id,
           username,
           first_name,
           last_name,
           email,
           password,
           phone,
           user_status)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['username'] = 'username'
  @_hash['first_name'] = 'firstName'
  @_hash['last_name'] = 'lastName'
  @_hash['email'] = 'email'
  @_hash['password'] = 'password'
  @_hash['phone'] = 'phone'
  @_hash['user_status'] = 'userStatus'
  @_hash
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/swagger_petstore_open_api30/models/user.rb', line 59

def self.optionals
  %w[
    id
    username
    first_name
    last_name
    email
    password
    phone
    user_status
  ]
end