Class: Twitch::Stream

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

Overview

A user’s broadcasting session.

Constant Summary collapse

DATE_ATTRIBUTES =

Fields to be converted from ISO 8601 string to a typed date.

[:started_at]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Stream

Returns a new instance of Stream.

[View source]

32
33
34
35
36
37
38
39
40
# File 'lib/twitch/stream.rb', line 32

def initialize(attributes = {})
  attributes.each do |k, v|
    if DATE_ATTRIBUTES.include?(k.to_sym)
      instance_variable_set("@#{k}", Time.parse(v))
    else
      instance_variable_set("@#{k}", v)
    end
  end
end

Instance Attribute Details

#community_idsObject (readonly)

Associated community IDs for the broadcaster.


16
17
18
# File 'lib/twitch/stream.rb', line 16

def community_ids
  @community_ids
end

#game_idObject (readonly)

ID of the game being broadcast.


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

def game_id
  @game_id
end

#idObject (readonly)

ID of the stream.


10
11
12
# File 'lib/twitch/stream.rb', line 10

def id
  @id
end

#languageObject (readonly)

Language of the broadcast.


27
28
29
# File 'lib/twitch/stream.rb', line 27

def language
  @language
end

#started_atObject (readonly)

Date at which the broadcast started.


25
26
27
# File 'lib/twitch/stream.rb', line 25

def started_at
  @started_at
end

#thumbnail_urlObject (readonly)

URL of the latest thumbnail image for the broadcast.


29
30
31
# File 'lib/twitch/stream.rb', line 29

def thumbnail_url
  @thumbnail_url
end

#titleObject (readonly)

Title of the stream session.


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

def title
  @title
end

#typeObject (readonly)

The type of broadcast which may include ‘live’, ‘playlist’, or ‘watch_party’.


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

def type
  @type
end

#user_idObject (readonly)

ID of the user broadcasting.


12
13
14
# File 'lib/twitch/stream.rb', line 12

def user_id
  @user_id
end

#viewer_countObject (readonly)

Concurrent viewer count of the broadcast.


23
24
25
# File 'lib/twitch/stream.rb', line 23

def viewer_count
  @viewer_count
end