Class: TestAsdasdasd::User
- Defined in:
- lib/test_asdasdasd/models/user.rb
Overview
User Model.
Instance Attribute Summary collapse
-
#email ⇒ String
TODO: Write general description for this method.
-
#first_name ⇒ String
TODO: Write general description for this method.
-
#id ⇒ Long
TODO: Write general description for this method.
-
#last_name ⇒ String
TODO: Write general description for this method.
-
#password ⇒ String
TODO: Write general description for this method.
-
#phone ⇒ String
TODO: Write general description for this method.
-
#user_status ⇒ Integer
User Status.
-
#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.
Instance Method Summary collapse
-
#initialize(id = nil, username = nil, first_name = nil, last_name = nil, email = nil, password = nil, phone = nil, user_status = nil) ⇒ User
constructor
A new instance of User.
Methods inherited from BaseModel
Constructor Details
#initialize(id = nil, username = nil, first_name = nil, last_name = nil, email = nil, password = nil, phone = nil, user_status = nil) ⇒ User
Returns a new instance of User.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/test_asdasdasd/models/user.rb', line 55 def initialize(id = nil, username = nil, first_name = nil, last_name = nil, email = nil, password = nil, phone = nil, user_status = nil) @id = id @username = username @first_name = first_name @last_name = last_name @email = email @password = password @phone = phone @user_status = user_status end |
Instance Attribute Details
#email ⇒ String
TODO: Write general description for this method
27 28 29 |
# File 'lib/test_asdasdasd/models/user.rb', line 27 def email @email end |
#first_name ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/test_asdasdasd/models/user.rb', line 19 def first_name @first_name end |
#id ⇒ Long
TODO: Write general description for this method
11 12 13 |
# File 'lib/test_asdasdasd/models/user.rb', line 11 def id @id end |
#last_name ⇒ String
TODO: Write general description for this method
23 24 25 |
# File 'lib/test_asdasdasd/models/user.rb', line 23 def last_name @last_name end |
#password ⇒ String
TODO: Write general description for this method
31 32 33 |
# File 'lib/test_asdasdasd/models/user.rb', line 31 def password @password end |
#phone ⇒ String
TODO: Write general description for this method
35 36 37 |
# File 'lib/test_asdasdasd/models/user.rb', line 35 def phone @phone end |
#user_status ⇒ Integer
User Status
39 40 41 |
# File 'lib/test_asdasdasd/models/user.rb', line 39 def user_status @user_status end |
#username ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/test_asdasdasd/models/user.rb', line 15 def username @username end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/test_asdasdasd/models/user.rb', line 74 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash['id'] username = hash['username'] first_name = hash['firstName'] last_name = hash['lastName'] email = hash['email'] password = hash['password'] phone = hash['phone'] user_status = hash['userStatus'] # Create object from extracted values. User.new(id, username, first_name, last_name, email, password, phone, user_status) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/test_asdasdasd/models/user.rb', line 42 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 |