bandsintown 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/README.rdoc +24 -1
- data/Rakefile +1 -1
- data/lib/bandsintown.rb +1 -1
- data/lib/bandsintown/artist.rb +34 -18
- data/lib/bandsintown/event.rb +2 -3
- data/spec/bandsintown/artist_spec.rb +56 -27
- data/spec/bandsintown/event_spec.rb +6 -6
- data/website/index.html +25 -2
- data/website/index.txt +28 -1
- metadata +6 -7
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -26,7 +26,17 @@ For more information visit http://www.bandsintown.com/api/requests.
|
|
26
26
|
|
27
27
|
=== Find all upcoming events for a given artist
|
28
28
|
|
29
|
-
artist = Bandsintown::Artist.new(
|
29
|
+
artist = Bandsintown::Artist.new({
|
30
|
+
:name => "The Killers"
|
31
|
+
})
|
32
|
+
events = artist.events
|
33
|
+
|
34
|
+
=== Find all upcoming events for a given artist using mbid (music brainz id)
|
35
|
+
|
36
|
+
# 486af4f0-a79b-468f-be73-527cd4caf6ea => mbid for Slick Rick
|
37
|
+
artist = Bandsintown::Artist.new({
|
38
|
+
:mbid => "486af4f0-a79b-468f-be73-527cd4caf6ea"
|
39
|
+
})
|
30
40
|
events = artist.events
|
31
41
|
|
32
42
|
=== Find events this week around Boston, MA
|
@@ -45,6 +55,19 @@ For more information visit http://www.bandsintown.com/api/requests.
|
|
45
55
|
:end_date => 1.week.from_now
|
46
56
|
})
|
47
57
|
|
58
|
+
=== Find events this month for Ghostface Killah and Raekwon using mbid (music brainz id)
|
59
|
+
|
60
|
+
# 3b39abeb-0064-4eed-9ddd-ee47a45c54cb => mbid for Ghostface Killah
|
61
|
+
# 4e954b02-fae2-4bd7-9547-e055a6ac0527 => mbid for Raekwon
|
62
|
+
events = Bandsintown::Event.search({
|
63
|
+
:artists => [
|
64
|
+
'mbid_3b39abeb-0064-4eed-9ddd-ee47a45c54cb',
|
65
|
+
'mbid_4e954b02-fae2-4bd7-9547-e055a6ac0527'
|
66
|
+
],
|
67
|
+
:start_date => Time.now.beginning_of_month,
|
68
|
+
:end_date => Time.now.end_of_month
|
69
|
+
})
|
70
|
+
|
48
71
|
=== Find recommended events around Boston, MA for fans of Led Zeppelin
|
49
72
|
|
50
73
|
events = Bandsintown::Event.recommended({
|
data/Rakefile
CHANGED
data/lib/bandsintown.rb
CHANGED
@@ -14,7 +14,7 @@ require 'bandsintown/event'
|
|
14
14
|
require 'bandsintown/venue'
|
15
15
|
|
16
16
|
module Bandsintown
|
17
|
-
VERSION = '0.1.
|
17
|
+
VERSION = '0.1.2'
|
18
18
|
class APIError < StandardError; end
|
19
19
|
class << self
|
20
20
|
# All Bandsintown API requests require an app_id parameter for identification.
|
data/lib/bandsintown/artist.rb
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
module Bandsintown
|
2
2
|
class Artist < Base
|
3
3
|
|
4
|
-
attr_accessor :name, :events
|
4
|
+
attr_accessor :name, :bandsintown_url, :mbid, :events
|
5
5
|
|
6
|
-
def initialize(
|
7
|
-
@name = name
|
8
|
-
@
|
6
|
+
def initialize(options = {})
|
7
|
+
@name = options[:name]
|
8
|
+
@mbid = options[:mbid]
|
9
|
+
@bandsintown_url = options[:url] || build_bandsintown_url
|
9
10
|
end
|
10
11
|
|
11
12
|
#Returns an array of Bandsintown::Event objects for each of the artist's upcoming events available through bandsintown.com.
|
12
13
|
#See http://www.bandsintown.com/api/requests#artists-events for more information.
|
13
|
-
#
|
14
|
+
#Can be used with either artist name or mbid (music brainz id).
|
14
15
|
#====example:
|
15
|
-
#
|
16
|
+
# # using artist name
|
17
|
+
# artist = Bandsintown::Artist.new(:name => "Little Brother")
|
18
|
+
# upcoming_little_brother_events = artist.events
|
19
|
+
#
|
20
|
+
# # using mbid for Little Brother
|
21
|
+
# artist = Bandsintown::Artist.new(:mbid => "b929c0c9-5de0-4d87-8eb9-365ad1725629")
|
16
22
|
# upcoming_little_brother_events = artist.events
|
17
23
|
#
|
18
24
|
def events
|
@@ -20,13 +26,19 @@ module Bandsintown
|
|
20
26
|
@events = self.class.request_and_parse("#{api_name}/events").map { |event| Bandsintown::Event.build_from_json(event) }
|
21
27
|
end
|
22
28
|
|
23
|
-
#
|
29
|
+
# Used in api requests as the RESTful resource id for artists (http://api.bandsintown.com/artists/id/method).
|
30
|
+
# If @name is not nil, it will be URI escaped to generate the api_name. '/' and '?' must be double escaped.
|
31
|
+
# If @name is nil, @mbid is used with 'mbid_' prefixed.
|
24
32
|
#
|
25
33
|
def api_name
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
34
|
+
if @name
|
35
|
+
name = @name.dup
|
36
|
+
name.gsub!('/', CGI.escape('/'))
|
37
|
+
name.gsub!('?', CGI.escape('?'))
|
38
|
+
URI.escape(name)
|
39
|
+
else
|
40
|
+
"mbid_#{@mbid}"
|
41
|
+
end
|
30
42
|
end
|
31
43
|
|
32
44
|
def self.resource_path
|
@@ -36,13 +48,17 @@ module Bandsintown
|
|
36
48
|
private
|
37
49
|
|
38
50
|
def build_bandsintown_url
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
51
|
+
if @name
|
52
|
+
name = @name.dup
|
53
|
+
name.gsub!('&', 'And')
|
54
|
+
name.gsub!('+', 'Plus')
|
55
|
+
name = name.split.map { |w| w.capitalize }.join if name =~ /\s/
|
56
|
+
name.gsub!('/', CGI.escape('/'))
|
57
|
+
name.gsub!('?', CGI.escape('?'))
|
58
|
+
"http://www.bandsintown.com/#{URI.escape(name)}"
|
59
|
+
else
|
60
|
+
"http://www.bandsintown.com/mbid_#{@mbid}"
|
61
|
+
end
|
46
62
|
end
|
47
63
|
|
48
64
|
end
|
data/lib/bandsintown/event.rb
CHANGED
@@ -84,7 +84,7 @@ module Bandsintown
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def self.build_from_json(json_hash)
|
87
|
-
event = Bandsintown::Event.new
|
87
|
+
event = Bandsintown::Event.new
|
88
88
|
event.bandsintown_id = json_hash["id"]
|
89
89
|
event.bandsintown_url = json_hash["url"]
|
90
90
|
event.datetime = Time.parse(json_hash["datetime"])
|
@@ -93,8 +93,7 @@ module Bandsintown
|
|
93
93
|
event.ticket_status = json_hash["ticket_status"]
|
94
94
|
event.on_sale_datetime = Time.parse(json_hash["on_sale_datetime"]) rescue nil
|
95
95
|
event.venue = Bandsintown::Venue.new(json_hash["venue"])
|
96
|
-
event.artists = []
|
97
|
-
json_hash["artists"].each { |artist| event.artists << Bandsintown::Artist.new(artist["name"], artist["url"]) }
|
96
|
+
event.artists = json_hash["artists"].map { |artist| Bandsintown::Artist.new(artist.symbolize_keys) }
|
98
97
|
event
|
99
98
|
end
|
100
99
|
|
@@ -3,70 +3,95 @@ require File.dirname(__FILE__) + '/../spec_helper.rb'
|
|
3
3
|
describe Bandsintown::Artist do
|
4
4
|
|
5
5
|
before(:each) do
|
6
|
-
@
|
7
|
-
|
8
|
-
|
6
|
+
@options = {
|
7
|
+
:name => 'Little Brother',
|
8
|
+
:url => 'http://www.bandsintown.com/LittleBrother',
|
9
|
+
:mbid => 'b929c0c9-5de0-4d87-8eb9-365ad1725629'
|
10
|
+
}
|
11
|
+
@artist = Bandsintown::Artist.new(@options)
|
9
12
|
end
|
10
13
|
|
11
|
-
describe "
|
12
|
-
it "should
|
13
|
-
@artist.
|
14
|
+
describe "attributes" do
|
15
|
+
it "should have an attr_accessor for @name" do
|
16
|
+
@artist.should respond_to(:name)
|
17
|
+
@artist.should respond_to(:name=)
|
14
18
|
end
|
15
|
-
it "should
|
16
|
-
@artist.
|
19
|
+
it "should have an attr_accessor for @bandsintown_url" do
|
20
|
+
@artist.should respond_to(:bandsintown_url)
|
21
|
+
@artist.should respond_to(:bandsintown_url=)
|
22
|
+
end
|
23
|
+
it "should have an attr_accessor for @mbid" do
|
24
|
+
@artist.should respond_to(:mbid)
|
25
|
+
@artist.should respond_to(:mbid=)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe ".initialize(options = {})" do
|
30
|
+
it "should set the Artist name from options" do
|
31
|
+
@artist.name.should == @options[:name]
|
32
|
+
end
|
33
|
+
it "should set the Artist bandsintown_url from options" do
|
34
|
+
@artist.bandsintown_url.should == @options[:url]
|
35
|
+
end
|
36
|
+
it "should set the Artist mbid from options" do
|
37
|
+
@artist.mbid.should == @options[:mbid]
|
17
38
|
end
|
18
39
|
|
19
|
-
describe "generating a url (
|
40
|
+
describe "generating a url (initialized without an option for :url)" do
|
20
41
|
it "should strip spaces" do
|
21
42
|
name = "The Beatles "
|
22
|
-
Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/TheBeatles"
|
43
|
+
Bandsintown::Artist.new(:name => name).bandsintown_url.should == "http://www.bandsintown.com/TheBeatles"
|
23
44
|
end
|
24
45
|
it "should convert '&' -> 'And'" do
|
25
46
|
name = "Meg & Dia"
|
26
|
-
Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/MegAndDia"
|
47
|
+
Bandsintown::Artist.new(:name => name).bandsintown_url.should == "http://www.bandsintown.com/MegAndDia"
|
27
48
|
end
|
28
49
|
it "should convert '+' -> 'Plus'" do
|
29
50
|
name = "+44"
|
30
|
-
Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/Plus44"
|
51
|
+
Bandsintown::Artist.new(:name => name).bandsintown_url.should == "http://www.bandsintown.com/Plus44"
|
31
52
|
end
|
32
53
|
it "should camelcase seperate words" do
|
33
54
|
name = "meg & dia"
|
34
|
-
Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/MegAndDia"
|
55
|
+
Bandsintown::Artist.new(:name => name).bandsintown_url.should == "http://www.bandsintown.com/MegAndDia"
|
35
56
|
end
|
36
57
|
it "should not cgi escape url" do
|
37
58
|
name = "$up"
|
38
|
-
Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/$up"
|
59
|
+
Bandsintown::Artist.new(:name => name).bandsintown_url.should == "http://www.bandsintown.com/$up"
|
39
60
|
end
|
40
61
|
it "should uri escape accented characters" do
|
41
62
|
name = "sigur rós"
|
42
|
-
Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/SigurR%C3%B3s"
|
63
|
+
Bandsintown::Artist.new(:name => name).bandsintown_url.should == "http://www.bandsintown.com/SigurR%C3%B3s"
|
43
64
|
end
|
44
65
|
it "should not alter the case of single word names" do
|
45
66
|
name = "AWOL"
|
46
|
-
Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/AWOL"
|
67
|
+
Bandsintown::Artist.new(:name => name).bandsintown_url.should == "http://www.bandsintown.com/AWOL"
|
47
68
|
end
|
48
69
|
it "should allow dots" do
|
49
70
|
name = "M.I.A"
|
50
|
-
Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/M.I.A"
|
71
|
+
Bandsintown::Artist.new(:name => name).bandsintown_url.should == "http://www.bandsintown.com/M.I.A"
|
51
72
|
end
|
52
73
|
it "should allow exclamations" do
|
53
74
|
name = "against me!"
|
54
|
-
Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/AgainstMe!"
|
75
|
+
Bandsintown::Artist.new(:name => name).bandsintown_url.should == "http://www.bandsintown.com/AgainstMe!"
|
55
76
|
end
|
56
|
-
it "should not modify @name" do
|
77
|
+
it "should not modify @options[:name]" do
|
57
78
|
name = "this is how i think"
|
58
|
-
Bandsintown::Artist.new(name)
|
79
|
+
Bandsintown::Artist.new(:name => name)
|
59
80
|
name.should == "this is how i think"
|
60
81
|
end
|
61
82
|
it "should cgi escape '/' so it will be double encoded" do
|
62
83
|
name = "AC/DC"
|
63
84
|
escaped_name = URI.escape(name.gsub('/', CGI.escape('/')))
|
64
|
-
Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/#{escaped_name}"
|
85
|
+
Bandsintown::Artist.new(:name => name).bandsintown_url.should == "http://www.bandsintown.com/#{escaped_name}"
|
65
86
|
end
|
66
87
|
it "should cgi escape '?' so it will be double encoded" do
|
67
88
|
name = "Does it offend you, yeah?"
|
68
89
|
escaped_name = URI.escape("DoesItOffendYou,Yeah#{CGI.escape('?')}")
|
69
|
-
Bandsintown::Artist.new(name).bandsintown_url.should == "http://www.bandsintown.com/#{escaped_name}"
|
90
|
+
Bandsintown::Artist.new(:name => name).bandsintown_url.should == "http://www.bandsintown.com/#{escaped_name}"
|
91
|
+
end
|
92
|
+
it "should use @mbid only if @name is nil" do
|
93
|
+
Bandsintown::Artist.new(:name => 'name', :mbid => 'mbid').bandsintown_url.should == 'http://www.bandsintown.com/name'
|
94
|
+
Bandsintown::Artist.new(:mbid => '1234').bandsintown_url.should == 'http://www.bandsintown.com/mbid_1234'
|
70
95
|
end
|
71
96
|
end
|
72
97
|
end
|
@@ -79,11 +104,11 @@ describe Bandsintown::Artist do
|
|
79
104
|
|
80
105
|
describe "#events" do
|
81
106
|
before(:each) do
|
82
|
-
@artist = Bandsintown::Artist.new("Little Brother")
|
107
|
+
@artist = Bandsintown::Artist.new(:name => "Little Brother")
|
83
108
|
end
|
84
109
|
it "should request and parse a call to the BIT artist events API method and the artist's api name" do
|
85
|
-
@artist.should_receive(:api_name).and_return(
|
86
|
-
Bandsintown::Artist.should_receive(:request_and_parse).with("Little
|
110
|
+
@artist.should_receive(:api_name).and_return('Little%20Brother')
|
111
|
+
Bandsintown::Artist.should_receive(:request_and_parse).with("Little%20Brother/events").and_return([])
|
87
112
|
@artist.events
|
88
113
|
end
|
89
114
|
it "should return an Array of Bandsintown::Event objects built from the response" do
|
@@ -107,8 +132,12 @@ describe Bandsintown::Artist do
|
|
107
132
|
@artist.api_name.should == URI.escape(@artist.name)
|
108
133
|
end
|
109
134
|
it "should CGI escape / and ? characters before URI escaping the whole name" do
|
110
|
-
Bandsintown::Artist.new("AC/DC").api_name.should == URI.escape(CGI.escape("AC/DC"))
|
111
|
-
Bandsintown::Artist.new("?uestlove").api_name.should == URI.escape(CGI.escape("?uestlove"))
|
135
|
+
Bandsintown::Artist.new(:name => "AC/DC").api_name.should == URI.escape(CGI.escape("AC/DC"))
|
136
|
+
Bandsintown::Artist.new(:name => "?uestlove").api_name.should == URI.escape(CGI.escape("?uestlove"))
|
137
|
+
end
|
138
|
+
it "should use 'mbid_<@mbid>' only if @name is nil" do
|
139
|
+
Bandsintown::Artist.new(:name => 'name', :mbid => 'mbid').api_name.should == 'name'
|
140
|
+
Bandsintown::Artist.new(:mbid => '1234').api_name.should == 'mbid_1234'
|
112
141
|
end
|
113
142
|
end
|
114
143
|
end
|
@@ -62,8 +62,8 @@ describe Bandsintown::Event do
|
|
62
62
|
@datetime = "2008-09-30T19:30:00"
|
63
63
|
@ticket_url = "http://www.bandsintown.com/event/745095/buy_tickets"
|
64
64
|
|
65
|
-
@artist_1 = { "name" => "Little Brother", "url" => "http://www.bandsintown.com/LittleBrother" }
|
66
|
-
@artist_2 = { "name" => "Joe Scudda", "url" => "http://www.bandsintown.com/JoeScudda" }
|
65
|
+
@artist_1 = { "name" => "Little Brother", "url" => "http://www.bandsintown.com/LittleBrother", "mbid" => "b929c0c9-5de0-4d87-8eb9-365ad1725629" }
|
66
|
+
@artist_2 = { "name" => "Joe Scudda", "url" => "http://www.bandsintown.com/JoeScudda", "mbid" => nil } # sorry Joe its just an example
|
67
67
|
|
68
68
|
@venue_hash = {
|
69
69
|
"id" => 327987,
|
@@ -125,10 +125,10 @@ describe Bandsintown::Event do
|
|
125
125
|
@built_event.venue.should == built_venue
|
126
126
|
end
|
127
127
|
it "should set the Event's Artists" do
|
128
|
-
built_artist_1 = mock(Bandsintown::Artist
|
129
|
-
built_artist_2 = mock(Bandsintown::Artist
|
130
|
-
Bandsintown::Artist.should_receive(:new).with(@artist_1["name"], @artist_1["url"]).and_return(built_artist_1)
|
131
|
-
Bandsintown::Artist.should_receive(:new).with(@artist_2["name"], @artist_2["url"]).and_return(built_artist_2)
|
128
|
+
built_artist_1 = mock(Bandsintown::Artist)
|
129
|
+
built_artist_2 = mock(Bandsintown::Artist)
|
130
|
+
Bandsintown::Artist.should_receive(:new).with(:name => @artist_1["name"], :url => @artist_1["url"], :mbid => @artist_1["mbid"]).and_return(built_artist_1)
|
131
|
+
Bandsintown::Artist.should_receive(:new).with(:name => @artist_2["name"], :url => @artist_2["url"], :mbid => @artist_2["mbid"]).and_return(built_artist_2)
|
132
132
|
@built_event = Bandsintown::Event.build_from_json(@event_hash)
|
133
133
|
@built_event.artists.should == [built_artist_1, built_artist_2]
|
134
134
|
end
|
data/website/index.html
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
<div class="sidebar">
|
35
35
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/bandsintown"; return false'>
|
36
36
|
<p>Get Version</p>
|
37
|
-
<a href="http://rubyforge.org/projects/bandsintown" class="numbers">0.1.
|
37
|
+
<a href="http://rubyforge.org/projects/bandsintown" class="numbers">0.1.2</a>
|
38
38
|
</div>
|
39
39
|
</div>
|
40
40
|
<h2>Description</h2>
|
@@ -53,7 +53,17 @@
|
|
53
53
|
</pre></p>
|
54
54
|
<h3>Find all upcoming events for a given artist</h3>
|
55
55
|
<p><pre class='syntax'>
|
56
|
-
<span class="ident">artist</span> <span class="punct">=</span> <span class="constant">Bandsintown</span><span class="punct">::</span><span class="constant">Artist</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(
|
56
|
+
<span class="ident">artist</span> <span class="punct">=</span> <span class="constant">Bandsintown</span><span class="punct">::</span><span class="constant">Artist</span><span class="punct">.</span><span class="ident">new</span><span class="punct">({</span>
|
57
|
+
<span class="symbol">:name</span> <span class="punct">=></span> <span class="punct">'</span><span class="string">The Killers</span><span class="punct">'</span>
|
58
|
+
<span class="punct">})</span>
|
59
|
+
<span class="ident">events</span> <span class="punct">=</span> <span class="ident">artist</span><span class="punct">.</span><span class="ident">events</span>
|
60
|
+
</pre></p>
|
61
|
+
<h3>Find all upcoming events for a given artist using mbid (music brainz id)</h3>
|
62
|
+
<p><pre class='syntax'>
|
63
|
+
<span class="comment"># 486af4f0-a79b-468f-be73-527cd4caf6ea => mbid for Slick Rick</span>
|
64
|
+
<span class="ident">artist</span> <span class="punct">=</span> <span class="constant">Bandsintown</span><span class="punct">::</span><span class="constant">Artist</span><span class="punct">.</span><span class="ident">new</span><span class="punct">({</span>
|
65
|
+
<span class="symbol">:mbid</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">486af4f0-a79b-468f-be73-527cd4caf6ea</span><span class="punct">"</span>
|
66
|
+
<span class="punct">})</span>
|
57
67
|
<span class="ident">events</span> <span class="punct">=</span> <span class="ident">artist</span><span class="punct">.</span><span class="ident">events</span>
|
58
68
|
</pre></p>
|
59
69
|
<h3>Find events this week around Boston, MA</h3>
|
@@ -72,6 +82,19 @@
|
|
72
82
|
<span class="symbol">:end_date</span> <span class="punct">=></span> <span class="number">1</span><span class="punct">.</span><span class="ident">week</span><span class="punct">.</span><span class="ident">from_now</span>
|
73
83
|
<span class="punct">})</span>
|
74
84
|
</pre></p>
|
85
|
+
<h3>Find events this month for Ghostface Killah and Raekwon using mbid (music brainz id)</h3>
|
86
|
+
<p><pre class='syntax'>
|
87
|
+
<span class="comment"># 3b39abeb-0064-4eed-9ddd-ee47a45c54cb => mbid for Ghostface Killah</span>
|
88
|
+
<span class="comment"># 4e954b02-fae2-4bd7-9547-e055a6ac0527 => mbid for Raekwon</span>
|
89
|
+
<span class="ident">events</span> <span class="punct">=</span> <span class="constant">Bandsintown</span><span class="punct">::</span><span class="constant">Event</span><span class="punct">.</span><span class="ident">search</span><span class="punct">({</span>
|
90
|
+
<span class="symbol">:artists</span> <span class="punct">=></span> <span class="punct">[</span>
|
91
|
+
<span class="punct">'</span><span class="string">mbid_3b39abeb-0064-4eed-9ddd-ee47a45c54cb</span><span class="punct">',</span>
|
92
|
+
<span class="punct">'</span><span class="string">mbid_4e954b02-fae2-4bd7-9547-e055a6ac0527</span><span class="punct">'</span>
|
93
|
+
<span class="punct">],</span>
|
94
|
+
<span class="symbol">:start_date</span> <span class="punct">=></span> <span class="constant">Time</span><span class="punct">.</span><span class="ident">now</span><span class="punct">.</span><span class="ident">beginning_of_month</span><span class="punct">,</span>
|
95
|
+
<span class="symbol">:end_date</span> <span class="punct">=></span> <span class="constant">Time</span><span class="punct">.</span><span class="ident">now</span><span class="punct">.</span><span class="ident">end_of_month</span>
|
96
|
+
<span class="punct">})</span>
|
97
|
+
</pre></p>
|
75
98
|
<h3>Find recommended events around Boston, MA for fans of Led Zeppelin</h3>
|
76
99
|
<p><pre class='syntax'>
|
77
100
|
<span class="ident">events</span> <span class="punct">=</span> <span class="constant">Bandsintown</span><span class="punct">::</span><span class="constant">Event</span><span class="punct">.</span><span class="ident">recommended</span><span class="punct">({</span>
|
data/website/index.txt
CHANGED
@@ -29,7 +29,19 @@ Bandsintown.app_id = 'YOUR_APP_ID'
|
|
29
29
|
h3. Find all upcoming events for a given artist
|
30
30
|
|
31
31
|
<pre syntax="ruby">
|
32
|
-
artist = Bandsintown::Artist.new(
|
32
|
+
artist = Bandsintown::Artist.new({
|
33
|
+
:name => 'The Killers'
|
34
|
+
})
|
35
|
+
events = artist.events
|
36
|
+
</pre>
|
37
|
+
|
38
|
+
h3. Find all upcoming events for a given artist using mbid (music brainz id)
|
39
|
+
|
40
|
+
<pre syntax="ruby">
|
41
|
+
# 486af4f0-a79b-468f-be73-527cd4caf6ea => mbid for Slick Rick
|
42
|
+
artist = Bandsintown::Artist.new({
|
43
|
+
:mbid => "486af4f0-a79b-468f-be73-527cd4caf6ea"
|
44
|
+
})
|
33
45
|
events = artist.events
|
34
46
|
</pre>
|
35
47
|
|
@@ -53,6 +65,21 @@ events = Bandsintown::Event.search({
|
|
53
65
|
})
|
54
66
|
</pre>
|
55
67
|
|
68
|
+
h3. Find events this month for Ghostface Killah and Raekwon using mbid (music brainz id)
|
69
|
+
|
70
|
+
<pre syntax="ruby">
|
71
|
+
# 3b39abeb-0064-4eed-9ddd-ee47a45c54cb => mbid for Ghostface Killah
|
72
|
+
# 4e954b02-fae2-4bd7-9547-e055a6ac0527 => mbid for Raekwon
|
73
|
+
events = Bandsintown::Event.search({
|
74
|
+
:artists => [
|
75
|
+
'mbid_3b39abeb-0064-4eed-9ddd-ee47a45c54cb',
|
76
|
+
'mbid_4e954b02-fae2-4bd7-9547-e055a6ac0527'
|
77
|
+
],
|
78
|
+
:start_date => Time.now.beginning_of_month,
|
79
|
+
:end_date => Time.now.end_of_month
|
80
|
+
})
|
81
|
+
</pre>
|
82
|
+
|
56
83
|
h3. Find recommended events around Boston, MA for fans of Led Zeppelin
|
57
84
|
|
58
85
|
<pre syntax="ruby">
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bandsintown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Costanza
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-12 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.2
|
43
|
+
version: 1.5.2
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: hoe
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 2.3.3
|
54
54
|
version:
|
55
55
|
description: |-
|
56
56
|
Bandsintown.com API gem
|
@@ -69,7 +69,6 @@ extensions: []
|
|
69
69
|
extra_rdoc_files:
|
70
70
|
- History.txt
|
71
71
|
- Manifest.txt
|
72
|
-
- README.rdoc
|
73
72
|
- website/index.txt
|
74
73
|
files:
|
75
74
|
- History.txt
|
@@ -106,7 +105,7 @@ licenses: []
|
|
106
105
|
post_install_message:
|
107
106
|
rdoc_options:
|
108
107
|
- --main
|
109
|
-
- README.
|
108
|
+
- README.txt
|
110
109
|
require_paths:
|
111
110
|
- lib
|
112
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -124,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
123
|
requirements: []
|
125
124
|
|
126
125
|
rubyforge_project: bandsintown
|
127
|
-
rubygems_version: 1.3.
|
126
|
+
rubygems_version: 1.3.5
|
128
127
|
signing_key:
|
129
128
|
specification_version: 3
|
130
129
|
summary: Bandsintown.com API gem A Ruby library for accessing the Bandsintown API
|