Class: Rubord::User

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ User

Returns a new instance of User.



11
12
13
14
15
16
17
18
19
# File 'lib/rubord/models/user.rb', line 11

def initialize(data)
  @id             = data["id"]
  @username       = data["username"]
  @globalname     = data["global_name"]
  @discriminator  = data["discriminator"]
  @creationDate   = ((@id.to_i >> 22) + 1420070400000) / 1000
  @bot            = data["bot"] || false
  @tag            = "#{@username}##{@discriminator}"
end

Instance Attribute Details

#botObject (readonly)

Returns the value of attribute bot.



3
4
5
# File 'lib/rubord/models/user.rb', line 3

def bot
  @bot
end

#creationDateObject (readonly)

Returns the value of attribute creationDate.



3
4
5
# File 'lib/rubord/models/user.rb', line 3

def creationDate
  @creationDate
end

#discriminatorObject (readonly)

Returns the value of attribute discriminator.



3
4
5
# File 'lib/rubord/models/user.rb', line 3

def discriminator
  @discriminator
end

#globalnameObject (readonly)

Returns the value of attribute globalname.



3
4
5
# File 'lib/rubord/models/user.rb', line 3

def globalname
  @globalname
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/rubord/models/user.rb', line 3

def id
  @id
end

#tagObject (readonly)

Returns the value of attribute tag.



3
4
5
# File 'lib/rubord/models/user.rb', line 3

def tag
  @tag
end

#usernameObject (readonly)

Returns the value of attribute username.



3
4
5
# File 'lib/rubord/models/user.rb', line 3

def username
  @username
end