Class: GData::Client::YouTube

Inherits:
Base
  • Object
show all
Defined in:
lib/gdata/client/youtube.rb

Overview

Client class to wrap working with the YouTube API. Sets some YouTube-specific options.

Instance Attribute Summary collapse

Attributes inherited from Base

#auth_handler, #authsub_scope, #clientlogin_service, #clientlogin_url, #headers, #http_service, #source, #version

Instance Method Summary collapse

Methods inherited from Base

#authsub_private_key=, #authsub_token=, #authsub_url, #clientlogin, #delete, #get, #make_file_request, #make_request, #post, #post_file, #put, #put_file

Constructor Details

#initialize(options = {}) ⇒ YouTube

Returns a new instance of YouTube.



28
29
30
31
32
33
34
# File 'lib/gdata/client/youtube.rb', line 28

def initialize(options = {})
  options[:clientlogin_service] ||= 'youtube'
  options[:clientlogin_url] ||= 'https://www.google.com/youtube/accounts/ClientLogin'
  options[:authsub_scope] ||= 'http://gdata.youtube.com'
  options[:version] ||= '2'
  super(options)
end

Instance Attribute Details

#client_idObject

The YouTube ClientID being used.



26
27
28
# File 'lib/gdata/client/youtube.rb', line 26

def client_id
  @client_id
end

#developer_keyObject

The YouTube developer key being used.



24
25
26
# File 'lib/gdata/client/youtube.rb', line 24

def developer_key
  @developer_key
end

Instance Method Details

#prepare_headersObject

Custom prepare_headers to include the developer key and clientID



37
38
39
40
41
42
43
44
45
# File 'lib/gdata/client/youtube.rb', line 37

def prepare_headers
  if @client_id
    @headers['X-GData-Client'] = @client_id
  end
  if @developer_key
    @headers['X-GData-Key'] = "key=#{@developer_key}"
  end
  super
end