0.0
No commit activity in last 3 years
No release in over 3 years
Dailymotion Open Graph API for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
~> 2.10.0

Runtime

 Project Readme

Dailymotion Build Status Dependency Status

Ruby bindings for the Dailymotion Graph API.

Note : this gem is unofficial and is not endorsed in any way by Dailymotion.

To authenticate your users with Dailymotion, I suggest you to use my Omniauth Dailymotion Strategy.

Installation

Add this line to your application's Gemfile:

gem 'dailymotion'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dailymotion

Usage

Get the list of the authenticated user videos:

daily_api = Dailymotion::API.new(token: "API_TOKEN")
resp = daily_api.get_connections("user", "me", "videos")

resp.body

Upload a video

First obtain an 'upload' URL :

req = daily_api.get_object "file", "upload"
url = req.body.upload_url

Then send a file to this URL, for example:

req = daily_api.upload_file "video.m4v", url
uploaded_file_url = req.body.url

Then post the video to Dailymotion :

req = daily_api.post_video(uploaded_file_url)

Refresh the access token

NOTE : in order to refresh the access token, you need to initialize or populate the options hash with client_id, client_secret and refresh_token.

daily_api = Dailymotion::API.new(client_id: "12345678", client_secret: "pipomolo", refresh_token: "blablabla")
daily_api.refresh_token!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request