Class: Twitch::User

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

Overview

Data object for Twitch users

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ User

Returns a new instance of User.



30
31
32
33
34
# File 'lib/twitch/user.rb', line 30

def initialize(attributes = {})
  attributes.each do |key, value|
    instance_variable_set "@#{key}", value
  end
end

Instance Attribute Details

#broadcaster_typeObject (readonly)

Represents a special broadcaster role of a user. (partner, affiliate)



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

def broadcaster_type
  @broadcaster_type
end

#created_atObject (readonly)

The UTC date and time that the user’s account was created. The timestamp is in RFC3339 format.



28
29
30
# File 'lib/twitch/user.rb', line 28

def created_at
  @created_at
end

#descriptionObject (readonly)

Description/biographical info of a user.



19
20
21
# File 'lib/twitch/user.rb', line 19

def description
  @description
end

#display_nameObject (readonly)

Formatted username of the user.



11
12
13
# File 'lib/twitch/user.rb', line 11

def display_name
  @display_name
end

#idObject (readonly)

ID of the user.



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

def id
  @id
end

#loginObject (readonly)

Unformatted (lowercase) username of the user.



9
10
11
# File 'lib/twitch/user.rb', line 9

def 
  @login
end

#offline_image_urlObject (readonly)

URL to the image displayed in the video box when the stream is offline.



24
25
26
# File 'lib/twitch/user.rb', line 24

def offline_image_url
  @offline_image_url
end

#profile_image_urlObject (readonly)

URL to the user’s profile image.



21
22
23
# File 'lib/twitch/user.rb', line 21

def profile_image_url
  @profile_image_url
end

#typeObject (readonly)

Represents a special role of a user. (global mod, admin, staff)



14
15
16
# File 'lib/twitch/user.rb', line 14

def type
  @type
end

#view_countObject (readonly)

Total number of visits to the user’s stream page.



26
27
28
# File 'lib/twitch/user.rb', line 26

def view_count
  @view_count
end