Class: Twitch::Stream

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

Constant Summary collapse

DATE_ATTRIBUTES =
[:started_at]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Stream

Returns a new instance of Stream.



8
9
10
11
12
13
14
15
16
# File 'lib/twitch/stream.rb', line 8

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)

Returns the value of attribute community_ids.



5
6
7
# File 'lib/twitch/stream.rb', line 5

def community_ids
  @community_ids
end

#game_idObject (readonly)

Returns the value of attribute game_id.



5
6
7
# File 'lib/twitch/stream.rb', line 5

def game_id
  @game_id
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/twitch/stream.rb', line 5

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



5
6
7
# File 'lib/twitch/stream.rb', line 5

def language
  @language
end

#started_atObject (readonly)

Returns the value of attribute started_at.



5
6
7
# File 'lib/twitch/stream.rb', line 5

def started_at
  @started_at
end

#thumbnail_urlObject (readonly)

Returns the value of attribute thumbnail_url.



5
6
7
# File 'lib/twitch/stream.rb', line 5

def thumbnail_url
  @thumbnail_url
end

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'lib/twitch/stream.rb', line 5

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/twitch/stream.rb', line 5

def type
  @type
end

#user_idObject (readonly)

Returns the value of attribute user_id.



5
6
7
# File 'lib/twitch/stream.rb', line 5

def user_id
  @user_id
end

#viewer_countObject (readonly)

Returns the value of attribute viewer_count.



5
6
7
# File 'lib/twitch/stream.rb', line 5

def viewer_count
  @viewer_count
end