Project

flyticket

0.0
No commit activity in last 3 years
No release in over 3 years
Get Ruby objects from Ticketfly's JSON API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 0.10
~> 10.0
~> 3.0
~> 1.22

Runtime

~> 0.13
~> 0.2
 Project Readme

Flyticket

Gem Version Build Status

A Ruby gem for communicating with the Ticketfly REST API, built on HTTParty.

I want to hear from you! Let me know if you're finding Flyticket useful, or if you have suggestions on what would make it useful for your project. I'm currently using it to develop a new website for a Ticketfly "org." I just wanted a nice wrapper for the API, and the gems I looked at were defunct.

Example Usage

To query for events, use it like so:

past = Flyticket::Events.past(venue_id: 1, max_results: 3)
past.first.facebook_event_id  # --> FB event id for this venue's last show

Flyticket is opinionated about the result format -- it discards Ticketfly's outer wrapper (used for pagination) and converts the top-level hashes and the nested org and venue hashes into OpenStructs, leaving deeper hashes alone. So retrieving a deeply-nested attributes looks like this:

next_event = Flyticket::Events.upcoming(venue_id: 1, max_results: 1).first
next_event.image[:medium][:width] # --> 'Brooklyn Bowl'

upcoming = Flyticket::Events.upcoming(venue_id: 1, max_results: 3)
upcoming.first.venue.name  # --> 'Brooklyn Bowl'

Note how in the first example, image is a method, but deeper properties are accessed using hash keys. In the second example, because venue is a struct, the venue name can be accessed using a method (although [:name] works too).

Endpoints:

  • Events.list(options)
  • Events.upcoming(options)
  • Events.featured(options)
  • Events.past(options)
  • Events.just_announced(options)
  • Events.event(options)
  • Orgs.list(options)
  • Venues.list(options)

Some useful properties:

  • org_id
  • venue_id
  • event_id
  • max_results (capped by Ticketfly at 1000)
  • page_num (use when total results > max_results)
  • from_date
  • thru_date

Notes

Not attempting semantic versioning just yet because the API may change. (In particular, I may roll my own classes instead of using OpenStruct).

TODO

  • make original json available
  • handle fields & fieldGroup
  • if ticketfly paginates, fetch extra & concatenate
  • specs

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/johncip/flyticket.

License

The gem is available as open source under the terms of the MIT License.