Class: Twitch::Stream
- Inherits:
-
Object
- Object
- Twitch::Stream
- 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
-
#community_ids ⇒ Object
readonly
Associated community IDs for the broadcaster.
-
#game_id ⇒ Object
readonly
ID of the game being broadcast.
-
#id ⇒ Object
readonly
ID of the stream.
-
#language ⇒ Object
readonly
Language of the broadcast.
-
#started_at ⇒ Object
readonly
Date at which the broadcast started.
-
#thumbnail_url ⇒ Object
readonly
URL of the latest thumbnail image for the broadcast.
-
#title ⇒ Object
readonly
Title of the stream session.
-
#type ⇒ Object
readonly
The type of broadcast which may include ‘live’, ‘playlist’, or ‘watch_party’.
-
#user_id ⇒ Object
readonly
ID of the user broadcasting.
-
#viewer_count ⇒ Object
readonly
Concurrent viewer count of the broadcast.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Stream
constructor
A new instance of Stream.
Constructor Details
permalink #initialize(attributes = {}) ⇒ Stream
Returns a new instance of Stream.
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
permalink #community_ids ⇒ Object (readonly)
Associated community IDs for the broadcaster.
16 17 18 |
# File 'lib/twitch/stream.rb', line 16 def community_ids @community_ids end |
permalink #game_id ⇒ Object (readonly)
ID of the game being broadcast.
14 15 16 |
# File 'lib/twitch/stream.rb', line 14 def game_id @game_id end |
permalink #id ⇒ Object (readonly)
ID of the stream.
10 11 12 |
# File 'lib/twitch/stream.rb', line 10 def id @id end |
permalink #language ⇒ Object (readonly)
Language of the broadcast.
27 28 29 |
# File 'lib/twitch/stream.rb', line 27 def language @language end |
permalink #started_at ⇒ Object (readonly)
Date at which the broadcast started.
25 26 27 |
# File 'lib/twitch/stream.rb', line 25 def started_at @started_at end |
permalink #thumbnail_url ⇒ Object (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 |
permalink #title ⇒ Object (readonly)
Title of the stream session.
21 22 23 |
# File 'lib/twitch/stream.rb', line 21 def title @title end |
permalink #type ⇒ Object (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 |
permalink #user_id ⇒ Object (readonly)
ID of the user broadcasting.
12 13 14 |
# File 'lib/twitch/stream.rb', line 12 def user_id @user_id end |
permalink #viewer_count ⇒ Object (readonly)
Concurrent viewer count of the broadcast.
23 24 25 |
# File 'lib/twitch/stream.rb', line 23 def viewer_count @viewer_count end |