Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

The official gem for interacting with Viddler's V2 API

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 autotest
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 viddler-ruby.gemspec
README.md

viddler-ruby

viddler-ruby is the officially supported gem for Viddler's V2 API.

Installation

$ gem install viddler-ruby

Rails 2

Add the following to your config/environment.rb:

config.gem 'viddler-ruby'

Make sure to run rake gems:install afterwards.

Rails 3 and Bundler

Add the following to your Gemfile:

gem 'viddler-ruby'

Make sure to run bundle install afterwards

Other

To use in a regular Ruby project:

require 'rubygems'
require 'viddler-ruby'

Usage

viddler-ruby provides a simple interface to Viddler's API. To use, just instantiate an instance of Viddler::Client and call the #get and #post methods. For example, to get the details of a video:

viddler = Viddler::Client.new('your api key')
video = viddler.get 'viddler.videos.getDetails', :video_id => 'abc123'

puts video['title'] # => "My video"
puts video['id']    # => "abc123"

For an authenticated client, just call authenticate! on the client:

viddler = Viddler::Client.new('your api key')
viddler.authenticate! 'username', 'password'

Then, any calls made on viddler will be done using the correct session id.

If you want to record a video, you can request a record token during authentication:

viddler = Viddler::Client.new('your api key')
viddler.authenticate! 'username', 'password', true
puts viddler.record_token   # => the record token from API

The API returns a record token that's available for you.

Uploading

To upload a file, use the upload method:

viddler.upload(File.open('./myvideo.mov'), {
  :title       => 'My video',
  :description => 'This video is awesome!',
  :tags        => 'awesome'
})
Something went wrong with that request. Please try again.