No commit activity in last 3 years
No release in over 3 years
Calls any Phish.net API method. Supports authentication. Parses 'setlistdata' fields.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.0
~> 3.0
~> 2.14
~> 0.7.1
~> 0.8

Runtime

~> 1.6.0
~> 2.1.7
~> 1.6.7
 Project Readme

Phish.net API Client

Gem Version

A Phish.net API client, with support for parsing the 'setlistdata' field. Inspired by the other Ruby Phish.net API client written by Stephen Blackstone.

Install

Gemfile:

gem 'phish_dot_net_client'

Rubygems:

gem install phish_dot_net_client

Usage

# Setup frequently used parameters
PhishDotNetClient.apikey = 'private-api-key'
PhishDotNetClient.authorize 'fluffhead', 'passwurd'
PhishDotNetClient.clear_auth  # clears the stored apikey, username, and authkey

# Call API methods by replacing '.' with '_' in the method name
PhishDotNetClient.pnet_shows_setlists_latest

# The 'pnet_' prefix is optional
PhishDotNetClient.shows_setlists_latest

# Pass arguments to the API call with a hash
PhishDotNetClient.shows_setlists_get :showdate => '2013-07-31'
PhishDotNetClient.shows_query :month => '7', :country => 'USA', :state => 'CA'

# Arguments are not checked for validity before being passed
PhishDotNetClient.shows_setlists_get :fluff => 'head'
# => returns {"success" => 0,"reason" => "General API Error"}

# All methods return JSON parsed into Ruby Hashes/Arrays
tweez = PhishDotNetClient.shows_setlists_get :showdate => '2013-07-31'
# => [
#      {
#        "showdate" => "2013-07-31",
#            "city" => "Stateline",
#           "state" => "NV",
#     "setlistdata" => #<PhishDotNetClient::Setlist ...>, ... }, ... ]

tweez.first["showdate"]
# => "2013-07-31"

See Phish.net API docs for available API methods.

Parsing setlistdata

JSON objects that have a "setlistdata" field will have that field parsed and replaced with a Setlist object.

Docs

Check out the documentation.

Known Issues

  • Song titles with a ',' character don't get parsed correctly due to the ',' being interpreted as a boundary between song titles. See lib/phish_dot_net_client/setlist.rb#133 for the regex and parsing code.

Testing

To run specs:

bundle exec rake spec

Pull requests are welcome!