class Twitch::StreamMetadata

A set of metadata to provide additional information about a game being streamed.

Additional getters are assigned at initialization time, e.g.

self.hearthstone

has data when Hearthstone is being streamed.

Other games may be included, but will be set to nil if they aren't the game currently being streamed.

Attributes

game_id[R]

ID of the game being playead.

user_id[R]

ID of the streaming user.

user_name[R]

Display name of the streaming user.

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/twitch/stream_metadata.rb, line 17
def initialize(attributes = {})
  @user_id = attributes['user_id']
  @user_name = attributes['user_name']
  @game_id = attributes['game_id']

  # Since more games can be supported in the future,
  # this will ensure they will all be available.
  attributes.each do |k, v|
    unless instance_variables.include?("@#{k}".to_sym)
      self.class.send(:attr_reader, k.to_sym)
      instance_variable_set("@#{k}", v)
    end
  end
end