vimeo 1.0.0 → 1.1.0

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.
Files changed (48) hide show
  1. data/.gitignore +2 -1
  2. data/README.markdown +312 -0
  3. data/Rakefile +1 -1
  4. data/VERSION.yml +2 -1
  5. data/init.rb +2 -0
  6. data/lib/vimeo.rb +1 -0
  7. data/lib/vimeo/advanced.rb +0 -1
  8. data/lib/vimeo/advanced/album.rb +8 -10
  9. data/lib/vimeo/advanced/base.rb +56 -46
  10. data/lib/vimeo/advanced/channel.rb +6 -9
  11. data/lib/vimeo/advanced/contact.rb +2 -3
  12. data/lib/vimeo/advanced/group.rb +5 -11
  13. data/lib/vimeo/advanced/person.rb +5 -6
  14. data/lib/vimeo/advanced/test.rb +7 -24
  15. data/lib/vimeo/advanced/upload.rb +4 -9
  16. data/lib/vimeo/advanced/video.rb +14 -15
  17. data/lib/vimeo/advanced/video_embed.rb +1 -2
  18. data/test/fixtures/advanced/auth/check_access_token.json +9 -0
  19. data/test/fixtures/advanced/auth/request_token.txt +1 -0
  20. data/test/fixtures/advanced/channel/get_all.json +17 -55
  21. data/test/fixtures/advanced/group/get_all.json +5 -29
  22. data/test/fixtures/advanced/group/get_info.json +1 -2
  23. data/test/fixtures/advanced/group_events/get_month.json +3 -8
  24. data/test/fixtures/advanced/group_events/get_past.json +3 -8
  25. data/test/fixtures/advanced/group_events/get_upcoming.json +3 -8
  26. data/test/fixtures/advanced/group_forums/get_topic_comments.json +1 -3
  27. data/test/fixtures/advanced/person/get_info.json +1 -2
  28. data/test/fixtures/advanced/video/get_by_tag.json +1 -3
  29. data/test/fixtures/advanced/video/get_subscriptions.json +3 -7
  30. data/test/fixtures/advanced/video/search.json +1 -2
  31. data/test/test_helper.rb +17 -6
  32. data/test/vimeo/advanced/album_test.rb +54 -67
  33. data/test/vimeo/advanced/auth_test.rb +17 -25
  34. data/test/vimeo/advanced/base_test.rb +7 -9
  35. data/test/vimeo/advanced/channels_test.rb +5 -5
  36. data/test/vimeo/advanced/contacts_test.rb +1 -1
  37. data/test/vimeo/advanced/group_events_test.rb +1 -1
  38. data/test/vimeo/advanced/group_forums_test.rb +1 -1
  39. data/test/vimeo/advanced/groups_test.rb +4 -4
  40. data/test/vimeo/advanced/person_test.rb +9 -8
  41. data/test/vimeo/advanced/test_test.rb +3 -3
  42. data/test/vimeo/advanced/upload_test.rb +6 -6
  43. data/test/vimeo/advanced/videos_embed_test.rb +6 -5
  44. data/test/vimeo/advanced/videos_test.rb +15 -15
  45. data/vimeo.gemspec +13 -11
  46. metadata +10 -9
  47. data/README.rdoc +0 -322
  48. data/lib/vimeo/advanced/auth.rb +0 -22
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.0.0
4
+ version: 1.1.0
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-09-28 00:00:00 -05:00
12
+ date: 2009-12-20 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -53,24 +53,24 @@ dependencies:
53
53
  version: 0.4.5
54
54
  version:
55
55
  - !ruby/object:Gem::Dependency
56
- name: curb
56
+ name: json
57
57
  type: :runtime
58
58
  version_requirement:
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 0.5.4.0
63
+ version: 1.1.9
64
64
  version:
65
65
  - !ruby/object:Gem::Dependency
66
- name: json
66
+ name: oauth
67
67
  type: :runtime
68
68
  version_requirement:
69
69
  version_requirements: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - - ">="
72
72
  - !ruby/object:Gem::Version
73
- version: 1.1.9
73
+ version: 0.3.6
74
74
  version:
75
75
  description: A full featured Ruby implementation of the Vimeo API.
76
76
  email: matthooks@gmail.com
@@ -81,18 +81,17 @@ extensions: []
81
81
  extra_rdoc_files:
82
82
  - CHANGELOG.rdoc
83
83
  - LICENSE
84
- - README.rdoc
85
84
  files:
86
85
  - .gitignore
87
86
  - CHANGELOG.rdoc
88
87
  - LICENSE
89
- - README.rdoc
88
+ - README.markdown
90
89
  - Rakefile
91
90
  - VERSION.yml
91
+ - init.rb
92
92
  - lib/vimeo.rb
93
93
  - lib/vimeo/advanced.rb
94
94
  - lib/vimeo/advanced/album.rb
95
- - lib/vimeo/advanced/auth.rb
96
95
  - lib/vimeo/advanced/base.rb
97
96
  - lib/vimeo/advanced/channel.rb
98
97
  - lib/vimeo/advanced/contact.rb
@@ -121,9 +120,11 @@ files:
121
120
  - test/fixtures/advanced/album/set_description.json
122
121
  - test/fixtures/advanced/album/set_password.json
123
122
  - test/fixtures/advanced/album/set_title.json
123
+ - test/fixtures/advanced/auth/check_access_token.json
124
124
  - test/fixtures/advanced/auth/check_token.json
125
125
  - test/fixtures/advanced/auth/get_frob.json
126
126
  - test/fixtures/advanced/auth/get_token.json
127
+ - test/fixtures/advanced/auth/request_token.txt
127
128
  - test/fixtures/advanced/channel/add_video.json
128
129
  - test/fixtures/advanced/channel/get_all.json
129
130
  - test/fixtures/advanced/channel/get_info.json
data/README.rdoc DELETED
@@ -1,322 +0,0 @@
1
- = Vimeo API Gem
2
-
3
- This gem implements a full-featured Ruby interface for the Vimeo API v2.
4
-
5
- For a more in depth look at the API check out {Vimeo's Simple API Documentation}[http://www.vimeo.com/api/docs/simple-api] or {Vimeo's Advanced API Documentation}[http://www.vimeo.com/api/docs/advanced-api]. I would also recommend checking out the {API Forums}[http://www.vimeo.com/forum:api] if
6
- things aren't working as they should -- in my experience the Vimeo API has a number of bugs and oddities.
7
-
8
- == Install
9
-
10
- If you haven't already, add github's gem server to your sources:
11
-
12
- gem sources -a http://gems.github.com
13
-
14
- Then, it's as easy as:
15
-
16
- sudo gem install matthooks-vimeo
17
-
18
- Add the gem plugin to your Rails project by adding the following to your @environment.rb@ file:
19
-
20
- config.gem "matthooks-vimeo", :lib => "vimeo"
21
-
22
- == Use
23
-
24
- There are two modules:
25
-
26
- Vimeo::Simple
27
- Vimeo::Advanced
28
-
29
- == Simple API
30
-
31
- The wrapper for the {Simple API}[http://www.vimeo.com/api/docs/simple-api] consists of several classes. To use the Simple API, just call one of the class methods. For example:
32
-
33
- user_info = Vimeo::Simple::User.info("matthooks")
34
- # =>
35
- # {
36
- # "id":"888046",
37
- # "display_name":"Matt Hooks",
38
- # "created_on":"2008-10-30 14:17:32",
39
- # "is_staff":"0",
40
- # "is_plus":"0",
41
- # "location":"Chicago, IL",
42
- # "url":"http:\/\/blackholeinthemidwest.com\/",
43
- # "bio":"",
44
- # "profile_url":"http:\/\/vimeo.com\/matthooks",
45
- # "videos_url":"http:\/\/vimeo.com\/matthooks\/videos",
46
- # "total_videos_uploaded":2,
47
- # "total_videos_appears_in":0,
48
- # "total_videos_liked":2,
49
- # "total_contacts":3,
50
- # "total_albums":0,
51
- # "total_channels":1,
52
- # "portrait_small":"http:\/\/images.vimeo.com\/11\/42\/16\/114216178\/114216178_30.jpg",
53
- # "portrait_medium":"http:\/\/images.vimeo.com\/11\/42\/16\/114216178\/114216178_75.jpg",
54
- # "portrait_large":"http:\/\/images.vimeo.com\/11\/42\/16\/114216178\/114216178_100.jpg",
55
- # "portrait_huge":"http:\/\/images.vimeo.com\/11\/42\/16\/114216178\/114216178_300.jpg"
56
- # }
57
-
58
- # That's right! The data returned will be parsed and ready to use.
59
-
60
- user_info["location"]
61
- # => "Chicago, IL"
62
-
63
- === Vimeo::Simple::Activity
64
-
65
- Vimeo::Simple::Activity.user_did("username")
66
- Vimeo::Simple::Activity.happened_to_user("username")
67
- Vimeo::Simple::Activity.contacts_did("username")
68
- Vimeo::Simple::Activity.happened_to_contacts("username")
69
- Vimeo::Simple::Activity.everyone_did("username")
70
-
71
- === Vimeo::Simple::Album
72
-
73
- Vimeo::Simple::Album.videos("album_id")
74
- Vimeo::Simple::Album.info("album_id")
75
-
76
- === Vimeo::Simple::Channel
77
-
78
- Vimeo::Simple::Channel.videos(channelname)
79
- Vimeo::Simple::Channel.info(channelname)
80
-
81
- === Vimeo::Simple::Group
82
-
83
- Vimeo::Simple::Group.videos(groupname)
84
- Vimeo::Simple::Group.users(groupname)
85
- Vimeo::Simple::Group.info(groupname)
86
-
87
- === Vimeo::Simple::User
88
-
89
- Vimeo::Simple::User.info(username)
90
- Vimeo::Simple::User.videos(username)
91
- Vimeo::Simple::User.likes(username)
92
- Vimeo::Simple::User.appears_in(username)
93
- Vimeo::Simple::User.all_videos(username)
94
- Vimeo::Simple::User.subscriptions(username)
95
- Vimeo::Simple::User.albums(username)
96
- Vimeo::Simple::User.channels(username)
97
- Vimeo::Simple::User.groups(username)
98
- Vimeo::Simple::User.contacts_videos(username)
99
- Vimeo::Simple::User.contacts_like(username)
100
-
101
- === Vimeo::Simple::Video
102
-
103
- Vimeo::Simple::Video.info(video_id)
104
-
105
- == Advanced API
106
-
107
- The classes in Vimeo::Advanced must be instantiated with an your application's api key and secret. For example:
108
-
109
- vimeo_video = Vimeo::Advanced::Video.new("api_key", "secret")
110
-
111
- Then you can make method calls on the instance. For example:
112
-
113
- vimeo_video.get_list("matthooks", :page => 2, :per_page => 50)
114
-
115
- Some methods have optional variables. You should pass as a hash at the end of a call.
116
-
117
- Some methods require authentication. Check out the guides for {Web Based authentication}[http://www.vimeo.com/api/docs/web-auth] and {Desktop Based authentication}[http://www.vimeo.com/api/docs/desktop-auth].
118
-
119
- The wrapper for the Advanced API consists of the following classes and methods:
120
-
121
- === Vimeo::Advanced::Album
122
-
123
- album = Vimeo::Advanced::Album.new("api_key", "secret")
124
-
125
- album.add_video("auth_token", "album_id", "video_id")
126
- album.create("auth_token", "title", "video_id", { :description => "description", "videos" => "123,124,125" })
127
- album.delete("auth_token", "album_id")
128
- album.get_all("user_id", { :page => "1", :per_page => "25" })
129
- album.get_videos("auth_token", "user_id", { :page => "1", :per_page => "25", :full_response => "0", :password => nil })
130
- album.get_videos("auth_token", "album_id", "video_id")
131
- album.set_description("auth_token", "album_id", "description")
132
- album.get_password("auth_token", "album_id", "password")
133
- album.get_title("auth_token", "album_id", "title")
134
-
135
- === Vimeo::Advanced::Auth
136
-
137
- auth = Vimeo::Advanced::Auth.new("api_key", "secret")
138
-
139
- auth.get_token("frob")
140
- auth.get_frob
141
- auth.check_token("auth_token")
142
-
143
- === Vimeo::Advanced::Base
144
-
145
- base = Vimeo::Advanced::Base.new("api_key", "secret")
146
-
147
- base.web_login_link("permissions")
148
- base.desktop_login_link("permissions")
149
-
150
- === Vimeo::Advanced::Channel
151
-
152
- channel = Vimeo::Advanced::Channel.new("api_key", "secret")
153
-
154
- channel.add_video("auth_token", "channel_id", "video_id")
155
- channel.get_all({ :page => "1", :per_page => "25", :sort => "newest"})
156
- channel.get_info(channel_id, { :page => "1", :per_page => "25" })
157
- channel.get_moderators(channel_id, { :page => "1", :per_page => "25" })
158
- channel.get_subscribers(channel_id, { :page => "1", :per_page => "25" })
159
- channel.get_videos(channel_id, { :page => "1", :per_page => "25", :full_response => "0" })
160
- channel.remove_video("auth_token", "channel_id", "video_id")
161
- channel.subscribe("auth_token", "channel_id")
162
- channel.unsubscribe("auth_token", "channel_id")
163
-
164
- === Vimeo::Advanced::Contact
165
-
166
- contact = Vimeo::Advanced::Contact.new("api_key", "secret")
167
-
168
- contact.get_all(user_id, { :page => "1", :per_page => "25", :sort => "newest" })
169
- contact.get_mutual(user_id, { :page => "1", :per_page => "25", :sort => "newest" })
170
- contact.get_online({ :page => "1", :per_page => "25", :sort => "newest" })
171
- contact.get_who_added(user_id, { :page => "1", :per_page => "25", :sort => "newest" })
172
-
173
- === Vimeo::Advanced::Group
174
-
175
- group = Vimeo::Advanced::Group.new("api_key", "secret")
176
-
177
- group.add_video("auth_token", "group_id", "video_id")
178
- group.get_all({ :page => "1", :per_page => "25", :sort => "newest" })
179
- group.get_files("group_id", { :page => "1", :per_page => "25" })
180
- group.get_info("group_id", { :page => "1", :per_page => "25" })
181
- group.get_members("group_id", { :page => "1", :per_page => "25", :sort => "newest" })
182
- group.get_moderators("group_id", { :page => "1", :per_page => "25" })
183
- group.get_video_comments("group_id", "video_id", { :page => "1", :per_page => "25" })
184
- group.get_videos("group_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
185
- group.join("auth_token", "group_id")
186
- group.leave("auth_token", "group_id")
187
-
188
- === Vimeo::Advanced::GroupEvents
189
-
190
- group_events = Vimeo::Advanced::GroupEvents.new("api_key", "secret")
191
-
192
- group_events.get_month("group_id", { :page => "1", :per_page => "25", :month => nil, :year => nil })
193
- group_events.get_past("group_id", { :page => "1", :per_page => "25" })
194
- group_events.get_year("group_id", { :page => "1", :per_page => "25" })
195
-
196
- === Vimeo::Advanced::GroupForums
197
-
198
- group_forums = Vimeo::Advanced::GroupForums.new("api_key", "secret")
199
-
200
- group_forums.get_topic_comments("group_id", "topic_id", { :page => "1", :per_page => "25" })
201
- group_forums.get_topics("group_id", { :page => "1", :per_page => "25" })
202
-
203
- === Vimeo::Advanced::Person
204
-
205
- person = Vimeo::Advanced::Person.new("api_key", "secret")
206
-
207
- person.add_contact("auth_token", "user_id")
208
- # Types is a comma-delimited string. Valid options: "likes", "appears", "uploads"
209
- person.add_subscription("auth_token", "user_id", "types")
210
- person.find_by_email("user_id")
211
- person.get_hd_embeds("auth_token")
212
- person.get_info("user_id")
213
- person.get_portrait_urls("user_id")
214
- person.remove_contact("auth_token", "user_id")
215
- # Types is a comma-delimited string. Valid options: "likes", "appears", "uploads"
216
- person.remove_subscription("auth_token", "user_id", "types")
217
-
218
- === Vimeo::Advanced::Test
219
-
220
- test = Vimeo::Advanced::Test.new("api_key", "secret")
221
-
222
- test.echo(options={})
223
- test.null(auth_token)
224
- test.login(auth_token)
225
-
226
- === Vimeo::Advanced::Upload
227
-
228
- upload = Vimeo::Advanced::Upload.new("api_key", "secret")
229
-
230
- upload.confirm("auth_token", "ticket_id", "json_manifest")
231
- upload.get_quota("auth_token")
232
- upload.get_ticket("auth_token")
233
- upload.upload("auth_token", "path_to_file", "ticket_id", "end_point")
234
- upload.verify_manifest("auth_token", "ticket_id", "json_manifest")
235
-
236
- === Vimeo::Advanced::Video
237
-
238
- video = Vimeo::Advanced::Video.new("api_key", "secret")
239
-
240
- video.add_cast("auth_token", "video_id", "user_id", { :role => nil })
241
- video.add_photos("auth_token", "video_id", "photo_urls")
242
- video.add_tags("auth_token", "video_id", "tags")
243
- video.clear_tags("auth_token", "video_id")
244
- video.delete("auth_token", "video_id")
245
- video.get_all("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
246
- video.get_appears_in("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
247
- video.get_by_tag("tag", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
248
- video.get_cast("video_id", { :page => "1", :per_page => "25" })
249
- video.get_contacts_liked("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
250
- video.get_contacts_uploaded("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
251
- video.get_info("video_id")
252
- video.get_likes("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
253
- video.get_subscriptions("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
254
- video.get_thumbnail_urls("video_id")
255
- video.get_uploaded("user_id", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest" })
256
- video.remove_cast("auth_token", "video_id", "user_id")
257
- video.remove_tag("auth_token", "video_id", "tag_id")
258
- video.search("query", { :page => "1", :per_page => "25", :full_response => "0", :sort => "newest", :user_id => nil })
259
- video.set_description("auth_token", "video_id", "description")
260
- video.set_like("auth_token", "video_id", "like")
261
- video.set_privacy("auth_token", "video_id", "privacy", { :users => nil, :password => nil })
262
- video.set_title("auth_token", "video_id", "title")
263
-
264
- # comments
265
- video.add_comment("auth_token", "video_id", "comment_text", { :reply_to_comment_id => nil })
266
- video.delete_comment("auth_token", "video_id", "comment_id")
267
- video.edit_comment("auth_token", "video_id", "comment_id", "comment_text")
268
- video.get_comments_list("video_id", { :page => "1", :per_page => "25" })
269
-
270
- === Vimeo::Advanced::VideoEmbed
271
-
272
- video_embed = Vimeo::Advanced::VideoEmbed.new("api_key", "secret")
273
-
274
- video_embed.get_presets("auth_token", { :page => "1", :per_page => "25" })
275
- video_embed.set_preset("auth_token", "video_id", "preset_id")
276
-
277
-
278
- == Uploads
279
-
280
- Uploads are a little bit tricky, so I figured I'd help you guys with a short tutorial.
281
-
282
- # Start by creating an instance of the Upload class.
283
- upload = Vimeo::Advanced::Upload.new("api_key", "secret")
284
- # I'm going to assume you've got that user's auth token stored somewhere and that they have upload access.
285
- auth_token = "..."
286
-
287
- # Let's check the user's quota.
288
- # You should let the user know if they don't have enough quota free and/or if their video can be uploaded in HD
289
- quota = upload.get_quota(auth_token)
290
- free_space = quota["user"]["upload_space"]["free"]
291
- hd = quota["user"]["hq_quota"]
292
-
293
- # Now let's get an upload ticket.
294
- ticket = upload.get_ticket(auth_token)
295
- ticket_id = get_ticket["ticket"]["id"]
296
- endpoint = get_ticket["ticket"]["endpoint"]
297
-
298
- # Cool! Let's post the video.
299
- # The file path should be absolute.
300
- file_path = "..."
301
- json_manifest = upload.upload(auth_token, file_path, ticket_id, endpoint)
302
-
303
- # After the upload completes...
304
- upload.confirm(auth_token, ticket_id, json_manifest)
305
-
306
- There are a few steps along the way where things can go wrong.
307
-
308
- == Todo
309
-
310
- * Better structure. There's too many classes. Is there a way to simplify the Advanced API?
311
- * Advanced classes should be able to take the authentication token as a parameter so you don't have to pass it to the methods that require authentication.
312
- * Error handling.
313
- * Some methods are not implemented by Vimeo or don't seem to work.
314
- * More re-factoring.
315
- * Make tests more robust and faster. If anyone has any ideas let me know.
316
-
317
- == Thanks to
318
-
319
- * {HTTParty}[http://github.com/jnunemaker/httparty/tree/master]: Easily one of the best tools I have used since I started using Ruby.
320
- * {Jeweler}[http://github.com/technicalpickles/jeweler/tree/master]: Great tool for creating gems for Github.
321
-
322
- === Copyright (c) 2008 Matt Hooks. See LICENSE for details.
@@ -1,22 +0,0 @@
1
- module Vimeo
2
- module Advanced
3
- class Auth < Vimeo::Advanced::Base
4
-
5
- # Tests the validity of an authorization token.
6
- create_api_method :check_token,
7
- "vimeo.auth.checkToken",
8
- :required => [:auth_token]
9
-
10
- # Obtains a frob.
11
- # Used for desktop based authentication.
12
- create_api_method :get_frob,
13
- "vimeo.auth.getFrob"
14
-
15
- # Obtains an authorization token.
16
- create_api_method :get_token,
17
- "vimeo.auth.getToken",
18
- :required => [:frob]
19
-
20
- end
21
- end # Advanced
22
- end # Vimeo