Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 8 commits
  • 13 files changed
  • 0 commit comments
  • 1 contributor
View
27 Manifest.txt
@@ -0,0 +1,27 @@
+CHANGELOG.rdoc
+LICENSE
+Manifest.txt
+README.rdoc
+Rakefile
+VERSION.yml
+lib/vimeo.rb
+lib/vimeo/advanced.rb
+lib/vimeo/advanced/auth.rb
+lib/vimeo/advanced/base.rb
+lib/vimeo/advanced/contact.rb
+lib/vimeo/advanced/group.rb
+lib/vimeo/advanced/person.rb
+lib/vimeo/advanced/test.rb
+lib/vimeo/advanced/upload.rb
+lib/vimeo/advanced/video.rb
+lib/vimeo/simple.rb
+lib/vimeo/simple/activity.rb
+lib/vimeo/simple/album.rb
+lib/vimeo/simple/base.rb
+lib/vimeo/simple/channel.rb
+lib/vimeo/simple/clip.rb
+lib/vimeo/simple/group.rb
+lib/vimeo/simple/user.rb
+test/advanced/test_upload.rb
+test/test_helper.rb
+vimeo.gemspec
View
4 README.rdoc
@@ -1,5 +1,7 @@
= Vimeo API Gem
+* http://github.com/matthooks/vimeo
+
This gem implements a full-featured ruby interface for the Vimeo API.
Vimeo's API documentation is, in my opinion, pretty poor. I've done my best to implement all the functions that are described {here}[http://vimeo.com/api-docs/advanced-api-docs.html]. There are some extra functions described {here}[http://vimeo.com/api/sandbox], but I can't be 100% sure what the correct parameters are for each method, so I'm going to omit them for the time being.
@@ -166,4 +168,4 @@ The wrapper for the Advanced API consists of the following classes and methods:
* {HTTParty}[http://github.com/jnunemaker/httparty/tree/master]: Easily one of the best tools I have used since I started using Ruby.
* {Jeweler}[http://github.com/technicalpickles/jeweler/tree/master]: Great tool for creating gems for github.
-=== Copyright (c) 2008 Matt Hooks. See LICENSE for details.
+=== Copyright (c) 2008 Matt Hooks. See LICENSE for details.
View
55 Rakefile
@@ -1,49 +1,12 @@
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'rcov/rcovtask'
+# -*- ruby -*-
-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"]
+require 'rubygems'
+require 'hoe'
- 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"])
- end
-rescue LoadError
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
-end
-
-Rake::TestTask.new do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = false
-end
-
-Rake::RDocTask.new do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'vimeo'
- rdoc.options << '--line-numbers' << '--inline-source'
- 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
+Hoe.spec('vimeo') do
+ developer 'Matt Hooks', "matthooks@gmail.com"
+ self.readme_file = 'README.rdoc'
+ self.history_file = 'CHANGELOG.rdoc'
+ self.extra_rdoc_files = FileList['*.rdoc']
+ self.extra_deps = [['jnunemaker-httparty', '>= 0.2.6'], 'curb']
end
-
-task :default => :rcov
View
4 VERSION.yml
@@ -1,4 +1,4 @@
---
-:patch: 3
-:major: 0
+:patch: 0
+:major: 1
:minor: 2
View
5 lib/vimeo.rb
@@ -3,10 +3,9 @@
require 'digest/md5'
require 'cgi'
-$:.unshift(File.dirname(__FILE__))
require 'vimeo/simple'
require 'vimeo/advanced'
module Vimeo
-
-end
+ VERSION = '1.3.1'
+end
View
11 lib/vimeo/advanced.rb
@@ -1,9 +1,8 @@
-$:.unshift(File.dirname(__FILE__))
-require 'advanced/base'
-require 'advanced/auth'
-require 'advanced/test'
-require 'advanced/video'
-require 'advanced/upload'
+require 'vimeo/advanced/base'
+require 'vimeo/advanced/auth'
+require 'vimeo/advanced/test'
+require 'vimeo/advanced/video'
+require 'vimeo/advanced/upload'
module Vimeo
module Advanced
View
17 lib/vimeo/advanced/base.rb
@@ -13,7 +13,7 @@ def initialize(api_key, secret, format_options={})
@auth = { :api_key => api_key }
@secret = secret
end
-
+
# Generates a link that allows a user to authorize
# your web application to use the advanced API
def login_link(perms, frob)
@@ -32,7 +32,7 @@ def upload_sig(ticket_id, auth_token)
generate_api_sig sig_options
end
-
+
private
# Generates a MD5 hashed API signature for Advanced API requests
@@ -43,17 +43,24 @@ def generate_api_sig(options={})
api_sig = options.sort { |a, b| a.to_s <=> b.to_s }.join
Digest::MD5.hexdigest("#{@secret}#{api_sig}")
end
-
+
def query(sig_options, api_sig)
sig_options.merge :api_key => @auth[:api_key], :api_sig => api_sig
end
-
+
def make_request(sig_options)
api_sig = generate_api_sig sig_options
self.class.post "/api/rest", :query => query(sig_options, api_sig)
end
+ def rand_string len
+ chars = ('a'..'z').to_a + ('A'..'Z').to_a
+ string = ''
+ 1.upto(len) { |i| string << chars[rand(chars.size-1)] }
+ string
+ end
+
end # Base
end # Advanced
-end # Vimeo
+end # Vimeo
View
21 lib/vimeo/advanced/upload.rb
@@ -1,3 +1,7 @@
+require 'webrick/httputils'
+require 'curl'
+
+
module Vimeo
module Advanced
@@ -22,6 +26,22 @@ def check_upload_status(ticket_id, auth_token)
make_request sig_options
end
+ ###
+ # Upload +file+ to vimeo with +ticket_id+ and +auth_token+
+ def upload file, ticket_id, auth_token
+ params = {
+ :auth_token => auth_token,
+ :ticket_id => ticket_id
+ }
+ params[:api_sig] = generate_api_sig params
+
+ c = Curl::Easy.new('http://vimeo.com/services/upload')
+ c.multipart_form_post = true
+ c.http_post(
+ *(params.map { |k,v| Curl::PostField.content(k.to_s, v) } +
+ [Curl::PostField.file('video', file)])
+ )
+ end
def signature_for_file_upload(ticket_id, auth_token)
sig_options = {
@@ -30,7 +50,6 @@ def signature_for_file_upload(ticket_id, auth_token)
}
generate_api_sig sig_options
end
-
end
end # Advanced
View
17 lib/vimeo/simple.rb
@@ -1,14 +1,13 @@
-$:.unshift(File.dirname(__FILE__))
-require 'simple/base'
-require 'simple/activity'
-require 'simple/album'
-require 'simple/channel'
-require 'simple/clip'
-require 'simple/group'
-require 'simple/user'
+require 'vimeo/simple/base'
+require 'vimeo/simple/activity'
+require 'vimeo/simple/album'
+require 'vimeo/simple/channel'
+require 'vimeo/simple/clip'
+require 'vimeo/simple/group'
+require 'vimeo/simple/user'
module Vimeo
module Simple
end # Simple
-end # Vimeo
+end # Vimeo
View
37 test/advanced/test_upload.rb
@@ -0,0 +1,37 @@
+require 'test_helper'
+require 'vimeo/advanced/upload'
+
+module Vimeo
+ module Advanced
+ class UploadTest < ::Test::Unit::TestCase
+ class Vimeo::Advanced::Upload
+ class HTTP < Struct.new(:host, :port)
+ class Post
+ def initialize uri
+ @uri = uri
+ @params = {}
+ end
+
+ def []= k,v
+ @params[k] = v
+ end
+ end
+ end
+ end
+
+ def test_upload
+ ul = Vimeo::Advanced::Upload.new('a', 'b')
+
+ def ul.get_upload_ticket *args
+ 'foo'
+ end
+
+ def ul.NET
+ FakeHTTP
+ end
+
+ ul.upload(__FILE__, 'test', 'testing')
+ end
+ end
+ end
+end
View
6 test/test_helper.rb
@@ -1,7 +1,3 @@
require 'rubygems'
require 'test/unit'
-require 'shoulda'
-require 'mocha'
-
-class Test::Unit::TestCase
-end
+require 'vimeo'
View
7 test/vimeo_test.rb
@@ -1,7 +0,0 @@
-require File.dirname(__FILE__) + '/test_helper'
-
-class VimeoTest < Test::Unit::TestCase
- should "probably rename this file and start testing for real" do
- flunk "hey buddy, you should probably rename this file and start testing for real"
- end
-end
View
59 vimeo.gemspec
@@ -2,53 +2,22 @@
Gem::Specification.new do |s|
s.name = %q{vimeo}
- s.version = "0.2.2"
+ s.version = "1.3.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Matt Hooks"]
- s.date = %q{2009-04-21}
- s.description = %q{A full featured Ruby implementation of the Vimeo API.}
- s.email = %q{matthooks@gmail.com}
- s.extra_rdoc_files = [
- "CHANGELOG.rdoc",
- "LICENSE",
- "README.rdoc"
- ]
- s.files = [
- "CHANGELOG.rdoc",
- "README.rdoc",
- "VERSION.yml",
- "lib/vimeo.rb",
- "lib/vimeo/advanced.rb",
- "lib/vimeo/advanced/auth.rb",
- "lib/vimeo/advanced/base.rb",
- "lib/vimeo/advanced/contact.rb",
- "lib/vimeo/advanced/group.rb",
- "lib/vimeo/advanced/person.rb",
- "lib/vimeo/advanced/test.rb",
- "lib/vimeo/advanced/upload.rb",
- "lib/vimeo/advanced/video.rb",
- "lib/vimeo/simple.rb",
- "lib/vimeo/simple/activity.rb",
- "lib/vimeo/simple/album.rb",
- "lib/vimeo/simple/base.rb",
- "lib/vimeo/simple/channel.rb",
- "lib/vimeo/simple/clip.rb",
- "lib/vimeo/simple/group.rb",
- "lib/vimeo/simple/user.rb",
- "test/test_helper.rb",
- "test/vimeo_test.rb"
- ]
- s.has_rdoc = true
+ s.date = %q{2009-08-03}
+ s.description = %q{}
+ s.email = ["matthooks@gmail.com"]
+ s.extra_rdoc_files = ["Manifest.txt", "CHANGELOG.rdoc", "README.rdoc"]
+ s.files = ["CHANGELOG.rdoc", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "VERSION.yml", "lib/vimeo.rb", "lib/vimeo/advanced.rb", "lib/vimeo/advanced/auth.rb", "lib/vimeo/advanced/base.rb", "lib/vimeo/advanced/contact.rb", "lib/vimeo/advanced/group.rb", "lib/vimeo/advanced/person.rb", "lib/vimeo/advanced/test.rb", "lib/vimeo/advanced/upload.rb", "lib/vimeo/advanced/video.rb", "lib/vimeo/simple.rb", "lib/vimeo/simple/activity.rb", "lib/vimeo/simple/album.rb", "lib/vimeo/simple/base.rb", "lib/vimeo/simple/channel.rb", "lib/vimeo/simple/clip.rb", "lib/vimeo/simple/group.rb", "lib/vimeo/simple/user.rb", "test/advanced/test_upload.rb", "test/test_helper.rb", "vimeo.gemspec"]
s.homepage = %q{http://github.com/matthooks/vimeo}
- s.rdoc_options = ["--main", "README.rdoc", "--inline-source", "--charset=UTF-8"]
+ s.rdoc_options = ["--main", "README.rdoc"]
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.2}
- s.summary = %q{A full featured Ruby implementation of the Vimeo API.}
- s.test_files = [
- "test/test_helper.rb",
- "test/vimeo_test.rb"
- ]
+ s.rubyforge_project = %q{vimeo}
+ s.rubygems_version = %q{1.3.4}
+ s.summary = %q{}
+ s.test_files = ["test/advanced/test_upload.rb", "test/test_helper.rb"]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -56,10 +25,16 @@ Gem::Specification.new do |s|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<jnunemaker-httparty>, [">= 0.2.6"])
+ s.add_runtime_dependency(%q<curb>, [">= 0"])
+ s.add_development_dependency(%q<hoe>, [">= 2.3.2"])
else
s.add_dependency(%q<jnunemaker-httparty>, [">= 0.2.6"])
+ s.add_dependency(%q<curb>, [">= 0"])
+ s.add_dependency(%q<hoe>, [">= 2.3.2"])
end
else
s.add_dependency(%q<jnunemaker-httparty>, [">= 0.2.6"])
+ s.add_dependency(%q<curb>, [">= 0"])
+ s.add_dependency(%q<hoe>, [">= 2.3.2"])
end
end

No commit comments for this range

Something went wrong with that request. Please try again.