Class: ZeusSdk::V1::User

Inherits:
Object
  • Object
show all
Defined in:
lib/zeus_sdk/v1/models/auth/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ User

Returns a new instance of User.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 5

def initialize(user)
    return if user.blank?
    self.raw = user
    self.user_id = user["id"] if user.has_key?("id")
    self.name = user["name"] if user.has_key?("name")
    self.first_name = user["first_name"] if user.has_key?("first_name")
    self.last_name = user["last_name"] if user.has_key?("last_name")
    self.email = user["email"] if user.has_key?("email")
    self.email_verified = user["email_verified"] if user.has_key?("email_verified")
    self.created_at = user["created_at"] if user.has_key?("created_at")
    self.updated_at = user["updated_at"] if user.has_key?("updated_at")
    self.touched_at = user["touched_at"] if user.has_key?("touched_at")
    self.deleted_at = user["deleted_at"] if user.has_key?("deleted_at")
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 3

def created_at
  @created_at
end

#deleted_atObject

Returns the value of attribute deleted_at.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 3

def deleted_at
  @deleted_at
end

#emailObject

Returns the value of attribute email.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 3

def email
  @email
end

#email_verifiedObject

Returns the value of attribute email_verified.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 3

def email_verified
  @email_verified
end

#first_nameObject

Returns the value of attribute first_name.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 3

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 3

def last_name
  @last_name
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 3

def name
  @name
end

#rawObject

Returns the value of attribute raw.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 3

def raw
  @raw
end

#touched_atObject

Returns the value of attribute touched_at.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 3

def touched_at
  @touched_at
end

#updated_atObject

Returns the value of attribute updated_at.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 3

def updated_at
  @updated_at
end

#user_idObject

Returns the value of attribute user_id.



3
4
5
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 3

def user_id
  @user_id
end

Instance Method Details

#as_json(options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 20

def as_json(options={})
    {
        id: self.user_id,
        name: self.name,
        first_name: self.first_name,
        last_name: self.last_name,
        email: self.email,
        email_verified: self.email_verified,
        created_at: self.created_at,
        updated_at: self.updated_at,
        touched_at: self.touched_at,
        deleted_at: self.deleted_at
    }
end

#to_json(options = {}) ⇒ Object



35
36
37
# File 'lib/zeus_sdk/v1/models/auth/user.rb', line 35

def to_json(options={})
    self.as_json(options).to_json
end