phish_dot_net_client 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +6 -0
- data/README.md +17 -13
- data/Rakefile +1 -1
- data/lib/phish_dot_net_client.rb +2 -1
- data/lib/phish_dot_net_client/version.rb +1 -1
- metadata +2 -2
data/History.md
CHANGED
data/README.md
CHANGED
@@ -4,8 +4,6 @@
|
|
4
4
|
|
5
5
|
A Phish.net API client, with support for parsing the 'setlistdata' field. Inspired by the other Ruby Phish.net API [client](http://api.phish.net/wrappers/ruby.php) written by [Stephen Blackstone](http://phish.net/user/steveb3210).
|
6
6
|
|
7
|
-
[rdoc](http://rubydoc.info/github/alexebird/phish_dot_net_client/master/frames/file/README.md)
|
8
|
-
|
9
7
|
|
10
8
|
## Install
|
11
9
|
|
@@ -24,21 +22,21 @@ Rubygems:
|
|
24
22
|
PhishDotNetClient.apikey = 'private-api-key'
|
25
23
|
PhishDotNetClient.authorize 'fluffhead', 'passwurd'
|
26
24
|
PhishDotNetClient.clear_auth # clears the stored apikey, username, and authkey
|
27
|
-
|
25
|
+
|
28
26
|
# Call API methods by replacing '.' with '_' in the method name
|
29
27
|
PhishDotNetClient.pnet_shows_setlists_latest
|
30
|
-
|
28
|
+
|
31
29
|
# The 'pnet_' prefix is optional
|
32
30
|
PhishDotNetClient.shows_setlists_latest
|
33
|
-
|
31
|
+
|
34
32
|
# Pass arguments to the API call with a hash
|
35
33
|
PhishDotNetClient.shows_setlists_get :showdate => '2013-07-31'
|
36
34
|
PhishDotNetClient.shows_query :month => '7', :country => 'USA', :state => 'CA'
|
37
|
-
|
35
|
+
|
38
36
|
# Arguments are not checked for validity before being passed
|
39
37
|
PhishDotNetClient.shows_setlists_get :fluff => 'head'
|
40
38
|
# => returns {"success" => 0,"reason" => "General API Error"}
|
41
|
-
|
39
|
+
|
42
40
|
# All methods return JSON parsed into Ruby Hashes/Arrays
|
43
41
|
tweez = PhishDotNetClient.shows_setlists_get :showdate => '2013-07-31'
|
44
42
|
# => [
|
@@ -46,15 +44,23 @@ Rubygems:
|
|
46
44
|
# "showdate" => "2013-07-31",
|
47
45
|
# "city" => "Stateline",
|
48
46
|
# "state" => "NV",
|
49
|
-
# "setlistdata" => #<PhishDotNetClient::Setlist
|
47
|
+
# "setlistdata" => #<PhishDotNetClient::Setlist ...>, ... }, ... ]
|
48
|
+
|
49
|
+
tweez.first["showdate"]
|
50
|
+
# => "2013-07-31"
|
50
51
|
|
51
52
|
See [Phish.net API docs](http://api.phish.net/docu/) for available API methods.
|
52
53
|
|
53
54
|
|
54
|
-
### setlistdata
|
55
|
+
### Parsing setlistdata
|
55
56
|
|
56
|
-
JSON objects that have a "setlistdata" will have that field parsed and replaced with
|
57
|
-
a [Setlist](http://rubydoc.info/github/alexebird/phish_dot_net_client/master/PhishDotNetClient/Setlist) object.
|
57
|
+
JSON objects that have a "setlistdata" field will have that field parsed and replaced with
|
58
|
+
a [Setlist](http://rubydoc.info/github/alexebird/phish_dot_net_client/master/PhishDotNetClient/Setlist) object.
|
59
|
+
|
60
|
+
|
61
|
+
## Docs
|
62
|
+
|
63
|
+
Check out the [documentation](http://rubydoc.info/github/alexebird/phish_dot_net_client/master/frames/file/README.md).
|
58
64
|
|
59
65
|
|
60
66
|
## Known Issues
|
@@ -62,7 +68,6 @@ a [Setlist](http://rubydoc.info/github/alexebird/phish_dot_net_client/master/Phi
|
|
62
68
|
- 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.
|
63
69
|
|
64
70
|
|
65
|
-
|
66
71
|
## Testing
|
67
72
|
|
68
73
|
To run specs:
|
@@ -70,4 +75,3 @@ To run specs:
|
|
70
75
|
bundle exec rake spec
|
71
76
|
|
72
77
|
Pull requests are welcome!
|
73
|
-
|
data/Rakefile
CHANGED
@@ -52,7 +52,7 @@ task :"release:instructions" do
|
|
52
52
|
puts "1. update version.rb"
|
53
53
|
puts "2. update History.md"
|
54
54
|
puts " git log #{last_release}..HEAD --no-merges --format=%B"
|
55
|
-
puts "3. git commit, git tag v#{version}, git push origin v#{version}"
|
55
|
+
puts "3. git commit -am 'v#{version}', git tag v#{version}, git push origin v#{version}"
|
56
56
|
puts "4. gem build #{gem_name}.gemspec ; mv #{gem_name}-#{version}.gem ~/gems/"
|
57
57
|
puts "5. gem push ~/gems/#{gem_name}-#{version}.gem"
|
58
58
|
end
|
data/lib/phish_dot_net_client.rb
CHANGED
@@ -57,8 +57,9 @@ module PhishDotNetClient
|
|
57
57
|
# The base URL for API calls
|
58
58
|
BASE_URL = "https://api.phish.net/api.js"
|
59
59
|
|
60
|
-
# "https://api.phish.net/api.js?api=2.0&method=pnet.shows.query&format=json&apikey=
|
60
|
+
# "https://api.phish.net/api.js?api=2.0&method=pnet.shows.query&format=json&apikey=XXX&year=2011"
|
61
61
|
|
62
|
+
# Default API parameters
|
62
63
|
DEFAULT_PARAMS = { api: "2.0",
|
63
64
|
format: "json" }
|
64
65
|
|