Class: Twitch::Video

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

Constant Summary collapse

DATE_ATTRIBUTES =
[:created_at, :published_at]

Instance Attribute Summary collapse

Instance Method Summary collapse

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_atObject (readonly)

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



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

def language
  @language
end

#published_atObject (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_urlObject (readonly)

Returns the value of attribute thumbnail_url.



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

def thumbnail_url
  @thumbnail_url
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

#view_countObject (readonly)

Returns the value of attribute view_count.



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

def view_count
  @view_count
end