Class: Dbl::User
- Inherits:
-
Object
- Object
- Dbl::User
- Defined in:
- lib/topgg/user.rb
Overview
The User class, used for Spreading the response body into different methods
Instance Attribute Summary collapse
-
#obj ⇒ Object
(also: #raw, #data)
readonly
Returns the value of attribute obj.
Instance Method Summary collapse
-
#admin ⇒ Boolean
Returns true/false depending on weather the user is an admin or not.
-
#avatar ⇒ String
The avatar of the user.
-
#certifiedDev ⇒ Boolean
Returns true/false depending upon if the user is a certified developer or not.
-
#defAvatar ⇒ String
The default avatar of the user.
-
#error ⇒ Object
Check for errors, if any.
-
#id ⇒ Object
The Id of the user.
-
#initialize(obj) ⇒ User
constructor
Instantiates the class variables.
-
#mod ⇒ Boolean
Returns true/false depending upon if the user is a moderator or not.
-
#social ⇒ Object
Returns an object containing all user social integrations.
-
#supporter ⇒ Boolean
Returns true/false depending upon if the user is a supporter or not.
-
#username ⇒ Object
The username of the user.
-
#webMod ⇒ Boolean
Returns true/false depending on weather the user is a website Moderator or not.
Constructor Details
#initialize(obj) ⇒ User
Instantiates the class variables
7 8 9 |
# File 'lib/topgg/user.rb', line 7 def initialize(obj) @obj = obj end |
Instance Attribute Details
#obj ⇒ Object (readonly) Also known as: raw, data
Returns the value of attribute obj.
11 12 13 |
# File 'lib/topgg/user.rb', line 11 def obj @obj end |
Instance Method Details
#admin ⇒ Boolean
Returns true/false depending on weather the user is an admin or not.
69 70 71 |
# File 'lib/topgg/user.rb', line 69 def admin @obj['admin'] end |
#avatar ⇒ String
The avatar of the user
33 34 35 |
# File 'lib/topgg/user.rb', line 33 def avatar "https://cdn.discordapp.com/avatars/#{@obj['id']}/#{@obj['avatar']}.webp?size=1024" end |
#certifiedDev ⇒ Boolean
Returns true/false depending upon if the user is a certified developer or not.
57 58 59 |
# File 'lib/topgg/user.rb', line 57 def certifiedDev @obj['certifiedDev'] end |
#defAvatar ⇒ String
The default avatar of the user
39 40 41 |
# File 'lib/topgg/user.rb', line 39 def defAvatar @obj['defAvatar'] end |
#error ⇒ Object
Check for errors, if any
17 18 19 |
# File 'lib/topgg/user.rb', line 17 def error @obj['error'] end |
#id ⇒ Object
The Id of the user
22 23 24 |
# File 'lib/topgg/user.rb', line 22 def id @obj['id'] end |
#mod ⇒ Boolean
Returns true/false depending upon if the user is a moderator or not.
45 46 47 |
# File 'lib/topgg/user.rb', line 45 def mod @obj['mod'] end |
#social ⇒ Object
Returns an object containing all user social integrations.
63 64 65 |
# File 'lib/topgg/user.rb', line 63 def @obj['social'] end |
#supporter ⇒ Boolean
Returns true/false depending upon if the user is a supporter or not.
51 52 53 |
# File 'lib/topgg/user.rb', line 51 def supporter @obj['supporter'] end |
#username ⇒ Object
The username of the user
27 28 29 |
# File 'lib/topgg/user.rb', line 27 def username @obj['username'] end |
#webMod ⇒ Boolean
Returns true/false depending on weather the user is a website Moderator or not.
75 76 77 |
# File 'lib/topgg/user.rb', line 75 def webMod @obj['webMod'] end |