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

#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.

Returns:

  • (Boolean)


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

def admin
  @obj['admin']
end

#avatar ⇒ String

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

#certifiedDev ⇒ Boolean

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

#defAvatar ⇒ String

The default avatar of the user

Returns:

  • (String)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Object)


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

def social
  @obj['social']
end

#supporter ⇒ Boolean

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

#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.

Returns:

  • (Boolean)


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

def webMod
  @obj['webMod']
end