Class: YtStreamingApi::RApi::Message

Inherits:
Request
  • Object
show all
Defined in:
lib/yt_streaming_api/r_api/messages.rb

Instance Attribute Summary

Attributes inherited from Request

#_url, #error, #headers, #http_verb, #params, #response, #user

Instance Method Summary collapse

Methods inherited from Request

#fail?, #initialize, #success?

Constructor Details

This class inherits a constructor from YtStreamingApi::RApi::Request

Instance Method Details

#list(part = "snippet", max_results = 2000, chat_id = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/yt_streaming_api/r_api/messages.rb', line 6

def list(part="snippet", max_results=2000, chat_id=nil)
  return nil if chat_id.nil?
  
  @http_verb = 'Get'
  @url = "https://www.googleapis.com/youtube/v3/liveBroadcasts"
  @headers = {"Content-Type" => "application/json", "Authorization" => "#{RApi.authorization}#{@user.youtube_access_token}"}
  @params = "?liveChatId=#{chat_id}&part=#{part}&maxResults=#{max_results}&key=#{RApi.api_key}"

  http
  @response
end