Class: Dbl::User

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

Overview

The User class, used for Spreading the response body into different methods

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ User

Instantiates the class variables

Parameters:

  • obj (Object)

    Response Data Object


7
8
9
# File 'lib/topgg/user.rb', line 7

def initialize(obj)
  @obj = obj
end

Instance Attribute Details

#objObject (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

#adminBoolean

Returns true/false depending on weather the user is an admin or not.

Returns:

  • (Boolean)

69
70
71
# File 'lib/topgg/user.rb', line 69

def admin
  @obj['admin']
end

#avatarString

The avatar of the user

Returns:

  • (String)

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

#certifiedDevBoolean

Returns true/false depending upon if the user is a certified developer or not.

Returns:

  • (Boolean)

57
58
59
# File 'lib/topgg/user.rb', line 57

def certifiedDev
  @obj['certifiedDev']
end

#defAvatarString

The default avatar of the user

Returns:

  • (String)

39
40
41
# File 'lib/topgg/user.rb', line 39

def defAvatar
  @obj['defAvatar']
end

#errorObject

Check for errors, if any


17
18
19
# File 'lib/topgg/user.rb', line 17

def error
  @obj['error']
end

#idObject

The Id of the user


22
23
24
# File 'lib/topgg/user.rb', line 22

def id
  @obj['id']
end

#modBoolean

Returns true/false depending upon if the user is a moderator or not.

Returns:

  • (Boolean)

45
46
47
# File 'lib/topgg/user.rb', line 45

def mod
  @obj['mod']
end

#socialObject

Returns an object containing all user social integrations.

Returns:

  • (Object)

63
64
65
# File 'lib/topgg/user.rb', line 63

def social
  @obj['social']
end

#supporterBoolean

Returns true/false depending upon if the user is a supporter or not.

Returns:

  • (Boolean)

51
52
53
# File 'lib/topgg/user.rb', line 51

def supporter
  @obj['supporter']
end

#usernameObject

The username of the user


27
28
29
# File 'lib/topgg/user.rb', line 27

def username
  @obj['username']
end

#webModBoolean

Returns true/false depending on weather the user is a website Moderator or not.

Returns:

  • (Boolean)

75
76
77
# File 'lib/topgg/user.rb', line 75

def webMod
  @obj['webMod']
end