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, #oauth_info=, #post, #post_file, #put, #put_file

Constructor Details

#initialize(options = {}) ⇒ YouTube

Returns a new instance of YouTube.



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

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.



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

def client_id
  @client_id
end

#developer_keyObject

The YouTube developer key being used.



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

def developer_key
  @developer_key
end

Instance Method Details

#prepare_headersObject

Custom prepare_headers to include the developer key and clientID



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

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