Permalink
Browse files

Updated Vimeo::Simple to API v2 and added FakeWeb tests.

  • Loading branch information...
matthooks
matthooks committed Sep 24, 2009
1 parent e6d161d commit a282b29111fb780bb6f18d8d939071dd26ec4c77
Showing with 456 additions and 83 deletions.
  1. +2 −0 CHANGELOG.rdoc
  2. +1 −1 LICENSE
  3. +6 −6 README.rdoc
  4. +54 −33 Rakefile
  5. +1 −1 lib/vimeo/simple.rb
  6. +3 −3 lib/vimeo/simple/album.rb
  7. +1 −1 lib/vimeo/simple/base.rb
  8. +3 −3 lib/vimeo/simple/channel.rb
  9. +0 −12 lib/vimeo/simple/clip.rb
  10. +3 −3 lib/vimeo/simple/group.rb
  11. +12 −12 lib/vimeo/simple/user.rb
  12. +12 −0 lib/vimeo/simple/video.rb
  13. +1 −0 test/fixtures/simple/activity/contacts_did.json
  14. +1 −0 test/fixtures/simple/activity/everyone_did.json
  15. +1 −0 test/fixtures/simple/activity/happened_to_contacts.json
  16. +1 −0 test/fixtures/simple/activity/happened_to_user.json
  17. +1 −0 test/fixtures/simple/activity/user_did.json
  18. +1 −0 test/fixtures/simple/album/info.json
  19. +1 −0 test/fixtures/simple/album/videos.json
  20. +1 −0 test/fixtures/simple/channel/info.json
  21. +1 −0 test/fixtures/simple/channel/videos.json
  22. +1 −0 test/fixtures/simple/group/info.json
  23. +1 −0 test/fixtures/simple/group/users.json
  24. +1 −0 test/fixtures/simple/group/videos.json
  25. +1 −0 test/fixtures/simple/user/albums.json
  26. +1 −0 test/fixtures/simple/user/all_videos.json
  27. +1 −0 test/fixtures/simple/user/appears_in.json
  28. +1 −0 test/fixtures/simple/user/channels.json
  29. +1 −0 test/fixtures/simple/user/contacts_like.json
  30. +1 −0 test/fixtures/simple/user/contacts_videos.json
  31. +1 −0 test/fixtures/simple/user/groups.json
  32. +1 −0 test/fixtures/simple/user/info.json
  33. +1 −0 test/fixtures/simple/user/likes.json
  34. +1 −0 test/fixtures/simple/user/subscriptions.json
  35. +1 −0 test/fixtures/simple/user/videos.json
  36. +1 −0 test/fixtures/simple/video/info.json
  37. +37 −1 test/test_helper.rb
  38. 0 test/vimeo/advanced_test.rb
  39. +60 −0 test/vimeo/simple/activity_test.rb
  40. +31 −0 test/vimeo/simple/album_test.rb
  41. +31 −0 test/vimeo/simple/channel_test.rb
  42. +41 −0 test/vimeo/simple/group_test.rb
  43. +112 −0 test/vimeo/simple/user_test.rb
  44. +22 −0 test/vimeo/simple/video_test.rb
  45. 0 test/vimeo/simple_test.rb
  46. +0 −7 test/vimeo_test.rb
View
@@ -1,3 +1,5 @@
+
+
== 0.2.2, released 2009-04-21
* Removed CGI escapes. Vimeo should be handling them on their end.
View
@@ -1,4 +1,4 @@
-Copyright (c) 2008 Matt Hooks
+Copyright (c) 2009 Matt Hooks
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -32,15 +32,15 @@ The wrapper for the Simple API consists of the following classes and methods:
=== Vimeo::Simple::User
Vimeo::Simple::User.info(username)
- Vimeo::Simple::User.clips(username)
+ Vimeo::Simple::User.videos(username)
Vimeo::Simple::User.likes(username)
Vimeo::Simple::User.appears_in(username)
- Vimeo::Simple::User.all_clips(username)
+ Vimeo::Simple::User.all_videos(username)
Vimeo::Simple::User.subscriptions(username)
Vimeo::Simple::User.albums(username)
Vimeo::Simple::User.channels(username)
Vimeo::Simple::User.groups(username)
- Vimeo::Simple::User.contacts_clips(username)
+ Vimeo::Simple::User.contacts_videos(username)
Vimeo::Simple::User.contacts_like(username)
=== Vimeo::Simple::Clip
@@ -57,18 +57,18 @@ The wrapper for the Simple API consists of the following classes and methods:
=== Vimeo::Simple::Group
- Vimeo::Simple::Group.clips(groupname)
+ Vimeo::Simple::Group.videos(groupname)
Vimeo::Simple::Group.users(groupname)
Vimeo::Simple::Group.info(groupname)
=== Vimeo::Simple::Channel
- Vimeo::Simple::Channel.clips(channelname)
+ Vimeo::Simple::Channel.videos(channelname)
Vimeo::Simple::Channel.info(channelname)
=== Vimeo::Simple::Album
- Vimeo::Simple::Album.clips(album_id)
+ Vimeo::Simple::Album.videos(album_id)
Vimeo::Simple::Album.info(album_id)
== Advanced API
View
@@ -1,49 +1,70 @@
+require 'rubygems'
require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'rcov/rcovtask'
begin
require 'jeweler'
- Jeweler::Tasks.new do |s|
- s.name = "vimeo"
- s.summary = "A full featured Ruby implementation of the Vimeo API."
- s.email = "matthooks@gmail.com"
- s.homepage = "http://github.com/matthooks/vimeo"
- s.description = "A full featured Ruby implementation of the Vimeo API."
- s.authors = ["Matt Hooks"]
-
- s.files = FileList["[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"]
-
- s.has_rdoc = true
- s.rdoc_options = ['--main', 'README.rdoc']
- s.rdoc_options << '--inline-source' << '--charset=UTF-8'
- s.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'CHANGELOG.rdoc']
+ Jeweler::Tasks.new do |gem|
+ gem.name = "vimeo"
+ gem.summary = %Q{A full featured Ruby implementation of the Vimeo API.}
+ gem.description = %Q{A full featured Ruby implementation of the Vimeo API.}
+ gem.email = "matthooks@gmail.com"
+ gem.homepage = "http://github.com/matthooks/vimeo"
+ gem.authors = ["Matt Hooks"]
+ gem.rubyforge_project = "vimeo"
+ gem.add_development_dependency "thoughtbot-shoulda"
+ gem.add_development_dependency "fakeweb"
+
+ # s.files = FileList["[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"]
+ #
+ # s.has_rdoc = true
+ # s.rdoc_options = ['--main', 'README.rdoc']
+ # s.rdoc_options << '--inline-source' << '--charset=UTF-8'
+ # s.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'CHANGELOG.rdoc']
- s.add_dependency(%q<jnunemaker-httparty>, [">= 0.2.6"])
+ gem.add_dependency "httparty", ">= 0.4.5"
+ end
+ Jeweler::GemcutterTasks.new
+ Jeweler::RubyforgeTasks.new do |rubyforge|
+ rubyforge.doc_task = "rdoc"
end
rescue LoadError
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end
-Rake::TestTask.new do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = false
+require 'rake/testtask'
+Rake::TestTask.new(:test) do |test|
+ test.libs << 'lib' << 'test'
+ test.pattern = 'test/**/*_test.rb'
+ test.verbose = true
end
+begin
+ require 'rcov/rcovtask'
+ Rcov::RcovTask.new do |test|
+ test.libs << 'test'
+ test.pattern = 'test/**/*_test.rb'
+ test.verbose = true
+ end
+rescue LoadError
+ task :rcov do
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
+ end
+end
+
+task :test => :check_dependencies
+
+task :default => :test
+
+require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
+ if File.exist?('VERSION')
+ version = File.read('VERSION')
+ else
+ version = ""
+ end
+
rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'vimeo'
- rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.title = "vimeo #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
-
-Rcov::RcovTask.new do |t|
- t.libs << 'test'
- t.test_files = FileList['test/**/*_test.rb']
- t.verbose = true
-end
-
-task :default => :rcov
View
@@ -3,7 +3,7 @@
require 'simple/activity'
require 'simple/album'
require 'simple/channel'
-require 'simple/clip'
+require 'simple/video'
require 'simple/group'
require 'simple/user'
@@ -2,9 +2,9 @@ module Vimeo
module Simple
class Album < Vimeo::Simple::Base
- # Returns this album's clips.
- def self.clips(album_id)
- get("/album/#{album_id}/clips.json")
+ # Returns this album's videos.
+ def self.videos(album_id)
+ get("/album/#{album_id}/videos.json")
end
# Returns this album's information.
View
@@ -3,7 +3,7 @@ module Simple
class Base
include HTTParty
- base_uri 'vimeo.com/api'
+ base_uri 'vimeo.com/api/v2'
# TODO: Format options
end
@@ -2,9 +2,9 @@ module Vimeo
module Simple
class Channel < Vimeo::Simple::Base
- # Returns this channel's clips.
- def self.clips(channelname)
- get("/channel/#{channelname}/clips.json")
+ # Returns this channel's videos.
+ def self.videos(channelname)
+ get("/channel/#{channelname}/videos.json")
end
# Returns this channel's information.
View
@@ -1,12 +0,0 @@
-module Vimeo
- module Simple
-
- class Clip < Vimeo::Simple::Base
- # Returns this clip's information.
- def self.info(video_id)
- get("/clip/#{video_id}.json")
- end
- end
-
- end # End Simple
-end # End Vimeo
@@ -2,9 +2,9 @@ module Vimeo
module Simple
class Group < Vimeo::Simple::Base
- # Returns this group's clips.
- def self.clips(groupname)
- get("/group/#{groupname}/clips.json")
+ # Returns this group's videos.
+ def self.videos(groupname)
+ get("/group/#{groupname}/videos.json")
end
# Returns this group's users.
View
@@ -7,24 +7,24 @@ def self.info(username)
get("/#{username}/info.json")
end
- # Returns this user's clips.
- def self.clips(username)
- get("/#{username}/clips.json")
+ # Returns this user's videos.
+ def self.videos(username)
+ get("/#{username}/videos.json")
end
- # Returns this user's liked clips.
+ # Returns this user's liked videos.
def self.likes(username)
get("/#{username}/likes.json")
end
- # Returns the clips this user appears in.
+ # Returns the videos this user appears in.
def self.appears_in(username)
get("/#{username}/appears_in.json")
end
- # Returns all clips related to this user.
- def self.all_clips(username)
- get("/#{username}/all_clips.json")
+ # Returns all videos related to this user.
+ def self.all_videos(username)
+ get("/#{username}/all_videos.json")
end
# Returns this user's subscriptions.
@@ -47,12 +47,12 @@ def self.groups(username)
get("/#{username}/groups.json")
end
- # Returns this user's contact's clips.
- def self.contacts_clips(username)
- get("/#{username}/contacts_clips.json")
+ # Returns this user's contact's videos.
+ def self.contacts_videos(username)
+ get("/#{username}/contacts_videos.json")
end
- # Returns the clips that this user's contact's liked.
+ # Returns the videos that this user's contact's liked.
def self.contacts_like(username)
get("/#{username}/contacts_like.json")
end
View
@@ -0,0 +1,12 @@
+module Vimeo
+ module Simple
+
+ class Video < Vimeo::Simple::Base
+ # Returns this video's information.
+ def self.info(video_id)
+ get("/video/#{video_id}.json")
+ end
+ end
+
+ end # End Simple
+end # End Vimeo

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1 @@
+{"id":"129077","created_on":"2009-09-22 18:32:20","last_modified":"2009-09-23 16:31:55","title":"Vimeo Offline: HD","description":"","url":"http:\/\/vimeo.com\/album\/129077","thumbnail_small":"http:\/\/ts.vimeo.com.s3.amazonaws.com\/250\/567\/25056767_100.jpg","thumbnail_medium":"http:\/\/ts.vimeo.com.s3.amazonaws.com\/250\/567\/25056767_200.jpg","thumbnail_large":"http:\/\/ts.vimeo.com.s3.amazonaws.com\/250\/567\/25056767_640.jpg","total_videos":38,"user_id":"151382","user_display_name":"Blake Whitman","user_url":"http:\/\/vimeo.com\/blakewhitman"}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1 @@
+{"id":"58337","name":"Canon EOS 7D Channel","description":"This channel shows footage, short films and test shots done with the Canon EOS 7D.","logo":"http:\/\/channelheader.vimeo.com.s3.amazonaws.com\/313\/3135_980.jpg","badge":"","url":"http:\/\/vimeo.com\/channels\/canon7d","rss":"http:\/\/vimeo.com\/channels\/canon7d\/videos\/rss","created_on":"2009-09-03 03:10:07","creator_id":"668648","creator_display_name":"Nigel","creator_url":"http:\/\/vimeo.com\/patko","total_videos":38,"total_subscribers":98}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1 @@
+{"id":"20067","name":"Vimeo World Tour '09","description":"We're coming to Europe! For 11 days, Karen and I will be gallivanting across the European lands to meet and greet all you fine Vimeo members and hold Vimeo Offline parties. This Group will be a place for everyone to share videos of the events and the video blog of the trip that Karen and I will be shooting.<br \/>\r\n<br \/>\r\nVimeo Offline: Europe<br \/>\r\nBerlin - August 19<br \/>\r\nParis - August 22<br \/>\r\nLondon - August 25","url":"http:\/\/vimeo.com\/groups\/worldtour","logo":"http:\/\/images.vimeo.com\/grouplogo-32068.jpg","thumbnail":"http:\/\/ts.vimeo.com.s3.amazonaws.com\/264\/108\/26410872_100.jpg","created_on":"2009-07-20 18:13:20","creator_id":"151382","creator_display_name":"Blake Whitman","creator_url":"http:\/\/vimeo.com\/blakewhitman","total_members":"430","total_videos":"10","total_files":6,"total_forum_topics":13,"total_events":3,"total_upcoming_events":0}
@@ -0,0 +1 @@
+[{"display_name":"cris","created_on":"2009-09-22 04:56:27","location":"","url":"","bio":"","profile_url":"http:\/\/vimeo.com\/user2338154","videos_url":"http:\/\/vimeo.com\/user2338154\/videos","is_mod":"no","is_creator":"no","total_videos_uploaded":0,"total_videos_appears_in":0,"total_videos_liked":2,"total_contacts":0,"total_albums":0,"total_channels":0,"portrait_small":"http:\/\/bitcast.vimeo.com\/vimeo\/portraits\/defaults\/d.30.jpg","portrait_medium":"http:\/\/bitcast.vimeo.com\/vimeo\/portraits\/defaults\/d.75.jpg","portrait_large":"http:\/\/bitcast.vimeo.com\/vimeo\/portraits\/defaults\/d.100.jpg","portrait_huge":"http:\/\/bitcast.vimeo.com\/vimeo\/portraits\/defaults\/d.300.jpg"}]
Oops, something went wrong.

0 comments on commit a282b29

Please sign in to comment.