Coder Social home page Coder Social logo

ljuti / viddler-ruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from viddler/viddler-ruby

1.0 2.0 0.0 107 KB

A fork of the official gem for interacting with Viddler's V2 API. This fork adds record token support.

Home Page: http://developers.viddler.com

License: MIT License

Ruby 100.00%

viddler-ruby's Introduction

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

viddler-ruby's People

Contributors

kyleslattery avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.