Project

shelbytv

0.0
No commit activity in last 3 years
No release in over 3 years
A Shelby.tv API wrapper
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
~> 0.4.0
 Project Readme
 -----------
< Shelby.tv >
 -----------
  \
   \
      /\___)o<
     |      \
     | O . O|
      \_____/

Shelby.tv

This is a Ruby wrapper for the Shelby.tv API. It uses objects instead of hashes and add associations.

Installation

To install this gem systemwide:

gem install shelbytv

Install it as a gem (in your Gemfile) and its dependencies:

gem "shelbytv"

Usage

Get a Shelby object:

shelbytv = Shelbytv::Base.new("CONSUMER_KEY", "CONSUMER_SECRET",
                              "AUTH_TOKEN", "AUTH_SECRET")

Get current user:

user = shelbytv.user    # Returns a Shelbytv::User object

Get a user by id:

user = shelbytv.users.find('ID')  # Returns a Shelbytv::User object

Get the current users channels:

shelbytv.channels.all   # Returns an array for Shelbytv::Channel objects

# or

user.channels           # Returns an array for Shelbytv::Channel objects

Get a channels broadcasts:

channel.broadcasts    # Returns an array for Shelbytv::Broadcast objects

Authentication

First, you need to register your application.

Web server application

Get a Shelby object:

shelbytv = Shelbytv::Base.new("CONSUMER_KEY", "CONSUMER_SECRET")

Redirect users to the Shelby authentication page. You need to pass your callback_url. Get the url to redirect to with:

shelbytv.authorize_url("CALLBACK_SESSION_URL")

Then Shelby.tv will redirect the user to your callback url with a code parameter in the url. Exchange this code for an access token using:

access_token = shelbytv.access_token("OAUTH_VERIFIER")

Now you can get a Shelby using only an access token and make requests on user's behalf:

shelbytv.auth_token = access_token.token
shelbytv.auth_secret = access_token.secret

License

See LICENSE

Built at Hackday.tv