Class: Twitch::Video
- Inherits:
-
Object
- Object
- Twitch::Video
- Defined in:
- lib/twitch/video.rb
Constant Summary collapse
- DATE_ATTRIBUTES =
[:created_at, :published_at]
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#published_at ⇒ Object
readonly
Returns the value of attribute published_at.
-
#thumbnail_url ⇒ Object
readonly
Returns the value of attribute thumbnail_url.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#view_count ⇒ Object
readonly
Returns the value of attribute view_count.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Video
constructor
A new instance of Video.
Constructor Details
#initialize(attributes = {}) ⇒ Video
Returns a new instance of Video.
9 10 11 12 13 14 15 16 17 |
# File 'lib/twitch/video.rb', line 9 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
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
7 8 9 |
# File 'lib/twitch/video.rb', line 7 def created_at @created_at end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/twitch/video.rb', line 7 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/twitch/video.rb', line 7 def id @id end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
7 8 9 |
# File 'lib/twitch/video.rb', line 7 def language @language end |
#published_at ⇒ Object (readonly)
Returns the value of attribute published_at.
7 8 9 |
# File 'lib/twitch/video.rb', line 7 def published_at @published_at end |
#thumbnail_url ⇒ Object (readonly)
Returns the value of attribute thumbnail_url.
7 8 9 |
# File 'lib/twitch/video.rb', line 7 def thumbnail_url @thumbnail_url end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
7 8 9 |
# File 'lib/twitch/video.rb', line 7 def title @title end |
#view_count ⇒ Object (readonly)
Returns the value of attribute view_count.
7 8 9 |
# File 'lib/twitch/video.rb', line 7 def view_count @view_count end |