songkickr 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/songkickr/performance.rb +2 -2
- data/lib/songkickr/remote.rb +2 -0
- data/lib/songkickr.rb +6 -0
- data/songkickr.gemspec +34 -3
- data/test/fixtures/resource_not_found.json +1 -0
- data/test/songkickr/test_remote.rb +21 -1
- metadata +130 -19
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -14,14 +14,14 @@ module Songkickr
|
|
14
14
|
# }
|
15
15
|
class Performance
|
16
16
|
attr_accessor :artist, :display_name, :id, :billing_index, :billing
|
17
|
-
|
17
|
+
|
18
18
|
# Takes a the hash of the performance. Parses out an Artist object for the artist.
|
19
19
|
def initialize(performance_hash)
|
20
20
|
@artist = Songkickr::Artist.new performance_hash["artist"]
|
21
21
|
@display_name = performance_hash["displayName"]
|
22
22
|
@id = performance_hash["id"]
|
23
23
|
@billing_index = performance_hash['billingIndex']
|
24
|
-
@
|
24
|
+
@billing = performance_hash['billing']
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/lib/songkickr/remote.rb
CHANGED
@@ -50,6 +50,7 @@ module Songkickr
|
|
50
50
|
def event(event_id)
|
51
51
|
result = self.class.get("/events/#{event_id}.json")
|
52
52
|
# and now for some dirrty hack
|
53
|
+
raise ResouceNotFound if result['resultsPage']['error']
|
53
54
|
Songkickr::Event.new result["resultsPage"]["results"]["event"]
|
54
55
|
end
|
55
56
|
|
@@ -173,6 +174,7 @@ module Songkickr
|
|
173
174
|
# * +venue_id+ - Songkick venue ID.
|
174
175
|
def venue(venue_id)
|
175
176
|
result = self.class.get("/venues/#{venue_id}.json")
|
177
|
+
raise ResouceNotFound if result['resultsPage']['error']
|
176
178
|
Songkickr::Venue.new result['resultsPage']['results']['venue']
|
177
179
|
end
|
178
180
|
|
data/lib/songkickr.rb
CHANGED
@@ -23,6 +23,12 @@ class APIKeyNotSet < StandardError;
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
class ResouceNotFound < StandardError;
|
27
|
+
def to_s
|
28
|
+
"Resource not found"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
26
32
|
module Songkickr
|
27
33
|
# Returns the Songkick API key
|
28
34
|
# In order to use the Songkick API, you must have a Songkick API (their rule, not mine).
|
data/songkickr.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "songkickr"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jared Mehle"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-03-01"
|
13
13
|
s.description = "A Ruby wrapper around the Songkick API. Visit www.songkick.com/developer for documentation on the Songkick API. "
|
14
14
|
s.email = "jrmehle@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -100,6 +100,7 @@ Gem::Specification.new do |s|
|
|
100
100
|
"test/fixtures/invalid_api_key.json",
|
101
101
|
"test/fixtures/locations_bar.json",
|
102
102
|
"test/fixtures/no_events.json",
|
103
|
+
"test/fixtures/resource_not_found.json",
|
103
104
|
"test/fixtures/venue_1276231.json",
|
104
105
|
"test/helper.rb",
|
105
106
|
"test/songkickr/test_artist.rb",
|
@@ -111,7 +112,7 @@ Gem::Specification.new do |s|
|
|
111
112
|
]
|
112
113
|
s.homepage = "http://github.com/jrmehle/songkickr"
|
113
114
|
s.require_paths = ["lib"]
|
114
|
-
s.rubygems_version = "1.8.
|
115
|
+
s.rubygems_version = "1.8.15"
|
115
116
|
s.summary = "A Ruby wrapper around the Songkick API."
|
116
117
|
|
117
118
|
if s.respond_to? :specification_version then
|
@@ -126,6 +127,16 @@ Gem::Specification.new do |s|
|
|
126
127
|
s.add_development_dependency(%q<shoulda>, [">= 2.11.0"])
|
127
128
|
s.add_development_dependency(%q<fakeweb>, [">= 1.3.0"])
|
128
129
|
s.add_development_dependency(%q<redgreen>, [">= 1.2.2"])
|
130
|
+
s.add_development_dependency(%q<redgreen>, [">= 1.2.2"])
|
131
|
+
s.add_development_dependency(%q<crack>, [">= 0"])
|
132
|
+
s.add_development_dependency(%q<shoulda>, [">= 2.11.0"])
|
133
|
+
s.add_development_dependency(%q<fakeweb>, [">= 1.3.0"])
|
134
|
+
s.add_development_dependency(%q<redgreen>, [">= 1.2.2"])
|
135
|
+
s.add_development_dependency(%q<redgreen>, [">= 1.2.2"])
|
136
|
+
s.add_development_dependency(%q<crack>, [">= 0"])
|
137
|
+
s.add_development_dependency(%q<shoulda>, [">= 2.11.0"])
|
138
|
+
s.add_development_dependency(%q<fakeweb>, [">= 1.3.0"])
|
139
|
+
s.add_development_dependency(%q<redgreen>, [">= 1.2.2"])
|
129
140
|
else
|
130
141
|
s.add_dependency(%q<songkickr>, [">= 0"])
|
131
142
|
s.add_dependency(%q<shoulda>, [">= 2.11.0"])
|
@@ -135,6 +146,16 @@ Gem::Specification.new do |s|
|
|
135
146
|
s.add_dependency(%q<shoulda>, [">= 2.11.0"])
|
136
147
|
s.add_dependency(%q<fakeweb>, [">= 1.3.0"])
|
137
148
|
s.add_dependency(%q<redgreen>, [">= 1.2.2"])
|
149
|
+
s.add_dependency(%q<redgreen>, [">= 1.2.2"])
|
150
|
+
s.add_dependency(%q<crack>, [">= 0"])
|
151
|
+
s.add_dependency(%q<shoulda>, [">= 2.11.0"])
|
152
|
+
s.add_dependency(%q<fakeweb>, [">= 1.3.0"])
|
153
|
+
s.add_dependency(%q<redgreen>, [">= 1.2.2"])
|
154
|
+
s.add_dependency(%q<redgreen>, [">= 1.2.2"])
|
155
|
+
s.add_dependency(%q<crack>, [">= 0"])
|
156
|
+
s.add_dependency(%q<shoulda>, [">= 2.11.0"])
|
157
|
+
s.add_dependency(%q<fakeweb>, [">= 1.3.0"])
|
158
|
+
s.add_dependency(%q<redgreen>, [">= 1.2.2"])
|
138
159
|
end
|
139
160
|
else
|
140
161
|
s.add_dependency(%q<songkickr>, [">= 0"])
|
@@ -145,6 +166,16 @@ Gem::Specification.new do |s|
|
|
145
166
|
s.add_dependency(%q<shoulda>, [">= 2.11.0"])
|
146
167
|
s.add_dependency(%q<fakeweb>, [">= 1.3.0"])
|
147
168
|
s.add_dependency(%q<redgreen>, [">= 1.2.2"])
|
169
|
+
s.add_dependency(%q<redgreen>, [">= 1.2.2"])
|
170
|
+
s.add_dependency(%q<crack>, [">= 0"])
|
171
|
+
s.add_dependency(%q<shoulda>, [">= 2.11.0"])
|
172
|
+
s.add_dependency(%q<fakeweb>, [">= 1.3.0"])
|
173
|
+
s.add_dependency(%q<redgreen>, [">= 1.2.2"])
|
174
|
+
s.add_dependency(%q<redgreen>, [">= 1.2.2"])
|
175
|
+
s.add_dependency(%q<crack>, [">= 0"])
|
176
|
+
s.add_dependency(%q<shoulda>, [">= 2.11.0"])
|
177
|
+
s.add_dependency(%q<fakeweb>, [">= 1.3.0"])
|
178
|
+
s.add_dependency(%q<redgreen>, [">= 1.2.2"])
|
148
179
|
end
|
149
180
|
end
|
150
181
|
|
@@ -0,0 +1 @@
|
|
1
|
+
{"resultsPage" : {"status" : "error", "error" : {"message" : "Resource not found"}}}
|
@@ -8,7 +8,27 @@ class TestRemote < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
|
+
context "Given an invalid Resource" do
|
13
|
+
setup do
|
14
|
+
FakeWeb.register_uri(:get, 'http://api.songkick.com/api/3.0/events/123.json?apikey=omgwtfbbq_fake_key', :body => fixture_file('resource_not_found.json'))
|
15
|
+
FakeWeb.register_uri(:get, 'http://api.songkick.com/api/3.0/venues/123.json?apikey=omgwtfbbq_fake_key', :body => fixture_file('resource_not_found.json'))
|
16
|
+
@remote = Songkickr::Remote.new 'omgwtfbbq_fake_key'
|
17
|
+
end
|
18
|
+
|
19
|
+
should "raise an ResouceNotFound exception when search a songkick event id doesn't exist" do
|
20
|
+
assert_raise ResouceNotFound do
|
21
|
+
@remote.event(123)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
should "raise an ResouceNotFound exception when search a songkick venue id doesn't exist" do
|
26
|
+
assert_raise ResouceNotFound do
|
27
|
+
@remote.venue(123)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
12
32
|
# TODO: Fix this later
|
13
33
|
context "Given a remote with an invalid api key" do
|
14
34
|
setup do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: songkickr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: songkickr
|
16
|
-
requirement: &
|
16
|
+
requirement: &70174572245760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70174572245760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: shoulda
|
27
|
-
requirement: &
|
27
|
+
requirement: &70174572245280 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.11.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70174572245280
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: fakeweb
|
38
|
-
requirement: &
|
38
|
+
requirement: &70174572244800 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.3.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70174572244800
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: redgreen
|
49
|
-
requirement: &
|
49
|
+
requirement: &70174572244320 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.2.2
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70174572244320
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: crack
|
60
|
-
requirement: &
|
60
|
+
requirement: &70174572243840 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70174572243840
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: shoulda
|
71
|
-
requirement: &
|
71
|
+
requirement: &70174572243340 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 2.11.0
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70174572243340
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: fakeweb
|
82
|
-
requirement: &
|
82
|
+
requirement: &70174572242780 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 1.3.0
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70174572242780
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: redgreen
|
93
|
-
requirement: &
|
93
|
+
requirement: &70174572242180 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,117 @@ dependencies:
|
|
98
98
|
version: 1.2.2
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70174572242180
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: redgreen
|
104
|
+
requirement: &70174572241480 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.2.2
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70174572241480
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: crack
|
115
|
+
requirement: &70174572257040 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *70174572257040
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: shoulda
|
126
|
+
requirement: &70174572256520 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.11.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *70174572256520
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: fakeweb
|
137
|
+
requirement: &70174572256020 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 1.3.0
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *70174572256020
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: redgreen
|
148
|
+
requirement: &70174572255340 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: 1.2.2
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: *70174572255340
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: redgreen
|
159
|
+
requirement: &70174572254580 !ruby/object:Gem::Requirement
|
160
|
+
none: false
|
161
|
+
requirements:
|
162
|
+
- - ! '>='
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 1.2.2
|
165
|
+
type: :development
|
166
|
+
prerelease: false
|
167
|
+
version_requirements: *70174572254580
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: crack
|
170
|
+
requirement: &70174572253900 !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
type: :development
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: *70174572253900
|
179
|
+
- !ruby/object:Gem::Dependency
|
180
|
+
name: shoulda
|
181
|
+
requirement: &70174572253120 !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: 2.11.0
|
187
|
+
type: :development
|
188
|
+
prerelease: false
|
189
|
+
version_requirements: *70174572253120
|
190
|
+
- !ruby/object:Gem::Dependency
|
191
|
+
name: fakeweb
|
192
|
+
requirement: &70174572252640 !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
194
|
+
requirements:
|
195
|
+
- - ! '>='
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: 1.3.0
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: *70174572252640
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: redgreen
|
203
|
+
requirement: &70174572252160 !ruby/object:Gem::Requirement
|
204
|
+
none: false
|
205
|
+
requirements:
|
206
|
+
- - ! '>='
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 1.2.2
|
209
|
+
type: :development
|
210
|
+
prerelease: false
|
211
|
+
version_requirements: *70174572252160
|
102
212
|
description: ! 'A Ruby wrapper around the Songkick API. Visit www.songkick.com/developer
|
103
213
|
for documentation on the Songkick API. '
|
104
214
|
email: jrmehle@gmail.com
|
@@ -191,6 +301,7 @@ files:
|
|
191
301
|
- test/fixtures/invalid_api_key.json
|
192
302
|
- test/fixtures/locations_bar.json
|
193
303
|
- test/fixtures/no_events.json
|
304
|
+
- test/fixtures/resource_not_found.json
|
194
305
|
- test/fixtures/venue_1276231.json
|
195
306
|
- test/helper.rb
|
196
307
|
- test/songkickr/test_artist.rb
|
@@ -219,7 +330,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
330
|
version: '0'
|
220
331
|
requirements: []
|
221
332
|
rubyforge_project:
|
222
|
-
rubygems_version: 1.8.
|
333
|
+
rubygems_version: 1.8.15
|
223
334
|
signing_key:
|
224
335
|
specification_version: 3
|
225
336
|
summary: A Ruby wrapper around the Songkick API.
|