Class: Twitch::Clip
- Inherits:
-
Object
- Object
- Twitch::Clip
- Defined in:
- lib/twitch/clip.rb
Overview
A small segment of a broadcast captured by another user.
Constant Summary collapse
- DATE_ATTRIBUTES =
Fields to be converted from ISO 8601 string to a typed date.
[:created_at]
Instance Attribute Summary collapse
-
#broadcaster_id ⇒ Object
readonly
(User) ID of the clip’s source broadcast.
-
#created_at ⇒ Object
readonly
Date the clip was created.
-
#creator_id ⇒ Object
readonly
(User) ID of the clip’s creator.
-
#embed_url ⇒ Object
readonly
URL for embedding the clip.
-
#game_id ⇒ Object
readonly
ID of the game being played.
-
#id ⇒ Object
readonly
ID of the clip.
-
#language ⇒ Object
readonly
Language of the originating broadcast.
-
#thumbnail_url ⇒ Object
readonly
URL of the thumbnail image.
-
#title ⇒ Object
readonly
Title of the clip.
-
#url ⇒ Object
readonly
URL of the clip.
-
#video_id ⇒ Object
readonly
ID of the archived broadcast (may not be available).
-
#view_count ⇒ Object
readonly
Number of views.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Clip
constructor
A new instance of Clip.
Constructor Details
#initialize(attributes = {}) ⇒ Clip
Returns a new instance of Clip.
32 33 34 35 36 37 38 39 40 |
# File 'lib/twitch/clip.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
#broadcaster_id ⇒ Object (readonly)
(User) ID of the clip’s source broadcast.
24 25 26 |
# File 'lib/twitch/clip.rb', line 24 def broadcaster_id @broadcaster_id end |
#created_at ⇒ Object (readonly)
Date the clip was created.
12 13 14 |
# File 'lib/twitch/clip.rb', line 12 def created_at @created_at end |
#creator_id ⇒ Object (readonly)
(User) ID of the clip’s creator.
26 27 28 |
# File 'lib/twitch/clip.rb', line 26 def creator_id @creator_id end |
#embed_url ⇒ Object (readonly)
URL for embedding the clip.
18 19 20 |
# File 'lib/twitch/clip.rb', line 18 def @embed_url end |
#game_id ⇒ Object (readonly)
ID of the game being played.
28 29 30 |
# File 'lib/twitch/clip.rb', line 28 def game_id @game_id end |
#id ⇒ Object (readonly)
ID of the clip.
8 9 10 |
# File 'lib/twitch/clip.rb', line 8 def id @id end |
#language ⇒ Object (readonly)
Language of the originating broadcast.
22 23 24 |
# File 'lib/twitch/clip.rb', line 22 def language @language end |
#thumbnail_url ⇒ Object (readonly)
URL of the thumbnail image.
16 17 18 |
# File 'lib/twitch/clip.rb', line 16 def thumbnail_url @thumbnail_url end |
#title ⇒ Object (readonly)
Title of the clip.
10 11 12 |
# File 'lib/twitch/clip.rb', line 10 def title @title end |
#url ⇒ Object (readonly)
URL of the clip.
14 15 16 |
# File 'lib/twitch/clip.rb', line 14 def url @url end |
#video_id ⇒ Object (readonly)
ID of the archived broadcast (may not be available).
30 31 32 |
# File 'lib/twitch/clip.rb', line 30 def video_id @video_id end |
#view_count ⇒ Object (readonly)
Number of views.
20 21 22 |
# File 'lib/twitch/clip.rb', line 20 def view_count @view_count end |