bandsintown 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +8 -0
- data/README.rdoc +29 -0
- data/lib/bandsintown.rb +1 -1
- data/lib/bandsintown/artist.rb +52 -0
- data/lib/bandsintown/connection.rb +2 -2
- data/lib/bandsintown/event.rb +27 -2
- data/spec/bandsintown/artist_spec.rb +39 -0
- data/spec/bandsintown/base_spec.rb +4 -1
- data/spec/bandsintown/connection_spec.rb +34 -28
- data/spec/bandsintown/event_spec.rb +25 -5
- data/website/index.html +29 -1
- data/website/index.txt +36 -0
- metadata +5 -5
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 0.3.1 2010-07-05
|
2
|
+
* Fixed bug for API methods with a blank method name in the route (events - create and artists - create), "/artists/" => "/artists"
|
3
|
+
|
4
|
+
== 0.3.0 2010-07-04
|
5
|
+
* Added Events - Cancel API method (Bandsintown::Event#cancel)
|
6
|
+
* Added Artists - Cancel Event API method (Bandsintown::Artist#cancel_event)
|
7
|
+
* Added Artists - Create API method (Bandsintown::Artist.create)
|
8
|
+
|
1
9
|
== 0.2.0 2010-06-03
|
2
10
|
* Added Events - Create API method (Bandsintown::Event.create)
|
3
11
|
|
data/README.rdoc
CHANGED
@@ -149,6 +149,35 @@ For more information visit http://www.bandsintown.com/api/requests.
|
|
149
149
|
:on_sale_datetime => "2010-05-01T19:30:00"
|
150
150
|
})
|
151
151
|
|
152
|
+
=== Cancel an event on bandsintown.com
|
153
|
+
|
154
|
+
events = Bandsintown::Event.search(:location => "San Diego, CA")
|
155
|
+
event = events.first
|
156
|
+
event.cancel
|
157
|
+
|
158
|
+
|
159
|
+
=== Cancel an event on bandsintown.com for a single artist
|
160
|
+
|
161
|
+
artist = Bandsintown::Artist.new(:name => "Diamond District")
|
162
|
+
events = artist.events
|
163
|
+
event_id = events.first.bandsintown_id
|
164
|
+
artist.cancel_event(event_id)
|
165
|
+
|
166
|
+
=== Create an artist on bandsintown.com with name, music brainz id, myspace url, and website
|
167
|
+
|
168
|
+
artist = Bandsintown::Artist.create({
|
169
|
+
:name => "A New Artist",
|
170
|
+
:mbid => "abcd1234-abcd-1234-abcd-12345678abcd",
|
171
|
+
:myspace_url => "http://www.myspace.com/anewartist",
|
172
|
+
:website => "http://www.a-new-artist.com"
|
173
|
+
})
|
174
|
+
|
175
|
+
=== Create an artist on bandsintown.com with name only (all other parameters optional)
|
176
|
+
|
177
|
+
artist = Bandsintown::Artist.create({
|
178
|
+
:name => "A New Artist"
|
179
|
+
})
|
180
|
+
|
152
181
|
== Links
|
153
182
|
|
154
183
|
* RDoc[http://bandsintown.rubyforge.org/rdoc]
|
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.
|
17
|
+
VERSION = '0.3.1'
|
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
@@ -57,6 +57,58 @@ module Bandsintown
|
|
57
57
|
(@upcoming_events_count || @events.size) > 0
|
58
58
|
end
|
59
59
|
|
60
|
+
#This method is used to create an artist on bandsintown.com.
|
61
|
+
#If successful, it will return a Bandsintown::Artist object with the same data as a Bandsintown::Artist.get response.
|
62
|
+
#If you attempt to create an artist that already exists, the existing artist will be returned.
|
63
|
+
#See http://www.bandsintown.com/api/requests#artists-create for more information.
|
64
|
+
#
|
65
|
+
#====options
|
66
|
+
# * :name - artist name
|
67
|
+
# * :mbid - music brainz id
|
68
|
+
# * :myspace_url - url
|
69
|
+
# * :website - url
|
70
|
+
#
|
71
|
+
#====notes
|
72
|
+
# * :name is required, all other arguments are optional.
|
73
|
+
# * :mbid is uuid format, for example : "abcd1234-abcd-1234-abcd-12345678abcd"
|
74
|
+
# * :myspace_url must be from either myspace.com or www.myspace.com
|
75
|
+
#
|
76
|
+
#====examples
|
77
|
+
#Create an artist with full data:
|
78
|
+
# Bandsintown::Artist.create(:name => "A New Artist", :mbid => "abcd1234-abcd-1234-abcd-12345678abcd", :myspace_url => "http://www.myspace.com/anewartist", :website => "http://www.a-new-artist.com")
|
79
|
+
#
|
80
|
+
#Create an artist with name only:
|
81
|
+
# Bandsintown::Artist.create(:name => "A New Artist")
|
82
|
+
#
|
83
|
+
def self.create(options)
|
84
|
+
build_from_json(self.request_and_parse(:post, "", :artist => options))
|
85
|
+
end
|
86
|
+
|
87
|
+
#This is used to cancel an event on Bandsintown for a single artist. If you want to cancel the entire event (all artists), use Bandsintown::Event#cancel.
|
88
|
+
#If successful, this method will always return a status message.
|
89
|
+
#Unless you have a trusted app_id, events added or removed through the API will need to be approved before the changes are seen live.
|
90
|
+
#Contact Bandsintown if you are often adding events and would like a trusted account.
|
91
|
+
#See http://www.bandsintown.com/api/requests#artists-cancel-event for more information.
|
92
|
+
#
|
93
|
+
#====examples:
|
94
|
+
#Cancel an artist's event with a non-trusted app_id:
|
95
|
+
# artist = Bandsintown::Artist.new(:name => "Little Brother")
|
96
|
+
# event_id = 12345
|
97
|
+
# artist.cancel_event(event_id)
|
98
|
+
# => "Event successfully cancelled (Pending Approval)"
|
99
|
+
#
|
100
|
+
#Cancel an artist's event with a trusted app_id:
|
101
|
+
# artist = Bandsintown::Artist.new(:name => "Little Brother")
|
102
|
+
# event_id = 12345
|
103
|
+
# artist.cancel_event(event_id)
|
104
|
+
# => "Event successfully cancelled"
|
105
|
+
#
|
106
|
+
def cancel_event(event_id)
|
107
|
+
raise StandardError.new("event cancellation requires a bandsintown_id") if event_id.blank?
|
108
|
+
response = self.class.request_and_parse(:post, "#{api_name}/events/#{event_id}/cancel")
|
109
|
+
response["message"]
|
110
|
+
end
|
111
|
+
|
60
112
|
#Returns a Bandsintown::Artist object with basic information for a single artist, including the number of upcoming events.
|
61
113
|
#Useful in determining if an artist is on tour without requesting the event data.
|
62
114
|
#See http://www.bandsintown.com/api/requests#artists-get for more information.
|
@@ -7,7 +7,7 @@ module Bandsintown
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def get(resource_path, method_path, params = {})
|
10
|
-
request_url =
|
10
|
+
request_url = File.join([@base_url, resource_path, method_path].reject(&:blank?)) + "?" + encode(params.symbolize_keys)
|
11
11
|
begin
|
12
12
|
RestClient.get(request_url)
|
13
13
|
rescue RestClient::ResourceNotFound => error_response
|
@@ -16,7 +16,7 @@ module Bandsintown
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def post(resource_path, method_path, body = {})
|
19
|
-
request_url =
|
19
|
+
request_url = File.join([@base_url, resource_path, method_path].reject(&:blank?)) + "?" + encode({})
|
20
20
|
begin
|
21
21
|
RestClient.post(request_url, body.to_json, :content_type => :json, :accept => :json)
|
22
22
|
rescue RestClient::ResourceNotFound => error_response
|
data/lib/bandsintown/event.rb
CHANGED
@@ -157,7 +157,7 @@ module Bandsintown
|
|
157
157
|
end
|
158
158
|
|
159
159
|
#This is used to create an event on bandsintown.com.
|
160
|
-
#Unless you have a trusted app_id, events added through the API will need to be approved before
|
160
|
+
#Unless you have a trusted app_id, events added or removed through the API will need to be approved before the changes are seen live.
|
161
161
|
#Contact Bandsintown if you are often adding events and would like a trusted account.
|
162
162
|
#See http://www.bandsintown.com/api/requests#events-create for more information.
|
163
163
|
#===options:
|
@@ -211,7 +211,7 @@ module Bandsintown
|
|
211
211
|
:ticket_price => options[:ticket_price]
|
212
212
|
}.reject { |k,v| v.blank? }
|
213
213
|
|
214
|
-
response = self.request_and_parse(:post, "
|
214
|
+
response = self.request_and_parse(:post, "", :event => event_data)
|
215
215
|
|
216
216
|
if response.key?("message")
|
217
217
|
response["message"]
|
@@ -220,6 +220,31 @@ module Bandsintown
|
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
+
#This is used to cancel an event on Bandsintown. If you want to remove a single artist from an event, use Bandsintown::Artist#cancel_event instead.
|
224
|
+
#If successful, this method will always return a status message.
|
225
|
+
#Unless you have a trusted app_id, events added or removed through the API will need to be approved before the changes are seen live.
|
226
|
+
#Contact Bandsintown if you are often adding events and would like a trusted account.
|
227
|
+
#See http://www.bandsintown.com/api/requests#events-cancel for more information.
|
228
|
+
#
|
229
|
+
#====examples:
|
230
|
+
#Cancel an event with a non-trusted app_id:
|
231
|
+
# events = Bandsintown::Event.search(:location => "San Diego, CA")
|
232
|
+
# event = events.first
|
233
|
+
# event.cancel
|
234
|
+
# => "Event successfully cancelled (Pending Approval)"
|
235
|
+
#
|
236
|
+
#Cancel an event with a trusted app_id:
|
237
|
+
# events = Bandsintown::Event.search(:location => "San Diego, CA")
|
238
|
+
# event = events.first
|
239
|
+
# event.cancel
|
240
|
+
# => "Event successfully cancelled"
|
241
|
+
#
|
242
|
+
def cancel
|
243
|
+
raise StandardError.new("event cancellation requires a bandsintown_id") if @bandsintown_id.blank?
|
244
|
+
response = self.class.request_and_parse(:post, "#{@bandsintown_id}/cancel")
|
245
|
+
response["message"]
|
246
|
+
end
|
247
|
+
|
223
248
|
def self.resource_path
|
224
249
|
"events"
|
225
250
|
end
|
@@ -220,4 +220,43 @@ describe Bandsintown::Artist do
|
|
220
220
|
end
|
221
221
|
end
|
222
222
|
end
|
223
|
+
|
224
|
+
describe "#cancel_event(event_id)" do
|
225
|
+
before(:each) do
|
226
|
+
@event_id = 12345
|
227
|
+
@artist = Bandsintown::Artist.new(:name => "Little Brother")
|
228
|
+
@response = { "message" => "Event successfully cancelled (pending approval)" }
|
229
|
+
Bandsintown::Artist.stub!(:request_and_parse).and_return(@response)
|
230
|
+
end
|
231
|
+
it "should request and parse a call to the BIT artists - cancel event API method using the artist's api_name and the given event_id" do
|
232
|
+
Bandsintown::Artist.should_receive(:request_and_parse).with(:post, "#{@artist.api_name}/events/#{@event_id}/cancel").and_return(@response)
|
233
|
+
@artist.cancel_event(@event_id)
|
234
|
+
end
|
235
|
+
it "should return the response message if an event was successfully cancelled" do
|
236
|
+
@artist.cancel_event(@event_id).should == @response["message"]
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
describe ".create(options = {})" do
|
241
|
+
before(:each) do
|
242
|
+
@options = {
|
243
|
+
:name => "A New Artist",
|
244
|
+
:myspace_url => "http://www.myspace.com/a_new_artist",
|
245
|
+
:mbid => "abcd1234-abcd-1234-5678-abcd12345678",
|
246
|
+
:website => "http://www.a-new-artist.com"
|
247
|
+
}
|
248
|
+
Bandsintown::Artist.stub!(:request_and_parse).and_return('json')
|
249
|
+
Bandsintown::Artist.stub!(:build_from_json).and_return('built artist')
|
250
|
+
end
|
251
|
+
it "should request and parse a call to the BIT artists - create API method using the supplied artist data" do
|
252
|
+
expected_params = { :artist => @options }
|
253
|
+
Bandsintown::Artist.should_receive(:request_and_parse).with(:post, "", expected_params).and_return('json')
|
254
|
+
Bandsintown::Artist.create(@options)
|
255
|
+
end
|
256
|
+
it "should return the result of Bandsintown::Artist.build_from_json with the response data" do
|
257
|
+
Bandsintown::Artist.should_receive(:build_from_json).with('json').and_return('built artist')
|
258
|
+
Bandsintown::Artist.create(@options).should == 'built artist'
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
223
262
|
end
|
@@ -6,9 +6,12 @@ describe Bandsintown::Base do
|
|
6
6
|
it "should be an instance of Bandsintown::Connection" do
|
7
7
|
Bandsintown::Base.connection.class.should == Bandsintown::Connection
|
8
8
|
end
|
9
|
-
it "should be
|
9
|
+
it "should be memoized" do
|
10
10
|
Bandsintown::Base.connection.should === Bandsintown::Base.connection
|
11
11
|
end
|
12
|
+
it "should use http://api.bandsintown.com as the base url" do
|
13
|
+
Bandsintown::Base.connection.base_url.should == "http://api.bandsintown.com"
|
14
|
+
end
|
12
15
|
end
|
13
16
|
|
14
17
|
describe ".request(http_method, api_method, params={})" do
|
@@ -36,37 +36,43 @@ describe Bandsintown::Connection do
|
|
36
36
|
lambda { @connection.get("", "", {}) }.should_not raise_error
|
37
37
|
@connection.get("", "", {}).should == "error message"
|
38
38
|
end
|
39
|
+
|
40
|
+
it "should return the correct URL format when method_path is blank (no slashes)" do
|
41
|
+
expected_url = "http://api.bandsintown.com/events?app_id=YOUR_APP_ID&format=json"
|
42
|
+
RestClient.should_receive(:get).with(expected_url).and_return("response")
|
43
|
+
@connection.get("events", "", {})
|
44
|
+
end
|
39
45
|
end
|
40
46
|
|
41
47
|
describe ".post(resource_path, method_path, body = {})" do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
48
|
+
before(:each) do
|
49
|
+
@connection = Bandsintown::Connection.new(@base_url)
|
50
|
+
RestClient.stub!(:post).and_return("response")
|
51
|
+
@api_resource = "events"
|
52
|
+
@api_method = ""
|
53
|
+
@body_params = {
|
54
|
+
:event => {
|
55
|
+
:artists => [{ :name => "Little Brother" }],
|
56
|
+
:datetime => "2010-06-01T19:30:00",
|
57
|
+
:venue => { :id => 123 }
|
58
|
+
}
|
59
|
+
}
|
60
|
+
end
|
61
|
+
it "should make a post request to the url constructed with resource path, method path, default encoded params, body converted to json, and application/json request headers" do
|
62
|
+
expected_url = "http://api.bandsintown.com/events?app_id=YOUR_APP_ID&format=json"
|
63
|
+
expected_body = @body_params.to_json
|
64
|
+
expected_headers = { :content_type => :json, :accept => :json }
|
65
|
+
@connection.should_receive(:encode).with({}).and_return("app_id=YOUR_APP_ID&format=json")
|
66
|
+
RestClient.should_receive(:post).with(expected_url, expected_body, expected_headers).and_return("response")
|
67
|
+
@connection.post(@api_resource, @api_method, @body_params).should == "response"
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should return the API error message instead of raising an error if there was a problem with the request (404 response)" do
|
71
|
+
error = RestClient::ResourceNotFound.new; error.response = "error message"
|
72
|
+
RestClient.stub!(:post).and_raise(error)
|
73
|
+
lambda { @connection.post(@api_resource, @api_method, @body_params) }.should_not raise_error
|
74
|
+
@connection.post(@api_resource, @api_method, @body_params).should == "error message"
|
75
|
+
end
|
70
76
|
end
|
71
77
|
|
72
78
|
describe ".encode(params={})" do
|
@@ -190,7 +190,7 @@ describe Bandsintown::Event do
|
|
190
190
|
Bandsintown::Event.stub!(:request_and_parse).and_return(@response)
|
191
191
|
end
|
192
192
|
it "should request and parse a call to the BIT events - create API mehod" do
|
193
|
-
Bandsintown::Event.should_receive(:request_and_parse).with(:post, "
|
193
|
+
Bandsintown::Event.should_receive(:request_and_parse).with(:post, "", anything).and_return(@response)
|
194
194
|
Bandsintown::Event.create(@options)
|
195
195
|
end
|
196
196
|
it "should return the response message if an event was successfully submitted using a non-trusted app_id" do
|
@@ -214,28 +214,28 @@ describe Bandsintown::Event do
|
|
214
214
|
@options = { :artists => ["Evidence", "Alchemist"] }
|
215
215
|
Bandsintown::Event.should_receive(:parse_artists).with(@options[:artists]).and_return('parsed')
|
216
216
|
expected_event_params = { :artists => 'parsed' }
|
217
|
-
Bandsintown::Event.should_receive(:request_and_parse).with(:post, "
|
217
|
+
Bandsintown::Event.should_receive(:request_and_parse).with(:post, "", :event => hash_including(expected_event_params))
|
218
218
|
end
|
219
219
|
|
220
220
|
it "should parse the datetime using parse_datetime" do
|
221
221
|
@options = { :datetime => "2010-06-01T20:30:00" }
|
222
222
|
Bandsintown::Event.should_receive(:parse_datetime).with(@options[:datetime]).and_return('parsed')
|
223
223
|
expected_event_params = { :datetime => "parsed" }
|
224
|
-
Bandsintown::Event.should_receive(:request_and_parse).with(:post, "
|
224
|
+
Bandsintown::Event.should_receive(:request_and_parse).with(:post, "", :event => hash_including(expected_event_params))
|
225
225
|
end
|
226
226
|
|
227
227
|
it "should parse the on_sale_datetime using parse_datetime" do
|
228
228
|
@options = { :on_sale_datetime => "2010-06-01T20:30:00" }
|
229
229
|
Bandsintown::Event.should_receive(:parse_datetime).with(@options[:on_sale_datetime]).and_return('parsed')
|
230
230
|
expected_event_params = { :on_sale_datetime => "parsed" }
|
231
|
-
Bandsintown::Event.should_receive(:request_and_parse).with(:post, "
|
231
|
+
Bandsintown::Event.should_receive(:request_and_parse).with(:post, "", :event => hash_including(expected_event_params))
|
232
232
|
end
|
233
233
|
|
234
234
|
it "should parse the venue using parse_venue" do
|
235
235
|
@options = { :venue => "data" }
|
236
236
|
Bandsintown::Event.should_receive(:parse_venue).with("data").and_return("venue")
|
237
237
|
expected_event_params = { :venue => "venue" }
|
238
|
-
Bandsintown::Event.should_receive(:request_and_parse).with(:post, "
|
238
|
+
Bandsintown::Event.should_receive(:request_and_parse).with(:post, "", :event => hash_including(expected_event_params))
|
239
239
|
end
|
240
240
|
|
241
241
|
after(:each) do
|
@@ -243,4 +243,24 @@ describe Bandsintown::Event do
|
|
243
243
|
end
|
244
244
|
end
|
245
245
|
end
|
246
|
+
|
247
|
+
describe "#cancel" do
|
248
|
+
before(:each) do
|
249
|
+
@event = Bandsintown::Event.new
|
250
|
+
@event.bandsintown_id = 12345
|
251
|
+
@response = { "message" => "Event successfully cancelled (pending approval)" }
|
252
|
+
Bandsintown::Event.stub!(:request_and_parse).and_return(@response)
|
253
|
+
end
|
254
|
+
it "should raise an error if the event does not have a bandsintown_id" do
|
255
|
+
@event.bandsintown_id = nil
|
256
|
+
lambda { @event.cancel }.should raise_error(StandardError, "event cancellation requires a bandsintown_id")
|
257
|
+
end
|
258
|
+
it "should request and parse a call to the BIT events - cancel API method using the event's bandsintown_id" do
|
259
|
+
Bandsintown::Event.should_receive(:request_and_parse).with(:post, "#{@event.bandsintown_id}/cancel").and_return(@response)
|
260
|
+
@event.cancel
|
261
|
+
end
|
262
|
+
it "should return the response message if an event was successfully cancelled" do
|
263
|
+
@event.cancel.should == @response["message"]
|
264
|
+
end
|
265
|
+
end
|
246
266
|
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.
|
37
|
+
<a href="http://rubyforge.org/projects/bandsintown" class="numbers">0.3.1</a>
|
38
38
|
</div>
|
39
39
|
</div>
|
40
40
|
<h2>Description</h2>
|
@@ -176,6 +176,34 @@
|
|
176
176
|
<span class="symbol">:on_sale_datetime</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">2010-05-01T19:30:00</span><span class="punct">"</span>
|
177
177
|
<span class="punct">})</span>
|
178
178
|
</pre></p>
|
179
|
+
<h3>Cancel an event on bandsintown.com</h3>
|
180
|
+
<p><pre class='syntax'>
|
181
|
+
<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><span class="symbol">:location</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">San Diego, CA</span><span class="punct">")</span>
|
182
|
+
<span class="ident">event</span> <span class="punct">=</span> <span class="ident">events</span><span class="punct">.</span><span class="ident">first</span>
|
183
|
+
<span class="ident">event</span><span class="punct">.</span><span class="ident">cancel</span>
|
184
|
+
</pre></p>
|
185
|
+
<h3>Cancel an event on bandsintown.com for a single artist</h3>
|
186
|
+
<p><pre class='syntax'>
|
187
|
+
<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><span class="symbol">:name</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">Diamond District</span><span class="punct">")</span>
|
188
|
+
<span class="ident">events</span> <span class="punct">=</span> <span class="ident">artist</span><span class="punct">.</span><span class="ident">events</span>
|
189
|
+
<span class="ident">event_id</span> <span class="punct">=</span> <span class="ident">events</span><span class="punct">.</span><span class="ident">first</span><span class="punct">.</span><span class="ident">bandsintown_id</span>
|
190
|
+
<span class="ident">artist</span><span class="punct">.</span><span class="ident">cancel_event</span><span class="punct">(</span><span class="ident">event_id</span><span class="punct">)</span>
|
191
|
+
</pre></p>
|
192
|
+
<h3>Create an artist on bandsintown.com with name, music brainz id, myspace url, and website</h3>
|
193
|
+
<p><pre class='syntax'>
|
194
|
+
<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">create</span><span class="punct">({</span>
|
195
|
+
<span class="symbol">:name</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">A New Artist</span><span class="punct">",</span>
|
196
|
+
<span class="symbol">:mbid</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">abcd1234-abcd-1234-abcd-12345678abcd</span><span class="punct">",</span>
|
197
|
+
<span class="symbol">:myspace_url</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">http://www.myspace.com/anewartist</span><span class="punct">",</span>
|
198
|
+
<span class="symbol">:website</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">http://www.a-new-artist.com</span><span class="punct">"</span>
|
199
|
+
<span class="punct">})</span>
|
200
|
+
</pre></p>
|
201
|
+
<h3>Create an artist on bandsintown.com with name only (all other parameters optional)</h3>
|
202
|
+
<p><pre class='syntax'>
|
203
|
+
<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">create</span><span class="punct">({</span>
|
204
|
+
<span class="symbol">:name</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">A New Artist</span><span class="punct">"</span>
|
205
|
+
<span class="punct">})</span>
|
206
|
+
</pre></p>
|
179
207
|
<h2>Source</h2>
|
180
208
|
<pre>git clone git://github.com/bandsintown/bandsintown.git</pre>
|
181
209
|
<h2>Links</h2>
|
data/website/index.txt
CHANGED
@@ -179,6 +179,42 @@ Bandsintown::Event.create({
|
|
179
179
|
})
|
180
180
|
</pre>
|
181
181
|
|
182
|
+
h3. Cancel an event on bandsintown.com
|
183
|
+
|
184
|
+
<pre syntax="ruby">
|
185
|
+
events = Bandsintown::Event.search(:location => "San Diego, CA")
|
186
|
+
event = events.first
|
187
|
+
event.cancel
|
188
|
+
</pre>
|
189
|
+
|
190
|
+
h3. Cancel an event on bandsintown.com for a single artist
|
191
|
+
|
192
|
+
<pre syntax="ruby">
|
193
|
+
artist = Bandsintown::Artist.new(:name => "Diamond District")
|
194
|
+
events = artist.events
|
195
|
+
event_id = events.first.bandsintown_id
|
196
|
+
artist.cancel_event(event_id)
|
197
|
+
</pre>
|
198
|
+
|
199
|
+
h3. Create an artist on bandsintown.com with name, music brainz id, myspace url, and website
|
200
|
+
|
201
|
+
<pre syntax="ruby">
|
202
|
+
artist = Bandsintown::Artist.create({
|
203
|
+
:name => "A New Artist",
|
204
|
+
:mbid => "abcd1234-abcd-1234-abcd-12345678abcd",
|
205
|
+
:myspace_url => "http://www.myspace.com/anewartist",
|
206
|
+
:website => "http://www.a-new-artist.com"
|
207
|
+
})
|
208
|
+
</pre>
|
209
|
+
|
210
|
+
h3. Create an artist on bandsintown.com with name only (all other parameters optional)
|
211
|
+
|
212
|
+
<pre syntax="ruby">
|
213
|
+
artist = Bandsintown::Artist.create({
|
214
|
+
:name => "A New Artist"
|
215
|
+
})
|
216
|
+
</pre>
|
217
|
+
|
182
218
|
h2. Source
|
183
219
|
|
184
220
|
<pre>git clone git://github.com/bandsintown/bandsintown.git</pre>
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 3
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mike Costanza
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-07-05 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -142,7 +142,7 @@ licenses: []
|
|
142
142
|
post_install_message:
|
143
143
|
rdoc_options:
|
144
144
|
- --main
|
145
|
-
- README.
|
145
|
+
- README.rdoc
|
146
146
|
require_paths:
|
147
147
|
- lib
|
148
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|