matthooks-vimeo 0.2.0 → 0.2.1
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/CHANGELOG.rdoc +4 -0
- data/VERSION.yml +4 -0
- data/lib/vimeo/advanced/auth.rb +36 -0
- data/lib/vimeo/advanced/base.rb +59 -0
- data/lib/vimeo/advanced/contact.rb +18 -0
- data/lib/vimeo/advanced/group.rb +19 -0
- data/lib/vimeo/advanced/person.rb +105 -0
- data/lib/vimeo/advanced/test.rb +40 -0
- data/lib/vimeo/advanced/upload.rb +28 -0
- data/lib/vimeo/advanced/video.rb +327 -0
- data/lib/vimeo/advanced.rb +11 -0
- data/lib/vimeo/simple/activity.rb +27 -0
- data/lib/vimeo/simple/album.rb +17 -0
- data/lib/vimeo/simple/base.rb +12 -0
- data/lib/vimeo/simple/channel.rb +17 -0
- data/lib/vimeo/simple/clip.rb +12 -0
- data/lib/vimeo/simple/group.rb +22 -0
- data/lib/vimeo/simple/user.rb +62 -0
- data/lib/vimeo/simple.rb +14 -0
- data/lib/vimeo.rb +12 -0
- data/test/test_helper.rb +7 -0
- data/test/vimeo_test.rb +7 -0
- metadata +27 -3
data/CHANGELOG.rdoc
CHANGED
data/VERSION.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Advanced
|
3
|
+
|
4
|
+
class Auth < Vimeo::Advanced::Base
|
5
|
+
# Obtains an authorization token.
|
6
|
+
def get_token(frob)
|
7
|
+
sig_options = {
|
8
|
+
:frob => frob,
|
9
|
+
:method => "vimeo.auth.getToken"
|
10
|
+
}
|
11
|
+
|
12
|
+
make_request sig_options
|
13
|
+
end
|
14
|
+
|
15
|
+
# Obtains a frob.
|
16
|
+
# Used for desktop based authentication.
|
17
|
+
def get_frob
|
18
|
+
sig_options = { :method => "vimeo.auth.getFrob" }
|
19
|
+
|
20
|
+
make_request sig_options
|
21
|
+
end
|
22
|
+
|
23
|
+
# Tests the validity of an authorization token.
|
24
|
+
def check_token(auth_token)
|
25
|
+
sig_options = {
|
26
|
+
:auth_token => auth_token,
|
27
|
+
:method => "vimeo.auth.checkToken"
|
28
|
+
}
|
29
|
+
|
30
|
+
make_request sig_options
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end # Advanced
|
36
|
+
end # Vimeo
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Advanced
|
3
|
+
|
4
|
+
class Base
|
5
|
+
include HTTParty
|
6
|
+
base_uri 'vimeo.com'
|
7
|
+
|
8
|
+
# TODO: Pass an auth token, if you've already got one
|
9
|
+
# TODO: implement format_options
|
10
|
+
# Requires your API key and secret phrase.
|
11
|
+
# The API key and secret are prepended to every request.
|
12
|
+
def initialize(api_key, secret, format_options={})
|
13
|
+
@auth = { :api_key => api_key }
|
14
|
+
@secret = secret
|
15
|
+
end
|
16
|
+
|
17
|
+
# Generates a link that allows a user to authorize
|
18
|
+
# your web application to use the advanced API
|
19
|
+
def login_link(perms)
|
20
|
+
api_sig = generate_api_sig :perms => perms
|
21
|
+
"http://vimeo.com/services/auth/?api_key=#{@auth[:api_key]}&perms=#{perms}&api_sig=#{api_sig}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# TODO: Implement a function that returns the correct upload URL
|
25
|
+
|
26
|
+
# Generates the proper API signature for a file upload.
|
27
|
+
def upload_sig(ticket_id, auth_token)
|
28
|
+
sig_options = {
|
29
|
+
:ticket_id => ticket_id,
|
30
|
+
:auth_token => auth_token
|
31
|
+
}
|
32
|
+
|
33
|
+
generate_api_sig sig_options
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
# Generates a MD5 hashed API signature for Advanced API requests
|
39
|
+
def generate_api_sig(options={})
|
40
|
+
# Every request requires the api_key parameter
|
41
|
+
options.merge! @auth
|
42
|
+
# Keys must be sorted alphabetically
|
43
|
+
api_sig = options.sort { |a, b| a.to_s <=> b.to_s }.join
|
44
|
+
Digest::MD5.hexdigest("#{@secret}#{api_sig}")
|
45
|
+
end
|
46
|
+
|
47
|
+
def query(sig_options, api_sig)
|
48
|
+
sig_options.merge :api_key => @auth[:api_key], :api_sig => api_sig
|
49
|
+
end
|
50
|
+
|
51
|
+
def make_request(sig_options)
|
52
|
+
api_sig = generate_api_sig sig_options
|
53
|
+
self.class.post "/api/rest", :query => query(sig_options, api_sig)
|
54
|
+
end
|
55
|
+
|
56
|
+
end # Base
|
57
|
+
|
58
|
+
end # Advanced
|
59
|
+
end # Vimeo
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Advanced
|
3
|
+
|
4
|
+
class Contact < Vimeo::Advanced::Base
|
5
|
+
|
6
|
+
def get_list(user_id)
|
7
|
+
sig_options = {
|
8
|
+
:user_id => user_id,
|
9
|
+
:method => "vimeo.contacts.getList"
|
10
|
+
}
|
11
|
+
|
12
|
+
make_request sig_options
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end # Advanced
|
18
|
+
end # Vimeo
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Advanced
|
3
|
+
|
4
|
+
class Group < Vimeo::Advanced::Base
|
5
|
+
|
6
|
+
# Fixme: Only takes group_id as int, not group name
|
7
|
+
def get_members(group_id)
|
8
|
+
sig_options = {
|
9
|
+
:group_id => group_id,
|
10
|
+
:method => "vimeo.groups.getMembers"
|
11
|
+
}
|
12
|
+
|
13
|
+
make_request sig_options
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end # Advanced
|
19
|
+
end # Vimeo
|
@@ -0,0 +1,105 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Advanced
|
3
|
+
|
4
|
+
class Person < Vimeo::Advanced::Base
|
5
|
+
|
6
|
+
def find_by_user_name(username)
|
7
|
+
sig_options = {
|
8
|
+
:username => username,
|
9
|
+
:method => "vimeo.people.findByUserName"
|
10
|
+
}
|
11
|
+
|
12
|
+
make_request sig_options
|
13
|
+
end
|
14
|
+
|
15
|
+
def find_by_email(find_email)
|
16
|
+
sig_options = {
|
17
|
+
:find_email => find_email,
|
18
|
+
:method => "vimeo.people.findByEmail"
|
19
|
+
}
|
20
|
+
|
21
|
+
make_request sig_options
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_info(user_id)
|
25
|
+
sig_options = {
|
26
|
+
:user_id => user_id,
|
27
|
+
:method => "vimeo.people.getInfo"
|
28
|
+
}
|
29
|
+
|
30
|
+
make_request sig_options
|
31
|
+
end
|
32
|
+
|
33
|
+
# TODO: This seems to be returning nil from Vimeo... not implemented?
|
34
|
+
def get_portrait_url(user_id, options={})
|
35
|
+
size = options[:size]
|
36
|
+
|
37
|
+
sig_options = {
|
38
|
+
:user_id => user_id,
|
39
|
+
:method => "vimeo.people.getPortraitUrl"
|
40
|
+
}
|
41
|
+
sig_options.merge! :size => size unless size.nil?
|
42
|
+
|
43
|
+
make_request sig_options
|
44
|
+
end
|
45
|
+
|
46
|
+
# TODO: Not working on Vimeo's side
|
47
|
+
def add_contact(user_id, auth_token)
|
48
|
+
sig_options = {
|
49
|
+
:user_id => user_id,
|
50
|
+
:auth_token => auth_token,
|
51
|
+
:method => "vimeo.people.addContact"
|
52
|
+
}
|
53
|
+
|
54
|
+
make_request sig_options
|
55
|
+
end
|
56
|
+
|
57
|
+
# TODO: Not working on Vimeo's side
|
58
|
+
def remove_contact(user_id, auth_token)
|
59
|
+
sig_options = {
|
60
|
+
:user_id => user_id,
|
61
|
+
:auth_token => auth_token,
|
62
|
+
:method => "vimeo.people.removeContact"
|
63
|
+
}
|
64
|
+
|
65
|
+
make_request sig_options
|
66
|
+
end
|
67
|
+
|
68
|
+
def get_upload_status(user_id, auth_token)
|
69
|
+
sig_options = {
|
70
|
+
:user_id => user_id,
|
71
|
+
:auth_token => auth_token,
|
72
|
+
:method => "vimeo.people.getUploadStatus"
|
73
|
+
}
|
74
|
+
|
75
|
+
make_request sig_options
|
76
|
+
end
|
77
|
+
|
78
|
+
# TODO: Verify input for type?
|
79
|
+
def add_subscription(user_id, type, auth_token)
|
80
|
+
sig_options = {
|
81
|
+
:user_id => user_id,
|
82
|
+
:type => type,
|
83
|
+
:auth_token => auth_token,
|
84
|
+
:method => "vimeo.people.addSubscription"
|
85
|
+
}
|
86
|
+
|
87
|
+
make_request sig_options
|
88
|
+
end
|
89
|
+
|
90
|
+
# TODO: Verify input for type?
|
91
|
+
def remove_subscription(user_id, type, auth_token)
|
92
|
+
sig_options = {
|
93
|
+
:user_id => user_id,
|
94
|
+
:type => type,
|
95
|
+
:auth_token => auth_token,
|
96
|
+
:method => "vimeo.people.removeSubscription"
|
97
|
+
}
|
98
|
+
|
99
|
+
make_request sig_options
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
end # Advanced
|
105
|
+
end # Vimeo
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Advanced
|
3
|
+
|
4
|
+
class Test < Vimeo::Advanced::Base
|
5
|
+
# An echo test. Echoes all parameters.
|
6
|
+
# Options can be anything except method, api_key,
|
7
|
+
# and api_sig -- if any of these options are
|
8
|
+
# present they will be overwritten by the proper
|
9
|
+
# values.
|
10
|
+
def echo(options={})
|
11
|
+
options.merge!(:method => "vimeo.test.echo")
|
12
|
+
api_sig = generate_api_sig options
|
13
|
+
options.merge!(:api_sig => api_sig)
|
14
|
+
self.class.post("/api/rest", :query => options)
|
15
|
+
end
|
16
|
+
|
17
|
+
# A null test.
|
18
|
+
def null(auth_token)
|
19
|
+
sig_options = {
|
20
|
+
:auth_token => auth_token,
|
21
|
+
:method => "vimeo.test.null"
|
22
|
+
}
|
23
|
+
|
24
|
+
make_request sig_options
|
25
|
+
end
|
26
|
+
|
27
|
+
# Tests if the user associated to this token
|
28
|
+
# is able to make authenticated calls.
|
29
|
+
def login(auth_token)
|
30
|
+
sig_options = {
|
31
|
+
:auth_token => auth_token,
|
32
|
+
:method => "vimeo.test.login"
|
33
|
+
}
|
34
|
+
|
35
|
+
make_request sig_options
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end # Advanced
|
40
|
+
end # Vimeo
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Advanced
|
3
|
+
|
4
|
+
class Upload < Vimeo::Advanced::Base
|
5
|
+
|
6
|
+
def get_upload_ticket(auth_token)
|
7
|
+
sig_options = {
|
8
|
+
:auth_token => auth_token,
|
9
|
+
:method => "vimeo.videos.getUploadTicket"
|
10
|
+
}
|
11
|
+
|
12
|
+
make_request sig_options
|
13
|
+
end
|
14
|
+
|
15
|
+
def check_upload_status(ticket_id, auth_token)
|
16
|
+
sig_options = {
|
17
|
+
:ticket_id => ticket_id,
|
18
|
+
:auth_token => auth_token,
|
19
|
+
:method => "vimeo.videos.checkUploadStatus"
|
20
|
+
}
|
21
|
+
|
22
|
+
make_request sig_options
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end # Advanced
|
28
|
+
end # Vimeo
|
@@ -0,0 +1,327 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Advanced
|
3
|
+
|
4
|
+
class Video < Vimeo::Advanced::Base
|
5
|
+
|
6
|
+
def get_list(user_id, options={ :page => 1, :per_page => 25, :full_response => 0 })
|
7
|
+
sig_options = {
|
8
|
+
:user_id => user_id,
|
9
|
+
:page => options[:page],
|
10
|
+
:per_page => options[:per_page],
|
11
|
+
:fullResponse => options[:full_response],
|
12
|
+
:method => "vimeo.videos.getList"
|
13
|
+
}
|
14
|
+
|
15
|
+
make_request sig_options
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_uploaded_list(user_id, options={ :page => 1, :per_page => 25, :full_response => 0, :auth_token => nil })
|
19
|
+
sig_options = {
|
20
|
+
:user_id => user_id,
|
21
|
+
:page => options[:page],
|
22
|
+
:per_page => options[:per_page],
|
23
|
+
:fullResponse => options[:full_response],
|
24
|
+
:auth_token => options[:auth_token],
|
25
|
+
:method => "vimeo.videos.getUploadedList"
|
26
|
+
}
|
27
|
+
|
28
|
+
make_request sig_options
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_appears_in_list(user_id, options={ :page => 1, :per_page => 25, :full_response => 0, :auth_token => nil })
|
32
|
+
sig_options = {
|
33
|
+
:user_id => user_id,
|
34
|
+
:page => options[:page],
|
35
|
+
:per_page => options[:per_page],
|
36
|
+
:fullResponse => options[:full_response],
|
37
|
+
:method => "vimeo.videos.getAppearsInList"
|
38
|
+
}
|
39
|
+
|
40
|
+
make_request sig_options
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_subscriptions_list(user_id, options={ :page => 1, :per_page => 25, :full_response => 0, :auth_token => nil })
|
44
|
+
sig_options = {
|
45
|
+
:user_id => user_id,
|
46
|
+
:page => options[:page],
|
47
|
+
:per_page => options[:per_page],
|
48
|
+
:fullResponse => options[:full_response],
|
49
|
+
:auth_token => options[:auth_token],
|
50
|
+
:method => "vimeo.videos.getSubscriptionsList"
|
51
|
+
}
|
52
|
+
|
53
|
+
make_request sig_options
|
54
|
+
end
|
55
|
+
|
56
|
+
def get_list_by_tag(tag, options={ :page => 1, :per_page => 25, :full_response => 0, :auth_token => nil })
|
57
|
+
user_id = options[:user_id]
|
58
|
+
|
59
|
+
sig_options = {
|
60
|
+
:tag => tag,
|
61
|
+
:page => options[:page],
|
62
|
+
:per_page => options[:per_page],
|
63
|
+
:fullResponse => options[:full_response],
|
64
|
+
:auth_token => options[:auth_token],
|
65
|
+
:method => "vimeo.videos.getListByTag"
|
66
|
+
}
|
67
|
+
sig_options.merge! :user_id => user_id if !user_id.nil?
|
68
|
+
|
69
|
+
make_request sig_options
|
70
|
+
end
|
71
|
+
|
72
|
+
def get_like_list(user_id, options={ :page => 1, :per_page => 25, :full_response => 0, :auth_token => nil })
|
73
|
+
sig_options = {
|
74
|
+
:user_id => user_id,
|
75
|
+
:page => options[:page],
|
76
|
+
:per_page => options[:per_page],
|
77
|
+
:fullResponse => options[:full_response],
|
78
|
+
:auth_token => options[:auth_token],
|
79
|
+
:method => "vimeo.videos.getLikeList"
|
80
|
+
}
|
81
|
+
|
82
|
+
make_request sig_options
|
83
|
+
end
|
84
|
+
|
85
|
+
def get_contacts_list(user_id, options={ :page => 1, :per_page => 25, :full_response => 0, :auth_token => nil })
|
86
|
+
sig_options = {
|
87
|
+
:user_id => user_id,
|
88
|
+
:page => options[:page],
|
89
|
+
:per_page => options[:per_page],
|
90
|
+
:fullResponse => options[:full_response],
|
91
|
+
:auth_token => options[:auth_token],
|
92
|
+
:method => "vimeo.videos.getContactsList"
|
93
|
+
}
|
94
|
+
|
95
|
+
make_request sig_options
|
96
|
+
end
|
97
|
+
|
98
|
+
def get_contacts_like_list(user_id, options={ :page => 1, :per_page => 25, :full_response => 0, :auth_token => nil })
|
99
|
+
sig_options = {
|
100
|
+
:user_id => user_id,
|
101
|
+
:page => options[:page],
|
102
|
+
:per_page => options[:per_page],
|
103
|
+
:fullResponse => options[:full_response],
|
104
|
+
:auth_token => options[:auth_token],
|
105
|
+
:method => "vimeo.videos.getContactsLikeList"
|
106
|
+
}
|
107
|
+
|
108
|
+
make_request sig_options
|
109
|
+
end
|
110
|
+
|
111
|
+
def search(q, options={ :page => 1, :per_page => 25, :full_response => 0, :auth_token => nil })
|
112
|
+
user_id = options[:user_id]
|
113
|
+
contacts_only = options[:contacts_only]
|
114
|
+
escaped_query = CGI.escape(q)
|
115
|
+
|
116
|
+
sig_options = {
|
117
|
+
:query => escaped_query,
|
118
|
+
:page => options[:page],
|
119
|
+
:per_page => options[:per_page],
|
120
|
+
:fullResponse => options[:full_response],
|
121
|
+
:auth_token => options[:auth_token],
|
122
|
+
:method => "vimeo.videos.search"
|
123
|
+
}
|
124
|
+
sig_options.merge! :user_id => user_id if !user_id.nil?
|
125
|
+
sig_options.merge! :contacts_only => contacts_only if !contacts_only.nil?
|
126
|
+
|
127
|
+
make_request sig_options
|
128
|
+
end
|
129
|
+
|
130
|
+
def get_info(video_id, auth_token=nil)
|
131
|
+
sig_options = {
|
132
|
+
:video_id => video_id,
|
133
|
+
:auth_token => auth_token,
|
134
|
+
:method => "vimeo.videos.getInfo"
|
135
|
+
}
|
136
|
+
|
137
|
+
make_request sig_options
|
138
|
+
end
|
139
|
+
|
140
|
+
def delete(video_id, auth_token)
|
141
|
+
sig_options = {
|
142
|
+
:video_id => video_id,
|
143
|
+
:auth_token => auth_token,
|
144
|
+
:method => "vimeo.videos.delete"
|
145
|
+
}
|
146
|
+
|
147
|
+
make_request sig_options
|
148
|
+
end
|
149
|
+
|
150
|
+
def get_thumbnail_url(video_id, size=100)
|
151
|
+
sig_options = {
|
152
|
+
:video_id => video_id,
|
153
|
+
:size => size,
|
154
|
+
:method => "vimeo.videos.getThumbnailUrl"
|
155
|
+
}
|
156
|
+
|
157
|
+
make_request sig_options
|
158
|
+
end
|
159
|
+
|
160
|
+
def set_title(video_id, title, auth_token)
|
161
|
+
escaped_title = CGI.escape(title)
|
162
|
+
|
163
|
+
sig_options = {
|
164
|
+
:video_id => video_id,
|
165
|
+
:title => escaped_title,
|
166
|
+
:auth_token => auth_token,
|
167
|
+
:method => "vimeo.videos.setTitle"
|
168
|
+
}
|
169
|
+
|
170
|
+
make_request sig_options
|
171
|
+
end
|
172
|
+
|
173
|
+
def set_caption(video_id, caption, auth_token)
|
174
|
+
escaped_caption = CGI.escape(caption)
|
175
|
+
|
176
|
+
sig_options = {
|
177
|
+
:video_id => video_id,
|
178
|
+
:caption => escaped_caption,
|
179
|
+
:auth_token => auth_token,
|
180
|
+
:method => "vimeo.videos.setCaption"
|
181
|
+
}
|
182
|
+
|
183
|
+
make_request sig_options
|
184
|
+
end
|
185
|
+
|
186
|
+
def set_favorite(video_id, favorite, auth_token)
|
187
|
+
f = favorite ? true : false
|
188
|
+
|
189
|
+
sig_options = {
|
190
|
+
:video_id => video_id,
|
191
|
+
:favorite => f,
|
192
|
+
:auth_token => auth_token,
|
193
|
+
:method => "vimeo.videos.setFavorite"
|
194
|
+
}
|
195
|
+
|
196
|
+
make_request sig_options
|
197
|
+
end
|
198
|
+
|
199
|
+
def add_tags(video_id, tags, auth_token)
|
200
|
+
sig_options = {
|
201
|
+
:video_id => video_id,
|
202
|
+
:tags => tags,
|
203
|
+
:auth_token => auth_token,
|
204
|
+
:method => "vimeo.videos.addTags"
|
205
|
+
}
|
206
|
+
|
207
|
+
make_request sig_options
|
208
|
+
end
|
209
|
+
|
210
|
+
def remove_tag(video_id, tag_id, auth_token)
|
211
|
+
sig_options = {
|
212
|
+
:video_id => video_id,
|
213
|
+
:tag_id => tag_id,
|
214
|
+
:auth_token => auth_token,
|
215
|
+
:method => "vimeo.videos.removeTag"
|
216
|
+
}
|
217
|
+
|
218
|
+
make_request sig_options
|
219
|
+
end
|
220
|
+
|
221
|
+
def clear_tags(video_id, auth_token)
|
222
|
+
sig_options = {
|
223
|
+
:video_id => video_id,
|
224
|
+
:auth_token => auth_token,
|
225
|
+
:method => "vimeo.videos.clearTags"
|
226
|
+
}
|
227
|
+
|
228
|
+
make_request sig_options
|
229
|
+
end
|
230
|
+
|
231
|
+
def add_cast(video_id, user_id, auth_token, options={})
|
232
|
+
role = options[:role]
|
233
|
+
|
234
|
+
sig_options = {
|
235
|
+
:video_id => video_id,
|
236
|
+
:user_id => user_id,
|
237
|
+
:auth_token => auth_token,
|
238
|
+
:method => "vimeo.videos.addCast"
|
239
|
+
}
|
240
|
+
sig_options.merge! :role => role unless role.nil?
|
241
|
+
|
242
|
+
make_request sig_options
|
243
|
+
end
|
244
|
+
|
245
|
+
def get_cast(video_id, auth_token=nil)
|
246
|
+
sig_options = {
|
247
|
+
:video_id => video_id,
|
248
|
+
:auth_token => auth_token,
|
249
|
+
:method => "vimeo.videos.getCast"
|
250
|
+
}
|
251
|
+
|
252
|
+
make_request sig_options
|
253
|
+
end
|
254
|
+
|
255
|
+
def remove_cast(video_id, user_id, auth_token)
|
256
|
+
sig_options = {
|
257
|
+
:video_id => video_id,
|
258
|
+
:user_id => user_id,
|
259
|
+
:auth_token => auth_token,
|
260
|
+
:method => "vimeo.videos.removeCast"
|
261
|
+
}
|
262
|
+
|
263
|
+
make_request sig_options
|
264
|
+
end
|
265
|
+
|
266
|
+
# TODO: Add ability to specify users
|
267
|
+
def set_privacy(video_id, privacy, auth_token)
|
268
|
+
sig_options = {
|
269
|
+
:video_id => video_id,
|
270
|
+
:privacy => privacy,
|
271
|
+
:auth_token => auth_token,
|
272
|
+
:method => "vimeo.videos.setPrivacy"
|
273
|
+
}
|
274
|
+
|
275
|
+
make_request sig_options
|
276
|
+
end
|
277
|
+
|
278
|
+
def get_comments_list(video_id)
|
279
|
+
sig_options = {
|
280
|
+
:video_id => video_id,
|
281
|
+
:method => "vimeo.videos.comments.getList"
|
282
|
+
}
|
283
|
+
|
284
|
+
make_request sig_options
|
285
|
+
end
|
286
|
+
|
287
|
+
def add_comment(video_id, comment_text, auth_token, options={})
|
288
|
+
reply_to_comment_id = options[:reply_to_comment_id]
|
289
|
+
|
290
|
+
sig_options = {
|
291
|
+
:video_id => video_id,
|
292
|
+
:comment_text => comment_text,
|
293
|
+
:auth_token => auth_token,
|
294
|
+
:method => "vimeo.videos.comments.addComment"
|
295
|
+
}
|
296
|
+
sig_options.merge! :reply_to_comment_id => reply_to_comment_id unless reply_to_comment_id.nil?
|
297
|
+
|
298
|
+
make_request sig_options
|
299
|
+
end
|
300
|
+
|
301
|
+
def delete_comment(video_id, comment_id, auth_token)
|
302
|
+
sig_options = {
|
303
|
+
:video_id => video_id,
|
304
|
+
:comment_id => comment_id,
|
305
|
+
:auth_token => auth_token,
|
306
|
+
:method => "vimeo.videos.comments.deleteComment"
|
307
|
+
}
|
308
|
+
|
309
|
+
make_request sig_options
|
310
|
+
end
|
311
|
+
|
312
|
+
def edit_comment(video_id, comment_id, comment_text, auth_token)
|
313
|
+
sig_options = {
|
314
|
+
:video_id => video_id,
|
315
|
+
:comment_id => comment_id,
|
316
|
+
:comment_text => comment_text,
|
317
|
+
:auth_token => auth_token,
|
318
|
+
:method => "vimeo.videos.comments.editComment"
|
319
|
+
}
|
320
|
+
|
321
|
+
make_request sig_options
|
322
|
+
end
|
323
|
+
|
324
|
+
end
|
325
|
+
|
326
|
+
end # Advanced
|
327
|
+
end # Vimeo
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Simple
|
3
|
+
|
4
|
+
class Activity < Vimeo::Simple::Base
|
5
|
+
def self.user_did(username)
|
6
|
+
get("/activity/#{username}/user_did.json")
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.happened_to_user(username)
|
10
|
+
get("/activity/#{username}/happened_to_user.json")
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.contacts_did(username)
|
14
|
+
get("/activity/#{username}/contacts_did.json")
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.happened_to_contacts(username)
|
18
|
+
get("/activity/#{username}/happened_to_contacts.json")
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.everyone_did(username)
|
22
|
+
get("/activity/#{username}/everyone_did.json")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end # Simple
|
27
|
+
end # Vimeo
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Simple
|
3
|
+
|
4
|
+
class Album < Vimeo::Simple::Base
|
5
|
+
# Returns this album's clips.
|
6
|
+
def self.clips(album_id)
|
7
|
+
get("/album/#{album_id}/clips.json")
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns this album's information.
|
11
|
+
def self.info(album_id)
|
12
|
+
get("/album/#{album_id}/info.json")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end # Simple
|
17
|
+
end # Vimeo
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Simple
|
3
|
+
|
4
|
+
class Channel < Vimeo::Simple::Base
|
5
|
+
# Returns this channel's clips.
|
6
|
+
def self.clips(channelname)
|
7
|
+
get("/channel/#{channelname}/clips.json")
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns this channel's information.
|
11
|
+
def self.info(channelname)
|
12
|
+
get("/channel/#{channelname}/info.json")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end # Simple
|
17
|
+
end # Vimeo
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Simple
|
3
|
+
|
4
|
+
class Group < Vimeo::Simple::Base
|
5
|
+
# Returns this group's clips.
|
6
|
+
def self.clips(groupname)
|
7
|
+
get("/group/#{groupname}/clips.json")
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns this group's users.
|
11
|
+
def self.users(groupname)
|
12
|
+
get("/group/#{groupname}/users.json")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Returns this group's information.
|
16
|
+
def self.info(groupname)
|
17
|
+
get("/group/#{groupname}/info.json")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end # Simple
|
22
|
+
end # Vimeo
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Vimeo
|
2
|
+
module Simple
|
3
|
+
|
4
|
+
class User < Vimeo::Simple::Base
|
5
|
+
# Returns this user's information.
|
6
|
+
def self.info(username)
|
7
|
+
get("/#{username}/info.json")
|
8
|
+
end
|
9
|
+
|
10
|
+
# Returns this user's clips.
|
11
|
+
def self.clips(username)
|
12
|
+
get("/#{username}/clips.json")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Returns this user's liked clips.
|
16
|
+
def self.likes(username)
|
17
|
+
get("/#{username}/likes.json")
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns the clips this user appears in.
|
21
|
+
def self.appears_in(username)
|
22
|
+
get("/#{username}/appears_in.json")
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns all clips related to this user.
|
26
|
+
def self.all_clips(username)
|
27
|
+
get("/#{username}/all_clips.json")
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns this user's subscriptions.
|
31
|
+
def self.subscriptions(username)
|
32
|
+
get("/#{username}/subscriptions.json")
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns this user's albums.
|
36
|
+
def self.albums(username)
|
37
|
+
get("/#{username}/albums.json")
|
38
|
+
end
|
39
|
+
|
40
|
+
# Returns this user's channels.
|
41
|
+
def self.channels(username)
|
42
|
+
get("/#{username}/channels.json")
|
43
|
+
end
|
44
|
+
|
45
|
+
# Returns this user's groups.
|
46
|
+
def self.groups(username)
|
47
|
+
get("/#{username}/groups.json")
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns this user's contact's clips.
|
51
|
+
def self.contacts_clips(username)
|
52
|
+
get("/#{username}/contacts_clips.json")
|
53
|
+
end
|
54
|
+
|
55
|
+
# Returns the clips that this user's contact's liked.
|
56
|
+
def self.contacts_like(username)
|
57
|
+
get("/#{username}/contacts_like.json")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end # End Simple
|
62
|
+
end # End Vimeo
|
data/lib/vimeo/simple.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__))
|
2
|
+
require 'simple/base'
|
3
|
+
require 'simple/activity'
|
4
|
+
require 'simple/album'
|
5
|
+
require 'simple/channel'
|
6
|
+
require 'simple/clip'
|
7
|
+
require 'simple/group'
|
8
|
+
require 'simple/user'
|
9
|
+
|
10
|
+
module Vimeo
|
11
|
+
module Simple
|
12
|
+
|
13
|
+
end # Simple
|
14
|
+
end # Vimeo
|
data/lib/vimeo.rb
ADDED
data/test/test_helper.rb
ADDED
data/test/vimeo_test.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matthooks-vimeo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Hooks
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-07 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,9 +32,33 @@ extra_rdoc_files:
|
|
32
32
|
- LICENSE
|
33
33
|
- CHANGELOG.rdoc
|
34
34
|
files:
|
35
|
+
- CHANGELOG.rdoc
|
35
36
|
- README.rdoc
|
37
|
+
- VERSION.yml
|
38
|
+
- lib/vimeo
|
39
|
+
- lib/vimeo/advanced
|
40
|
+
- lib/vimeo/advanced/auth.rb
|
41
|
+
- lib/vimeo/advanced/base.rb
|
42
|
+
- lib/vimeo/advanced/contact.rb
|
43
|
+
- lib/vimeo/advanced/group.rb
|
44
|
+
- lib/vimeo/advanced/person.rb
|
45
|
+
- lib/vimeo/advanced/test.rb
|
46
|
+
- lib/vimeo/advanced/upload.rb
|
47
|
+
- lib/vimeo/advanced/video.rb
|
48
|
+
- lib/vimeo/advanced.rb
|
49
|
+
- lib/vimeo/simple
|
50
|
+
- lib/vimeo/simple/activity.rb
|
51
|
+
- lib/vimeo/simple/album.rb
|
52
|
+
- lib/vimeo/simple/base.rb
|
53
|
+
- lib/vimeo/simple/channel.rb
|
54
|
+
- lib/vimeo/simple/clip.rb
|
55
|
+
- lib/vimeo/simple/group.rb
|
56
|
+
- lib/vimeo/simple/user.rb
|
57
|
+
- lib/vimeo/simple.rb
|
58
|
+
- lib/vimeo.rb
|
59
|
+
- test/test_helper.rb
|
60
|
+
- test/vimeo_test.rb
|
36
61
|
- LICENSE
|
37
|
-
- CHANGELOG.rdoc
|
38
62
|
has_rdoc: true
|
39
63
|
homepage: http://github.com/matthooks/vimeo
|
40
64
|
post_install_message:
|