youtube_it 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.2
1
+ 1.4.3
@@ -130,8 +130,8 @@ class YouTubeIt
130
130
  client.delete_favorite(video_id)
131
131
  end
132
132
 
133
- def favorites
134
- client.favorites
133
+ def favorites(opts = {})
134
+ client.favorites(opts)
135
135
  end
136
136
 
137
137
  def profile(user_id)
@@ -145,7 +145,7 @@ class YouTubeIt
145
145
  def playlists
146
146
  client.playlists
147
147
  end
148
-
148
+
149
149
  def playlists_for(user)
150
150
  client.playlists_for(user)
151
151
  end
@@ -245,14 +245,14 @@ class YouTubeIt
245
245
  def client
246
246
  @client ||= YouTubeIt::Upload::VideoUpload.new(:dev_key => @dev_key, :authsub_token => @authsub_token)
247
247
  end
248
-
248
+
249
249
  def session_token_header
250
250
  {
251
251
  "Content-Type" => "application/x-www-form-urlencoded",
252
252
  "Authorization" => "AuthSub token=#{@authsub_token}"
253
- }
253
+ }
254
254
  end
255
-
255
+
256
256
  def http_connection
257
257
  http = Net::HTTP.new("www.google.com")
258
258
  http.set_debug_output(logger) if @http_debugging
@@ -172,7 +172,7 @@ class YouTubeIt
172
172
  "Content-Length" => "#{token_body.length}",
173
173
  }
174
174
  token_url = "/action/GetUploadToken"
175
-
175
+
176
176
  if @access_token.nil?
177
177
  token_header.merge!(authorization_headers)
178
178
  http_connection do |session|
@@ -228,7 +228,7 @@ class YouTubeIt
228
228
  "Content-Length" => "#{favorite_body.length}",
229
229
  }
230
230
  favorite_url = "/feeds/api/users/default/favorites"
231
-
231
+
232
232
  if @access_token.nil?
233
233
  favorite_header.merge!(authorization_headers)
234
234
  http_connection do |session|
@@ -249,7 +249,7 @@ class YouTubeIt
249
249
  "Content-Length" => "0",
250
250
  }
251
251
  favorite_url = "/feeds/api/users/default/favorites/%s" % video_id
252
-
252
+
253
253
  if @access_token.nil?
254
254
  favorite_header.merge!(authorization_headers).delete("GData-Version")
255
255
  http_connection do |session|
@@ -289,7 +289,7 @@ class YouTubeIt
289
289
  return response.body
290
290
  end
291
291
  end
292
-
292
+
293
293
  def playlists_for(user)
294
294
  playlist_url = "/feeds/api/users/#{user}/playlists?v=2"
295
295
  http_connection do |session|
@@ -405,13 +405,17 @@ class YouTubeIt
405
405
  return true
406
406
  end
407
407
 
408
- def favorites
409
- favorite_url = "/feeds/api/users/default/favorites"
410
- http_connection do |session|
411
- response = session.get(favorite_url)
412
- raise_on_faulty_response(response)
413
- return response.body
408
+ def favorites(opts = {})
409
+ favorite_url = "/feeds/api/users/default/favorites?#{opts.to_param}"
410
+ if @access_token.nil?
411
+ http_connection do |session|
412
+ response = session.get(favorite_url)
413
+ end
414
+ else
415
+ response = @access_token.get("http://%s%s" % [base_url, favorite_url])
414
416
  end
417
+ raise_on_faulty_response(response)
418
+ return YouTubeIt::Parser::VideosFeedParser.new(response.body).parse
415
419
  end
416
420
 
417
421
  def get_current_user
@@ -479,7 +483,7 @@ class YouTubeIt
479
483
  all_faults + sprintf("%s: %s\n", msg_error, code)
480
484
  end
481
485
  rescue
482
- string[/<TITLE>(.+)<\/TITLE>/, 1] || string
486
+ string[/<TITLE>(.+)<\/TITLE>/, 1] || string
483
487
  end
484
488
  end
485
489
 
data/youtube_it.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{youtube_it}
8
- s.version = "1.4.2"
8
+ s.version = "1.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["kylejginavan", "chebyte", "mseppae"]
12
- s.date = %q{2011-04-08}
12
+ s.date = %q{2011-05-30}
13
13
  s.description = %q{Upload, delete, update, comment on youtube videos all from one gem.}
14
14
  s.email = %q{kylejginavan@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -44,7 +44,6 @@ Gem::Specification.new do |s|
44
44
  "lib/youtube_it/request/video_upload.rb",
45
45
  "lib/youtube_it/response/video_search.rb",
46
46
  "lib/youtube_it/version.rb",
47
- "pkg/youtube_it-1.4.1.gem",
48
47
  "test/files/youtube_video_response.xml",
49
48
  "test/helper.rb",
50
49
  "test/test.mov",
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: youtube_it
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.4.2
5
+ version: 1.4.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - kylejginavan
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-04-08 00:00:00 -05:00
15
+ date: 2011-05-30 00:00:00 -05:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -74,7 +74,6 @@ files:
74
74
  - lib/youtube_it/request/video_upload.rb
75
75
  - lib/youtube_it/response/video_search.rb
76
76
  - lib/youtube_it/version.rb
77
- - pkg/youtube_it-1.4.1.gem
78
77
  - test/files/youtube_video_response.xml
79
78
  - test/helper.rb
80
79
  - test/test.mov
Binary file