Class: YouTubeIt::AuthSubClient
- Inherits:
-
Client
- Object
- Client
- YouTubeIt::AuthSubClient
show all
- Defined in:
- lib/youtube_it/client.rb
Instance Method Summary
collapse
Methods inherited from Client
#add_comment, #add_favorite, #add_playlist, #add_video_to_playlist, #comments, #current_user, #delete_favorite, #delete_playlist, #delete_video_from_playlist, #dislike_video, #enable_http_debugging, #favorites, #like_video, #my_video, #my_videos, #playlist, #playlists, #profile, #subscribe_channel, #subscriptions, #unsubscribe_channel, #update_playlist, #upload_token, #video_by, #video_by_user, #video_delete, #video_update, #video_upload, #videos_by
Methods included from Logging
#logger
Constructor Details
Returns a new instance of AuthSubClient.
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
# File 'lib/youtube_it/client.rb', line 224
def initialize *params
if params.first.is_a?(Hash)
hash_options = params.first
@authsub_token = hash_options[:token]
@dev_key = hash_options[:dev_key]
@client_id = hash_options[:client_id] || "youtube_it"
@legacy_debug_flag = hash_options[:debug]
else
puts "* warning: the method YouTubeIt::AuthSubClient.new(token, dev_key) is depricated, use YouTubeIt::AuthSubClient.new(:token => 'token', :dev_key => 'dev_key')"
@authsub_token = params.shift
@dev_key = params.shift
@client_id = params.shift || "youtube_it"
@legacy_debug_flag = params.shift
end
end
|
Instance Method Details
#create_session_token ⇒ Object
240
241
242
243
244
245
246
247
248
|
# File 'lib/youtube_it/client.rb', line 240
def create_session_token
response = nil
session_token_url = "/accounts/AuthSubSessionToken"
http_connection do |session|
response = session.get2('https://%s' % session_token_url,).body
end
@authsub_token = response.sub('Token=','')
end
|
#revoke_session_token ⇒ Object
250
251
252
253
254
255
256
257
258
|
# File 'lib/youtube_it/client.rb', line 250
def revoke_session_token
response = nil
session_token_url = "/accounts/AuthSubRevokeToken"
http_connection do |session|
response = session.get2('https://%s' % session_token_url,).code
end
response.to_s == '200' ? true : false
end
|
#session_token_info ⇒ Object
260
261
262
263
264
265
266
267
268
|
# File 'lib/youtube_it/client.rb', line 260
def session_token_info
response = nil
session_token_url = "/accounts/AuthSubTokenInfo"
http_connection do |session|
response = session.get2('https://%s' % session_token_url,)
end
{:code => response.code, :body => response.body }
end
|