0.01
No commit activity in last 3 years
No release in over 3 years
An API wrapper for Viddler's v2 API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0

Runtime

 Project Readme

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'
})