Class: Rubord::User
- Inherits:
-
Object
- Object
- Rubord::User
- Defined in:
- lib/rubord/models/user.rb
Instance Attribute Summary collapse
-
#bot ⇒ Object
readonly
Returns the value of attribute bot.
-
#creationDate ⇒ Object
readonly
Returns the value of attribute creationDate.
-
#discriminator ⇒ Object
readonly
Returns the value of attribute discriminator.
-
#globalname ⇒ Object
readonly
Returns the value of attribute globalname.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(data) ⇒ User
constructor
A new instance of User.
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
#bot ⇒ Object (readonly)
Returns the value of attribute bot.
3 4 5 |
# File 'lib/rubord/models/user.rb', line 3 def bot @bot end |
#creationDate ⇒ Object (readonly)
Returns the value of attribute creationDate.
3 4 5 |
# File 'lib/rubord/models/user.rb', line 3 def creationDate @creationDate end |
#discriminator ⇒ Object (readonly)
Returns the value of attribute discriminator.
3 4 5 |
# File 'lib/rubord/models/user.rb', line 3 def discriminator @discriminator end |
#globalname ⇒ Object (readonly)
Returns the value of attribute globalname.
3 4 5 |
# File 'lib/rubord/models/user.rb', line 3 def globalname @globalname end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/rubord/models/user.rb', line 3 def id @id end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
3 4 5 |
# File 'lib/rubord/models/user.rb', line 3 def tag @tag end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
3 4 5 |
# File 'lib/rubord/models/user.rb', line 3 def username @username end |