Skip to content

seatshare/seatgeek

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

SeatGeek Build Status

SeatGeek maintains a canonical directory of live events in the United States. The SeatGeek Platform makes it easy to construct applications that help users find and discover events by exposing the wealth of data and powerful search behind SeatGeek.com in an easy-to-consume format.

This Gem is designed to be a platform agnostic wrapper around the SeatGeek Platform API. Enjoy it and please let me know about anything really cool which uses it.

For more information, including a detailed description of the functionality available, visit The SeatGeek Platform documentation site.

Rubies supported

  • 1.9.2
  • 2.1.0

Installation

With Bundler In your Gemfile, add the following line

gem 'seatgeek', :require => 'seatgeek'

Without Bundler

gem install seatgeek

Usage

At the moment the interface is very simple. I have some additional features and classes planned (see TODO).

NOTE: Unless it is already defined in your application, SG will be defined as a shortcut class to SeatGeek::Connection. Accordingly, you can replace any instance of SeatGeek::Connection with SG (i.e. SG.events)

SeatGeek::Connection is where all the meat is.

You will first need to provide the client_id for your application. For assistance registering and locating your client_id, please see the platform documentation.

SeatGeek::Connection.client_id = 'some_client_id'

Each of the four endpoints can be accessed with a class method reflecting the endpoint's name.

SeatGeek::Connection.events
SeatGeek::Connection.performers
SeatGeek::Connection.taxonomies
SeatGeek::Connection.venues

Options can be passed in a hash to these methods and they will be included in the request.

#### Examples mirror documentation at http://platform.seatgeek.com ####
SeatGeek::Connection.events({:id => 801255})
# => GET http://api.seatgeek.com/2/events/801255
SeatGeek::Connection.events({:geoip => 98.213.245.205, :range => 12mi})
# => GET http://api.seatgeek.com/2/events?geoip=98.213.245.205&range=12mi

SeatGeek::Connection objects can be instantiated before calls. Any parameters passed into the call to #initialize will be passed along with all requests which are generated by that object.

@sg_50_pp = SeatGeek::Connection.new({:per_page => 50})
@sg_50_pp.events
# => GET http://api.seatgeek.com/2/events?per_page=50
@sg_50_pp.events({:page => 2})
# => GET http://api.seatgeek.com/2/events?per_page=50&page=2

There are a number of class level options that can be overridden.

SeatGeek::Connection.adapter          # the Faraday adapter to use (default: :net_http)
SeatGeek::Connection.logger           # a Logger object for logging requests (default: nil)
SeatGeek::Connection.protocol         # http or https (default: :http)
SeatGeek::Connection.response_format  # ruby, json, jsonp or xml (default: ruby)
SeatGeek::Connection.url              # api.seatgeek.com [Advanced tuning]
SeatGeek::Connection.version          # 2 [Forward thinking]

Example:

SeatGeek::Connection.protocol
# => :http
SeatGeek::Connection.protocol = :https
# => :https
SeatGeek::Connection.events
# => GET https://api.seatgeek.com/2/events

These options can also be overridden during instantiation of a SeatGeek::Connection

@secure = SeatGeek::Connection.new({:protocol => :https})
@secure.events
# => GET https://api.seatgeek.com/2/events

TODO

The following are features planned for later release. I'm happy to take requests and, of course, pull requests.

Endpoint Classes SeatGeek::Events / SeatGeek::Performers / SeatGeek::Venues / SeatGeek::Taxonomies

Endpoint #all method This will loop through the list response until it runs out of results.

Acknowledgements

DISCLAIMER / LEGAL

Copyright (c) 2012 Dan Matthews / Ticket Evolution (http://ticketevolution.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.