slainer68_vimeo 1.4.4 → 1.5.2

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.
@@ -133,10 +133,15 @@ Once the user has allowed your application to access their account, they will be
133
133
  user.secret = access_token.secret
134
134
  user.save
135
135
 
136
+ *Note*: if you are trying to get your access tokens manually, then the above block of code will be a little different:
137
+
138
+ - `params[:oauth_token]` is the same as `request_token.token`
139
+ - `params[:oauth_verifier]` is the code you see on Vimeo after you visit `base.authorize_url` and allow access to your account.
140
+
136
141
  Now you've got everything you need to use the Advanced API. Let's get a user's videos:
137
142
 
138
143
  video = Vimeo::Advanced::Video.new("consumer_key", "consumer_secret", :token => user.token, :secret => user.secret)
139
- video.get_videos("matthooks")
144
+ video.get_all("matthooks")
140
145
 
141
146
  # => {"videos"=> { ... }, "stat"=>"ok", "generated_in"=>"0.5753"}
142
147
 
@@ -271,6 +276,7 @@ Some methods have optional variables. Pass these as a hash at the end of a call.
271
276
  video.get_cast("video_id", { :page => "1", :per_page => "25" })
272
277
  video.get_contacts_liked("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
273
278
  video.get_contacts_uploaded("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
279
+ video.get_collections("video_id")
274
280
  video.get_info("video_id")
275
281
  video.get_likes("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
276
282
  video.get_subscriptions("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
@@ -327,4 +333,4 @@ The upload method will automatically get an upload ticket, perform the multipart
327
333
  * [HTTParty](http://github.com/jnunemaker/httparty): Easily one of the best tools I have used since I started using Ruby.
328
334
  * [Jeweler](http://github.com/technicalpickles/jeweler): Great tool for creating gems for Github.
329
335
 
330
- ### Copyright (c) 2009-2010 Matt Hooks. See LICENSE for details.
336
+ ### Copyright (c) 2009-2010 Matt Hooks. See LICENSE for details.
data/Rakefile CHANGED
@@ -20,8 +20,8 @@ begin
20
20
  gem.rdoc_options = ['--main', 'README.rdoc', '--inline-source', '--charset=UTF-8']
21
21
  gem.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'CHANGELOG.rdoc']
22
22
 
23
- gem.add_dependency "multi_json", ">= 1.0.4"
24
23
  gem.add_dependency "httparty", ">= 0.4.5"
24
+ gem.add_dependency "json", ">= 1.1.9"
25
25
  gem.add_dependency "oauth", ">= 0.4.3"
26
26
  gem.add_dependency "httpclient", ">= 2.1.5.2"
27
27
  gem.add_dependency "multipart-post", ">= 1.0.1"
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 1
3
- :minor: 4
4
- :patch: 4
5
- :build:
3
+ :minor: 5
4
+ :patch: 2
5
+ :build: !!null
@@ -12,24 +12,39 @@ module Vimeo
12
12
  "vimeo.albums.create",
13
13
  :required => [:title, :video_id],
14
14
  :optional => [:description, :videos]
15
-
15
+
16
16
  # Deletes an album.
17
17
  create_api_method :delete,
18
18
  "vimeo.albums.delete",
19
19
  :required => [:album_id]
20
-
20
+
21
21
  # Returns a list of a user's albums.
22
22
  create_api_method :get_all,
23
23
  "vimeo.albums.getAll",
24
24
  :required => [:user_id],
25
25
  :optional => [:page, :per_page, :sort]
26
-
26
+
27
27
  # Returns a list of the videos in an album.
28
28
  create_api_method :get_videos,
29
29
  "vimeo.albums.getVideos",
30
30
  :required => [:album_id],
31
31
  :optional => [:page, :per_page, :full_response, :password]
32
-
32
+
33
+ # Returns a list of videos which exist in the user's watch later album
34
+ create_api_method :get_watch_later,
35
+ "vimeo.albums.getWatchLater",
36
+ :optional => [:page, :per_page, :full_response]
37
+
38
+ # Adds a video to a user's watch later album
39
+ create_api_method :add_to_watch_later,
40
+ "vimeo.albums.addToWatchLater",
41
+ :required => [:video_id]
42
+
43
+ # Adds a video to a user's watch later album
44
+ create_api_method :remove_from_watch_later,
45
+ "vimeo.albums.removeFromWatchLater",
46
+ :required => [:video_id]
47
+
33
48
  # Removes a video from an album.
34
49
  create_api_method :remove_video,
35
50
  "vimeo.albums.removeVideo",
@@ -39,12 +54,12 @@ module Vimeo
39
54
  create_api_method :set_description,
40
55
  "vimeo.albums.setDescription",
41
56
  :required => [:album_id, :description]
42
-
57
+
43
58
  # Sets the password of an album.
44
59
  create_api_method :set_password,
45
60
  "vimeo.albums.setPassword",
46
61
  :required => [:album_id, :password]
47
-
62
+
48
63
  # Sets the title of an album.
49
64
  create_api_method :set_title,
50
65
  "vimeo.albums.setTitle",
@@ -1,7 +1,7 @@
1
1
  require 'oauth'
2
2
 
3
3
  module CreateApiMethod
4
-
4
+
5
5
  # Creates a method that calls a Vimeo Method through the Advanced API.
6
6
  #
7
7
  # @param [String] method The name of the method being created.
@@ -11,24 +11,24 @@ module CreateApiMethod
11
11
  # @option options [Array] :optional An array of optional parameters.
12
12
  def create_api_method(method, vimeo_method, options={})
13
13
  options = { :required => [], :optional => [] }.merge(options)
14
-
14
+
15
15
  method = method.to_s
16
16
  camelized_method = camelize(method, false)
17
-
17
+
18
18
  raise ArgumentError, 'Required parameters must be an array.' unless options[:required].is_a? Array
19
19
  raise ArgumentError, 'Optional parameters must be an array.' unless options[:optional].is_a? Array
20
-
20
+
21
21
  required = options[:required].map { |r| r.to_s }.join(",")
22
22
  optional = options[:optional].map { |o| ":#{o} => nil" }.join(",")
23
23
  authorized = options.fetch(:authorized, true)
24
-
24
+
25
25
  parameters = "(#{required unless required.empty?}#{',' unless required.empty?}options={#{optional}})"
26
-
26
+
27
27
  method_string = <<-method
28
28
 
29
29
  def #{method}#{parameters}
30
30
  raise ArgumentError, 'Options must be a hash.' unless options.is_a? Hash
31
-
31
+
32
32
  sig_options = {
33
33
  :method => "#{vimeo_method}",
34
34
  :format => "json"
@@ -36,19 +36,19 @@ module CreateApiMethod
36
36
 
37
37
  #{ options[:required].map { |r| "sig_options.merge! :#{r} => #{r}"}.join("\n") }
38
38
  #{ options[:optional].map { |o| "sig_options.merge! :#{o} => options[:#{o}] unless options[:#{o}].nil?" }.join("\n") }
39
-
39
+
40
40
  make_request sig_options, #{authorized ? "true" : "false"}
41
41
  end
42
-
42
+
43
43
  alias #{camelized_method} #{method}
44
-
44
+
45
45
  method
46
-
46
+
47
47
  class_eval method_string
48
48
  end
49
-
49
+
50
50
  protected
51
-
51
+
52
52
  # taken from ActiveSupport-2.3.4, activesupport/lib/active_support/inflector.rb, line 178
53
53
  def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
54
54
  if first_letter_in_uppercase
@@ -66,7 +66,7 @@ module Vimeo
66
66
 
67
67
  class Base
68
68
  extend CreateApiMethod
69
-
69
+
70
70
  ENDPOINT = "http://vimeo.com/api/rest/v2"
71
71
 
72
72
  def initialize(consumer_key, consumer_secret, options = {})
@@ -75,23 +75,23 @@ module Vimeo
75
75
  @access_token = OAuth::AccessToken.new(@oauth_consumer, options[:token], options[:secret])
76
76
  end
77
77
  end
78
-
78
+
79
79
  def authorize_url(permission = "delete")
80
80
  get_request_token.authorize_url :permission => permission
81
81
  end
82
-
82
+
83
83
  def get_request_token
84
84
  @request_token ||= @oauth_consumer.get_request_token :scheme => :header
85
85
  end
86
-
86
+
87
87
  def get_access_token(oauth_token=nil, oauth_secret=nil, oauth_verifier=nil)
88
88
  @access_token ||= OAuth::RequestToken.new(@oauth_consumer, oauth_token, oauth_secret).get_access_token :oauth_verifier => oauth_verifier
89
89
  end
90
-
90
+
91
91
  # TODO: Move this to OAuth
92
92
  create_api_method :check_access_token,
93
93
  "vimeo.oauth.checkAccessToken"
94
-
94
+
95
95
  private
96
96
 
97
97
  def make_request(options, authorized)
@@ -100,16 +100,16 @@ private
100
100
  else
101
101
  raw_response = @oauth_consumer.request(:post, Vimeo::Advanced::Base::ENDPOINT, nil, {}, options).body
102
102
  end
103
-
104
- response = MultiJson.decode(raw_response)
103
+
104
+ response = JSON.parse(raw_response)
105
105
  validate_response! response
106
106
  response
107
107
  end
108
-
108
+
109
109
  # Raises an exception if the response does contain a +stat+ different from "ok"
110
110
  def validate_response!(response)
111
111
  raise "empty response" unless response
112
-
112
+
113
113
  status = response["stat"]
114
114
  if status and status != "ok"
115
115
  error = response["err"]
@@ -18,7 +18,7 @@ module Vimeo
18
18
 
19
19
  # Performs the upload via Multipart.
20
20
  def upload
21
- endpoint = "#{task.endpoint}&chunk_id=#{index}"
21
+ endpoint = "#{task.endpoint}"
22
22
 
23
23
  response = task.oauth_consumer.request(:post, endpoint, vimeo.get_access_token, {}, {}) do |req|
24
24
  req.set_content_type("multipart/form-data", { "boundary" => MULTIPART_BOUNDARY })
@@ -29,6 +29,8 @@ module Vimeo
29
29
  def io.content_type; "application/octet-stream"; end
30
30
 
31
31
  parts = []
32
+ parts << Parts::ParamPart.new(MULTIPART_BOUNDARY, "ticket_id", task.id)
33
+ parts << Parts::ParamPart.new(MULTIPART_BOUNDARY, "chunk_id", index)
32
34
  parts << Parts::FilePart.new(MULTIPART_BOUNDARY, "file_data", io)
33
35
  parts << Parts::EpiloguePart.new(MULTIPART_BOUNDARY)
34
36
 
@@ -47,4 +49,4 @@ module Vimeo
47
49
  end
48
50
  end
49
51
  end
50
- end
52
+ end
@@ -69,7 +69,7 @@ module Vimeo
69
69
 
70
70
  # Returns a hash of the sent chunks and their respective sizes.
71
71
  def sent_chunk_sizes
72
- Hash[chunks.map { |chunk| [chunk.id, chunk.size] }]
72
+ Hash[chunks.map { |chunk| [chunk.index.to_s, chunk.size] }]
73
73
  end
74
74
 
75
75
  # Returns a of Vimeo's received chunks and their respective sizes.
@@ -82,4 +82,4 @@ module Vimeo
82
82
  end
83
83
  end
84
84
  end
85
- end
85
+ end
@@ -57,6 +57,10 @@ module Vimeo
57
57
  "vimeo.videos.getInfo",
58
58
  :required => [:video_id]
59
59
 
60
+ create_api_method :get_collections,
61
+ "vimeo.videos.getCollections",
62
+ :required => [:video_id]
63
+
60
64
  create_api_method :get_likes,
61
65
  "vimeo.videos.getLikes",
62
66
  :required => [:user_id],
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "slainer68_vimeo"
8
- s.version = "1.4.4"
8
+ s.version = "1.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Hooks"]
12
- s.date = "2012-01-18"
12
+ s.date = "2012-06-05"
13
13
  s.description = "A full featured Ruby implementation of the Vimeo API."
14
14
  s.email = "matthooks@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -49,11 +49,14 @@ Gem::Specification.new do |s|
49
49
  "lib/vimeo/simple/user.rb",
50
50
  "lib/vimeo/simple/video.rb",
51
51
  "slainer68_vimeo.gemspec",
52
+ "test/fixtures/advanced/album/add_to_watch_later.json",
52
53
  "test/fixtures/advanced/album/add_video.json",
53
54
  "test/fixtures/advanced/album/create.json",
54
55
  "test/fixtures/advanced/album/delete.json",
55
56
  "test/fixtures/advanced/album/get_all.json",
56
57
  "test/fixtures/advanced/album/get_videos.json",
58
+ "test/fixtures/advanced/album/get_watch_later.json",
59
+ "test/fixtures/advanced/album/remove_from_watch_later.json",
57
60
  "test/fixtures/advanced/album/remove_video.json",
58
61
  "test/fixtures/advanced/album/set_description.json",
59
62
  "test/fixtures/advanced/album/set_password.json",
@@ -118,6 +121,7 @@ Gem::Specification.new do |s|
118
121
  "test/fixtures/advanced/video/get_appears_in.json",
119
122
  "test/fixtures/advanced/video/get_by_tag.json",
120
123
  "test/fixtures/advanced/video/get_cast.json",
124
+ "test/fixtures/advanced/video/get_collections.json",
121
125
  "test/fixtures/advanced/video/get_comments_list.json",
122
126
  "test/fixtures/advanced/video/get_contacts_liked.json",
123
127
  "test/fixtures/advanced/video/get_contacts_uploaded.json",
@@ -198,8 +202,8 @@ Gem::Specification.new do |s|
198
202
  s.add_development_dependency(%q<shoulda>, [">= 2.11.3"])
199
203
  s.add_development_dependency(%q<fakeweb>, [">= 1.2.6"])
200
204
  s.add_development_dependency(%q<ruby-prof>, [">= 0.9.2"])
201
- s.add_runtime_dependency(%q<multi_json>, [">= 1.0.4"])
202
205
  s.add_runtime_dependency(%q<httparty>, [">= 0.4.5"])
206
+ s.add_runtime_dependency(%q<json>, [">= 1.1.9"])
203
207
  s.add_runtime_dependency(%q<oauth>, [">= 0.4.3"])
204
208
  s.add_runtime_dependency(%q<httpclient>, [">= 2.1.5.2"])
205
209
  s.add_runtime_dependency(%q<multipart-post>, [">= 1.0.1"])
@@ -207,8 +211,8 @@ Gem::Specification.new do |s|
207
211
  s.add_dependency(%q<shoulda>, [">= 2.11.3"])
208
212
  s.add_dependency(%q<fakeweb>, [">= 1.2.6"])
209
213
  s.add_dependency(%q<ruby-prof>, [">= 0.9.2"])
210
- s.add_dependency(%q<multi_json>, [">= 1.0.4"])
211
214
  s.add_dependency(%q<httparty>, [">= 0.4.5"])
215
+ s.add_dependency(%q<json>, [">= 1.1.9"])
212
216
  s.add_dependency(%q<oauth>, [">= 0.4.3"])
213
217
  s.add_dependency(%q<httpclient>, [">= 2.1.5.2"])
214
218
  s.add_dependency(%q<multipart-post>, [">= 1.0.1"])
@@ -217,8 +221,8 @@ Gem::Specification.new do |s|
217
221
  s.add_dependency(%q<shoulda>, [">= 2.11.3"])
218
222
  s.add_dependency(%q<fakeweb>, [">= 1.2.6"])
219
223
  s.add_dependency(%q<ruby-prof>, [">= 0.9.2"])
220
- s.add_dependency(%q<multi_json>, [">= 1.0.4"])
221
224
  s.add_dependency(%q<httparty>, [">= 0.4.5"])
225
+ s.add_dependency(%q<json>, [">= 1.1.9"])
222
226
  s.add_dependency(%q<oauth>, [">= 0.4.3"])
223
227
  s.add_dependency(%q<httpclient>, [">= 2.1.5.2"])
224
228
  s.add_dependency(%q<multipart-post>, [">= 1.0.1"])
@@ -0,0 +1,4 @@
1
+ {
2
+ "generated_in":"0.0085",
3
+ "stat":"ok"
4
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "on_this_page":"3",
3
+ "page":"1",
4
+ "perpage":"50",
5
+ "total":"3",
6
+ "video":[
7
+ {
8
+ "embed_privacy":"anywhere",
9
+ "id":"740598",
10
+ "is_hd":"0",
11
+ "owner":"101193",
12
+ "privacy":"anybody",
13
+ "title":"Time Lapse 2"
14
+ },
15
+ {
16
+ "embed_privacy":"anywhere",
17
+ "id":"740633",
18
+ "is_hd":"0",
19
+ "owner":"101193",
20
+ "privacy":"anybody",
21
+ "title":"Time Lapse"
22
+ },
23
+ {
24
+ "embed_privacy":"anywhere",
25
+ "id":"1016589",
26
+ "is_hd":"0",
27
+ "owner":"101193",
28
+ "privacy":"anybody",
29
+ "title":"3D Glasses"
30
+ }
31
+ ]
32
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "generated_in":"0.0085",
3
+ "stat":"ok"
4
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "generated_in":"0.0352",
3
+ "stat":"ok",
4
+ "collections":{
5
+ "collection":[
6
+ {
7
+ "id":"238",
8
+ "name":"Paragliding",
9
+ "thumbnail":"http:\/\/b.vimeocdn.com\/ts\/271\/061\/271061013_200.jpg",
10
+ "type":"group"
11
+ },
12
+ {
13
+ "id":"69227",
14
+ "name":"ACRO PARAGLIDING",
15
+ "thumbnail":"http:\/\/b.vimeocdn.com\/ts\/269\/902\/269902809_200.jpg",
16
+ "type":"group"
17
+ },
18
+ {
19
+ "id":"3886",
20
+ "name":"Paragliding",
21
+ "thumbnail":"http:\/\/b.vimeocdn.com\/ts\/261\/654\/261654324_200.jpg",
22
+ "type":"channel"
23
+ },
24
+ {
25
+ "id":"246957",
26
+ "name":"Paragliding HD",
27
+ "thumbnail":"http:\/\/b.vimeocdn.com\/ts\/270\/993\/270993310_200.jpg",
28
+ "type":"channel"
29
+ },
30
+ {
31
+ "id":"61208",
32
+ "name":"VL",
33
+ "thumbnail":"http:\/\/b.vimeocdn.com\/ts\/252\/711\/252711076_200.jpg",
34
+ "type":"album"
35
+ }
36
+ ]
37
+ },
38
+ "urls":{
39
+ "url":[
40
+ {
41
+ "type":"group",
42
+ "_content":"http:\/\/vimeo.com\/groups\/paragliding\/videos\/38054508"
43
+ },
44
+ {
45
+ "type":"group",
46
+ "_content":"http:\/\/vimeo.com\/groups\/acroparagliding\/videos\/38054508"
47
+ },
48
+ {
49
+ "type":"channel",
50
+ "_content":"http:\/\/vimeo.com\/channels\/paragliding\/38054508"
51
+ },
52
+ {
53
+ "type":"channel",
54
+ "_content":"http:\/\/vimeo.com\/channels\/paraglidinghd\/38054508"
55
+ }
56
+ ]
57
+ }
58
+ }
@@ -3,12 +3,12 @@ require 'test/unit'
3
3
 
4
4
  gem 'shoulda', ">= 2.10.2"
5
5
  gem 'fakeweb', ">= 1.2.6"
6
- gem 'multi_json', ">= 1.0.4"
6
+ gem 'crack', ">= 0.1.4"
7
7
  gem 'mocha', ">= 0.9.8"
8
8
 
9
9
  require 'shoulda'
10
10
  require 'fakeweb'
11
- require 'multi_json'
11
+ require 'Crack'
12
12
  require 'mocha'
13
13
  require 'ruby-prof'
14
14
 
@@ -43,7 +43,7 @@ def advanced_vimeo_url(url = "")
43
43
  end
44
44
 
45
45
  def stub_get(url, filename, status=nil)
46
- # FIXME: We have to specify content type, otherwise HTTParty will not parse the
46
+ # FIXME: We have to specify content type, otherwise HTTParty will not parse the
47
47
  # body correctly. Is there any way we can get around this? Or is this a limitation
48
48
  # of using FakeWeb?
49
49
  options = { :body => fixture_file(filename), :content_type => 'application/json' }
@@ -61,4 +61,4 @@ end
61
61
 
62
62
  def stub_custom_post(url, filename)
63
63
  FakeWeb.register_uri(:post, vimeo_base_url(url), :body => fixture_file(filename), :content_type => 'application/json')
64
- end
64
+ end
@@ -3,73 +3,94 @@ require 'test_helper'
3
3
  class AlbumTest < Test::Unit::TestCase
4
4
 
5
5
  context "vimeo advanced album" do
6
-
6
+
7
7
  setup do
8
8
  @album = Vimeo::Advanced::Album.new("12345", "secret", :token => "token", :secret => "secret")
9
9
  end
10
-
10
+
11
11
  should "be able to add a video to an album" do
12
12
  stub_post("?oauth_nonce=3MFt5up5QljUQKJS8u9bOPzX9DXn3Xll1vdLLV2bwo&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=SgRuPWsG%2BSHGOdw6HVbfHtqSXsY%3D", "advanced/album/add_video.json")
13
13
  response = @album.add_video("album_id", "video_id")
14
-
14
+
15
15
  assert_equal "ok", response["stat"]
16
16
  end
17
-
17
+
18
18
  should "be able to create an album" do
19
19
  stub_post("?oauth_nonce=UkAfw5mrHZ2RiYl85vBxd9dGlpdOB1HiMs7ZXa7YGE&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=ZTGMAKrk4voVelv9Hzu2XzwlKbo%3D", "advanced/album/create.json")
20
20
  response = @album.create("title", "video_id")
21
-
21
+
22
22
  assert_equal "129683", response["album"]["id"]
23
23
  end
24
-
24
+
25
25
  should "be able to delete an album" do
26
26
  stub_post("?oauth_nonce=zyARBYynTJnBn9HiiKTQAGRVuDymj5kUkH72JPE9IBE&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=14SAeavDzDfbO6XY%2Bd4a05kJGGs%3D", "advanced/album/delete.json")
27
27
  response = @album.delete("album_id")
28
-
28
+
29
29
  assert_equal "ok", response["stat"]
30
30
  end
31
-
31
+
32
32
  should "be able to get a list of a user's albums" do
33
33
  stub_post("?oauth_nonce=4wZJ82yZnNtdnu4ccKaxBpAnyDLvf9xfiH4RrgRgK8o&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=KDczd%2F%2BEjPW64v0r6IbYL%2BJYcYs%3D", "advanced/album/get_all.json")
34
34
  response = @album.get_all("user_id")
35
-
35
+
36
36
  assert_equal "3", response["albums"]["total"]
37
37
  end
38
-
38
+
39
39
  should "be able to list the videos in an album" do
40
40
  stub_post("?oauth_nonce=yCIHyp8VXtFtxVzuKwMbHMwV7Z2eqKxDEeRTgOkwc&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=TwPJGzgvrYB4vOzyUKJueNTLMcI%3D", "advanced/album/get_videos.json")
41
41
  response = @album.get_videos("album_id")
42
-
42
+
43
43
  assert_equal "2", response["videos"]["total"]
44
44
  end
45
-
45
+
46
46
  should "be able to remove a video from an album" do
47
47
  stub_post("?oauth_nonce=fKXbUdxBFZoynegg9zzE0DS0AzhaHcNcOclSEo0&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=tztcS72SjTJxyioP3JN7KgQVUSI%3D", "advanced/album/remove_video.json")
48
48
  response = @album.remove_video("album_id", "video_id")
49
-
49
+
50
50
  assert_equal "ok", response["stat"]
51
51
  end
52
-
52
+
53
53
  should "be able to set the description of an album" do
54
54
  stub_post("?oauth_nonce=45zc84rri7doHXSDHtk5w3nDpfVU8EIj3do8z23tld8&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=xTB0pnxTlZsr1P42cpfFZ50EnkA%3D", "advanced/album/set_description.json")
55
55
  response = @album.set_description("album_id", "description")
56
-
56
+
57
57
  assert_equal "ok", response["stat"]
58
58
  end
59
-
59
+
60
60
  should "be able to set the password of an album" do
61
61
  stub_post("?oauth_nonce=ctucSZ9WBeP6lkmcmjT8tEmvQu5AJS7K5OZReGSzMk&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=7YcUkFMRryJAYRZGpBj47JFoFsQ%3D", "advanced/album/set_password.json")
62
62
  response = @album.set_password("album_id", "password")
63
-
63
+
64
64
  assert_equal "ok", response["stat"]
65
65
  end
66
-
66
+
67
67
  should "be able to set the title of an album" do
68
68
  stub_post("?oauth_nonce=nqVTjX53HqEvBR43v2qloK90TBJHbU7N7SdlisWHNGk&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=CpnakG4IBSfugNsi%2FUeVSN9zGu0%3D", "advanced/album/set_title.json")
69
69
  response = @album.set_title("album_id", "title")
70
-
70
+
71
71
  assert_equal "ok", response["stat"]
72
72
  end
73
-
73
+
74
+ should "be able to get a list of a user's videos in his watch later album" do
75
+ stub_post("?oauth_nonce=nqVTjX53HqEvBR43v2qloK90TBJHbU7N7SdlisWHNGk&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=CpnakG4IBSfugNsi%2FUeVSN9zGu0%3D", "advanced/album/get_watch_later.json")
76
+ response = @album.get_watch_later
77
+
78
+ assert_equal "3", response["total"]
79
+ end
80
+
81
+ should "be able to add a video to a user's watch later album" do
82
+ stub_post("?oauth_nonce=nqVTjX53HqEvBR43v2qloK90TBJHbU7N7SdlisWHNGk&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=CpnakG4IBSfugNsi%2FUeVSN9zGu0%3D", "advanced/album/add_to_watch_later.json")
83
+ response = @album.add_to_watch_later("video_id")
84
+
85
+ assert_equal "ok", response["stat"]
86
+ end
87
+
88
+ should "be able to remove a video from a user's watch later album" do
89
+ stub_post("?oauth_nonce=nqVTjX53HqEvBR43v2qloK90TBJHbU7N7SdlisWHNGk&oauth_signature_method=HMAC-SHA1&oauth_token=token&oauth_timestamp=1261345197&oauth_consumer_key=12345&oauth_version=1.0&oauth_signature=CpnakG4IBSfugNsi%2FUeVSN9zGu0%3D", "advanced/album/remove_from_watch_later.json")
90
+ response = @album.remove_from_watch_later("video_id")
91
+
92
+ assert_equal "ok", response["stat"]
93
+ end
94
+
74
95
  end
75
96
  end
@@ -85,6 +85,13 @@ class VideoTest < Test::Unit::TestCase
85
85
  assert_equal "ok", response["stat"]
86
86
  end
87
87
 
88
+ should "be able to get collections for a video" do
89
+ stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.getCollections&api_sig=0f1a7df7325961a0cf352da6264e913f", "advanced/video/get_collections.json")
90
+ response = @video.get_info("video_id")
91
+
92
+ assert_equal "ok", response["stat"]
93
+ end
94
+
88
95
  should "be able to get info about a video" do
89
96
  stub_post("?video_id=video_id&api_key=12345&format=json&method=vimeo.videos.getInfo&api_sig=0f1a7df7325961a0cf352da6264e913f", "advanced/video/get_info.json")
90
97
  response = @video.get_info("video_id")
@@ -1,76 +1,76 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class UserTest < Test::Unit::TestCase
4
-
4
+
5
5
  context "vimeo simple user" do
6
-
6
+
7
7
  setup do
8
8
  @user_name = "blakewhitman"
9
9
  end
10
-
10
+
11
11
  context "making api calls" do
12
-
12
+
13
13
  should "be able to get info for a user" do
14
14
  stub_get("/#{@user_name}/info.json", "simple/user/info.json")
15
15
  info = Vimeo::Simple::User.info(@user_name)
16
-
16
+
17
17
  assert_equal "Blake Whitman", info["display_name"]
18
18
  end
19
-
19
+
20
20
  should "be able to get videos created by a user" do
21
- stub_get("/#{@user_name}/videos.json", "simple/user/videos.json")
21
+ stub_get("/#{@user_name}/videos.json?page=1", "simple/user/videos.json")
22
22
  videos = Vimeo::Simple::User.videos(@user_name)
23
-
23
+
24
24
  assert_equal 20, videos.size
25
25
  first = videos.first
26
26
  assert_equal "pulse", first["title"]
27
27
  end
28
-
28
+
29
29
  should "be able to get videos a user likes" do
30
30
  stub_get("/#{@user_name}/likes.json", "simple/user/likes.json")
31
31
  videos = Vimeo::Simple::User.likes(@user_name)
32
-
32
+
33
33
  assert_equal 20, videos.size
34
34
  first = videos.first
35
35
  assert_equal "Seed", first["title"]
36
36
  end
37
-
37
+
38
38
  should "be able to get videos that a user appears in" do
39
39
  stub_get("/#{@user_name}/appears_in.json", "simple/user/appears_in.json")
40
40
  videos = Vimeo::Simple::User.appears_in(@user_name)
41
-
41
+
42
42
  assert_equal 20, videos.size
43
43
  first = videos.first
44
44
  assert_equal "Vimeo Offline Party: London", first["title"]
45
45
  end
46
-
46
+
47
47
  should "be able to get videos that a user appears in and/or created" do
48
48
  stub_get("/#{@user_name}/all_videos.json", "simple/user/all_videos.json")
49
49
  videos = Vimeo::Simple::User.all_videos(@user_name)
50
-
50
+
51
51
  assert_equal 20, videos.size
52
52
  first = videos.first
53
53
  assert_equal "Vimeo Offline Party: London", first["title"]
54
54
  end
55
-
55
+
56
56
  should "be able to get videos a user is subscribed to" do
57
57
  stub_get("/#{@user_name}/subscriptions.json", "simple/user/subscriptions.json")
58
58
  videos = Vimeo::Simple::User.subscriptions(@user_name)
59
-
59
+
60
60
  assert_equal 20, videos.size
61
61
  first = videos.first
62
62
  assert_equal "TIDES - HD", first["title"]
63
63
  end
64
-
64
+
65
65
  should "be able to get albums a user has created" do
66
66
  stub_get("/#{@user_name}/albums.json", "simple/user/albums.json")
67
67
  albums = Vimeo::Simple::User.albums(@user_name)
68
-
68
+
69
69
  assert_equal 30, albums.size
70
70
  first = albums.first
71
71
  assert_equal "Amigos", first["title"]
72
72
  end
73
-
73
+
74
74
  should "be able to get channels a user has created and subscribed to" do
75
75
  stub_get("/#{@user_name}/channels.json", "simple/user/channels.json")
76
76
  channels = Vimeo::Simple::User.channels(@user_name)
@@ -79,34 +79,34 @@ class UserTest < Test::Unit::TestCase
79
79
  first = channels.first
80
80
  assert_equal "01SHORTFILM ______ Only the best, international, award-winning, CINEMATIC shortfilms", first["name"]
81
81
  end
82
-
82
+
83
83
  should "be able to get groups that a user either created and/or joined" do
84
84
  stub_get("/#{@user_name}/groups.json", "simple/user/groups.json")
85
85
  groups = Vimeo::Simple::User.groups(@user_name)
86
-
86
+
87
87
  assert_equal 97, groups.size
88
88
  first = groups.first
89
89
  assert_equal "3D Animation", first["name"]
90
90
  end
91
-
91
+
92
92
  should "be able to get videos that a user's contacts created" do
93
93
  stub_get("/#{@user_name}/contacts_videos.json", "simple/user/contacts_videos.json")
94
94
  videos = Vimeo::Simple::User.contacts_videos(@user_name)
95
-
95
+
96
96
  assert_equal 20, videos.size
97
97
  first = videos.first
98
98
  assert_equal "Star Wars Uncut - Scene 90", first["title"]
99
99
  end
100
-
100
+
101
101
  should "be able to get videos that a user's contacts liked" do
102
102
  stub_get("/#{@user_name}/contacts_like.json", "simple/user/contacts_like.json")
103
103
  videos = Vimeo::Simple::User.contacts_like(@user_name)
104
-
104
+
105
105
  assert_equal 20, videos.size
106
106
  first = videos.first
107
107
  assert_equal "Jaybilizer 3000 Camera Stabilizer Shooting Techniques and Montage", first["title"]
108
108
  end
109
-
109
+
110
110
  end
111
111
  end
112
112
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slainer68_vimeo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-18 00:00:00.000000000 Z
12
+ date: 2012-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda
16
- requirement: &70344812828540 !ruby/object:Gem::Requirement
16
+ requirement: &70174093343880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.11.3
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70344812828540
24
+ version_requirements: *70174093343880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: fakeweb
27
- requirement: &70344812828040 !ruby/object:Gem::Requirement
27
+ requirement: &70174093343380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.2.6
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70344812828040
35
+ version_requirements: *70174093343380
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ruby-prof
38
- requirement: &70344812827520 !ruby/object:Gem::Requirement
38
+ requirement: &70174093342900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,32 +43,32 @@ dependencies:
43
43
  version: 0.9.2
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70344812827520
46
+ version_requirements: *70174093342900
47
47
  - !ruby/object:Gem::Dependency
48
- name: multi_json
49
- requirement: &70344812826800 !ruby/object:Gem::Requirement
48
+ name: httparty
49
+ requirement: &70174093342420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.4
54
+ version: 0.4.5
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70344812826800
57
+ version_requirements: *70174093342420
58
58
  - !ruby/object:Gem::Dependency
59
- name: httparty
60
- requirement: &70344812826300 !ruby/object:Gem::Requirement
59
+ name: json
60
+ requirement: &70174093341920 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
64
64
  - !ruby/object:Gem::Version
65
- version: 0.4.5
65
+ version: 1.1.9
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70344812826300
68
+ version_requirements: *70174093341920
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: oauth
71
- requirement: &70344812825820 !ruby/object:Gem::Requirement
71
+ requirement: &70174093341440 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.4.3
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70344812825820
79
+ version_requirements: *70174093341440
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: httpclient
82
- requirement: &70344812824620 !ruby/object:Gem::Requirement
82
+ requirement: &70174093340960 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 2.1.5.2
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70344812824620
90
+ version_requirements: *70174093340960
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: multipart-post
93
- requirement: &70344812823280 !ruby/object:Gem::Requirement
93
+ requirement: &70174093340480 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: 1.0.1
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70344812823280
101
+ version_requirements: *70174093340480
102
102
  description: A full featured Ruby implementation of the Vimeo API.
103
103
  email: matthooks@gmail.com
104
104
  executables: []
@@ -139,11 +139,14 @@ files:
139
139
  - lib/vimeo/simple/user.rb
140
140
  - lib/vimeo/simple/video.rb
141
141
  - slainer68_vimeo.gemspec
142
+ - test/fixtures/advanced/album/add_to_watch_later.json
142
143
  - test/fixtures/advanced/album/add_video.json
143
144
  - test/fixtures/advanced/album/create.json
144
145
  - test/fixtures/advanced/album/delete.json
145
146
  - test/fixtures/advanced/album/get_all.json
146
147
  - test/fixtures/advanced/album/get_videos.json
148
+ - test/fixtures/advanced/album/get_watch_later.json
149
+ - test/fixtures/advanced/album/remove_from_watch_later.json
147
150
  - test/fixtures/advanced/album/remove_video.json
148
151
  - test/fixtures/advanced/album/set_description.json
149
152
  - test/fixtures/advanced/album/set_password.json
@@ -208,6 +211,7 @@ files:
208
211
  - test/fixtures/advanced/video/get_appears_in.json
209
212
  - test/fixtures/advanced/video/get_by_tag.json
210
213
  - test/fixtures/advanced/video/get_cast.json
214
+ - test/fixtures/advanced/video/get_collections.json
211
215
  - test/fixtures/advanced/video/get_comments_list.json
212
216
  - test/fixtures/advanced/video/get_contacts_liked.json
213
217
  - test/fixtures/advanced/video/get_contacts_uploaded.json