vimeo 1.4.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -1
- data/VERSION.yml +2 -2
- data/lib/vimeo/advanced/album.rb +21 -6
- data/lib/vimeo/advanced/base.rb +23 -23
- data/test/fixtures/advanced/album/add_to_watch_later.json +4 -0
- data/test/fixtures/advanced/album/get_watch_later.json +32 -0
- data/test/fixtures/advanced/album/remove_from_watch_later.json +4 -0
- data/test/test_helper.rb +3 -3
- data/test/vimeo/advanced/album_test.rb +41 -20
- data/test/vimeo/simple/user_test.rb +26 -26
- data/vimeo.gemspec +5 -5
- metadata +21 -29
data/Rakefile
CHANGED
@@ -13,7 +13,6 @@ begin
|
|
13
13
|
gem.rubyforge_project = "vimeo"
|
14
14
|
gem.add_development_dependency "shoulda", ">= 2.11.3"
|
15
15
|
gem.add_development_dependency "fakeweb", ">= 1.2.6"
|
16
|
-
gem.add_development_dependency "crack", ">= 0.1.4"
|
17
16
|
gem.add_development_dependency "ruby-prof", ">= 0.9.2"
|
18
17
|
|
19
18
|
gem.has_rdoc = true
|
data/VERSION.yml
CHANGED
data/lib/vimeo/advanced/album.rb
CHANGED
@@ -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",
|
data/lib/vimeo/advanced/base.rb
CHANGED
@@ -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 =
|
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"]
|
@@ -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
|
+
}
|
data/test/test_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'test/unit'
|
3
3
|
|
4
|
-
gem '
|
4
|
+
gem 'shoulda', ">= 2.10.2"
|
5
5
|
gem 'fakeweb', ">= 1.2.6"
|
6
6
|
gem 'crack', ">= 0.1.4"
|
7
7
|
gem 'mocha', ">= 0.9.8"
|
@@ -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
|
@@ -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
|
data/vimeo.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "vimeo"
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.5.0"
|
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 = "
|
12
|
+
s.date = "2012-02-08"
|
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 = [
|
@@ -48,11 +48,14 @@ Gem::Specification.new do |s|
|
|
48
48
|
"lib/vimeo/simple/group.rb",
|
49
49
|
"lib/vimeo/simple/user.rb",
|
50
50
|
"lib/vimeo/simple/video.rb",
|
51
|
+
"test/fixtures/advanced/album/add_to_watch_later.json",
|
51
52
|
"test/fixtures/advanced/album/add_video.json",
|
52
53
|
"test/fixtures/advanced/album/create.json",
|
53
54
|
"test/fixtures/advanced/album/delete.json",
|
54
55
|
"test/fixtures/advanced/album/get_all.json",
|
55
56
|
"test/fixtures/advanced/album/get_videos.json",
|
57
|
+
"test/fixtures/advanced/album/get_watch_later.json",
|
58
|
+
"test/fixtures/advanced/album/remove_from_watch_later.json",
|
56
59
|
"test/fixtures/advanced/album/remove_video.json",
|
57
60
|
"test/fixtures/advanced/album/set_description.json",
|
58
61
|
"test/fixtures/advanced/album/set_password.json",
|
@@ -197,7 +200,6 @@ Gem::Specification.new do |s|
|
|
197
200
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
198
201
|
s.add_development_dependency(%q<shoulda>, [">= 2.11.3"])
|
199
202
|
s.add_development_dependency(%q<fakeweb>, [">= 1.2.6"])
|
200
|
-
s.add_development_dependency(%q<crack>, [">= 0.1.4"])
|
201
203
|
s.add_development_dependency(%q<ruby-prof>, [">= 0.9.2"])
|
202
204
|
s.add_runtime_dependency(%q<httparty>, [">= 0.4.5"])
|
203
205
|
s.add_runtime_dependency(%q<json>, [">= 1.1.9"])
|
@@ -207,7 +209,6 @@ Gem::Specification.new do |s|
|
|
207
209
|
else
|
208
210
|
s.add_dependency(%q<shoulda>, [">= 2.11.3"])
|
209
211
|
s.add_dependency(%q<fakeweb>, [">= 1.2.6"])
|
210
|
-
s.add_dependency(%q<crack>, [">= 0.1.4"])
|
211
212
|
s.add_dependency(%q<ruby-prof>, [">= 0.9.2"])
|
212
213
|
s.add_dependency(%q<httparty>, [">= 0.4.5"])
|
213
214
|
s.add_dependency(%q<json>, [">= 1.1.9"])
|
@@ -218,7 +219,6 @@ Gem::Specification.new do |s|
|
|
218
219
|
else
|
219
220
|
s.add_dependency(%q<shoulda>, [">= 2.11.3"])
|
220
221
|
s.add_dependency(%q<fakeweb>, [">= 1.2.6"])
|
221
|
-
s.add_dependency(%q<crack>, [">= 0.1.4"])
|
222
222
|
s.add_dependency(%q<ruby-prof>, [">= 0.9.2"])
|
223
223
|
s.add_dependency(%q<httparty>, [">= 0.4.5"])
|
224
224
|
s.add_dependency(%q<json>, [">= 1.1.9"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vimeo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
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:
|
12
|
+
date: 2012-02-08 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &2161661300 !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: *
|
24
|
+
version_requirements: *2161661300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: fakeweb
|
27
|
-
requirement: &
|
27
|
+
requirement: &2161660760 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,21 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.2.6
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: crack
|
38
|
-
requirement: &2153199420 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ! '>='
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 0.1.4
|
44
|
-
type: :development
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *2153199420
|
35
|
+
version_requirements: *2161660760
|
47
36
|
- !ruby/object:Gem::Dependency
|
48
37
|
name: ruby-prof
|
49
|
-
requirement: &
|
38
|
+
requirement: &2161660100 !ruby/object:Gem::Requirement
|
50
39
|
none: false
|
51
40
|
requirements:
|
52
41
|
- - ! '>='
|
@@ -54,10 +43,10 @@ dependencies:
|
|
54
43
|
version: 0.9.2
|
55
44
|
type: :development
|
56
45
|
prerelease: false
|
57
|
-
version_requirements: *
|
46
|
+
version_requirements: *2161660100
|
58
47
|
- !ruby/object:Gem::Dependency
|
59
48
|
name: httparty
|
60
|
-
requirement: &
|
49
|
+
requirement: &2161659620 !ruby/object:Gem::Requirement
|
61
50
|
none: false
|
62
51
|
requirements:
|
63
52
|
- - ! '>='
|
@@ -65,10 +54,10 @@ dependencies:
|
|
65
54
|
version: 0.4.5
|
66
55
|
type: :runtime
|
67
56
|
prerelease: false
|
68
|
-
version_requirements: *
|
57
|
+
version_requirements: *2161659620
|
69
58
|
- !ruby/object:Gem::Dependency
|
70
59
|
name: json
|
71
|
-
requirement: &
|
60
|
+
requirement: &2161658900 !ruby/object:Gem::Requirement
|
72
61
|
none: false
|
73
62
|
requirements:
|
74
63
|
- - ! '>='
|
@@ -76,10 +65,10 @@ dependencies:
|
|
76
65
|
version: 1.1.9
|
77
66
|
type: :runtime
|
78
67
|
prerelease: false
|
79
|
-
version_requirements: *
|
68
|
+
version_requirements: *2161658900
|
80
69
|
- !ruby/object:Gem::Dependency
|
81
70
|
name: oauth
|
82
|
-
requirement: &
|
71
|
+
requirement: &2161658300 !ruby/object:Gem::Requirement
|
83
72
|
none: false
|
84
73
|
requirements:
|
85
74
|
- - ! '>='
|
@@ -87,10 +76,10 @@ dependencies:
|
|
87
76
|
version: 0.4.3
|
88
77
|
type: :runtime
|
89
78
|
prerelease: false
|
90
|
-
version_requirements: *
|
79
|
+
version_requirements: *2161658300
|
91
80
|
- !ruby/object:Gem::Dependency
|
92
81
|
name: httpclient
|
93
|
-
requirement: &
|
82
|
+
requirement: &2161657760 !ruby/object:Gem::Requirement
|
94
83
|
none: false
|
95
84
|
requirements:
|
96
85
|
- - ! '>='
|
@@ -98,10 +87,10 @@ dependencies:
|
|
98
87
|
version: 2.1.5.2
|
99
88
|
type: :runtime
|
100
89
|
prerelease: false
|
101
|
-
version_requirements: *
|
90
|
+
version_requirements: *2161657760
|
102
91
|
- !ruby/object:Gem::Dependency
|
103
92
|
name: multipart-post
|
104
|
-
requirement: &
|
93
|
+
requirement: &2161657060 !ruby/object:Gem::Requirement
|
105
94
|
none: false
|
106
95
|
requirements:
|
107
96
|
- - ! '>='
|
@@ -109,7 +98,7 @@ dependencies:
|
|
109
98
|
version: 1.0.1
|
110
99
|
type: :runtime
|
111
100
|
prerelease: false
|
112
|
-
version_requirements: *
|
101
|
+
version_requirements: *2161657060
|
113
102
|
description: A full featured Ruby implementation of the Vimeo API.
|
114
103
|
email: matthooks@gmail.com
|
115
104
|
executables: []
|
@@ -149,11 +138,14 @@ files:
|
|
149
138
|
- lib/vimeo/simple/group.rb
|
150
139
|
- lib/vimeo/simple/user.rb
|
151
140
|
- lib/vimeo/simple/video.rb
|
141
|
+
- test/fixtures/advanced/album/add_to_watch_later.json
|
152
142
|
- test/fixtures/advanced/album/add_video.json
|
153
143
|
- test/fixtures/advanced/album/create.json
|
154
144
|
- test/fixtures/advanced/album/delete.json
|
155
145
|
- test/fixtures/advanced/album/get_all.json
|
156
146
|
- test/fixtures/advanced/album/get_videos.json
|
147
|
+
- test/fixtures/advanced/album/get_watch_later.json
|
148
|
+
- test/fixtures/advanced/album/remove_from_watch_later.json
|
157
149
|
- test/fixtures/advanced/album/remove_video.json
|
158
150
|
- test/fixtures/advanced/album/set_description.json
|
159
151
|
- test/fixtures/advanced/album/set_password.json
|