echowrap 0.0.2 → 0.0.3
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/lib/echowrap/api/utils.rb
CHANGED
@@ -18,7 +18,7 @@ module Echowrap
|
|
18
18
|
# @param options [Hash]
|
19
19
|
# @return [Array]
|
20
20
|
def objects_from_response(klass, request_method, path, object_key, options={})
|
21
|
-
response = send(request_method.to_sym, path, options)[:body][:response][object_key]
|
21
|
+
response = send(request_method.to_sym, path, options)[:body][:response][object_key] || []
|
22
22
|
objects_from_array(klass, response)
|
23
23
|
end
|
24
24
|
|
data/lib/echowrap/version.rb
CHANGED
@@ -2,7 +2,7 @@ module Echowrap
|
|
2
2
|
class Version
|
3
3
|
MAJOR = 0 unless defined? Echowrap::Version::MAJOR
|
4
4
|
MINOR = 0 unless defined? Echowrap::Version::MINOR
|
5
|
-
PATCH =
|
5
|
+
PATCH = 3 unless defined? Echowrap::Version::PATCH
|
6
6
|
PRE = nil unless defined? Echowrap::Version::PRE
|
7
7
|
|
8
8
|
class << self
|
@@ -706,6 +706,17 @@ describe Echowrap::API::Artist do
|
|
706
706
|
expect(artists.first.name).to eq "Thom Yorke"
|
707
707
|
end
|
708
708
|
|
709
|
+
it 'does not throw an error when no artists are returned by Echonest' do
|
710
|
+
|
711
|
+
stub_get("/api/v4/artist/similar").
|
712
|
+
with(:query => {
|
713
|
+
:results => 1,
|
714
|
+
:name => 'herpderp'}).
|
715
|
+
to_return(:body => fixture("artist/similar_with_no_results.json"),
|
716
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
717
|
+
expect{ @client.artist_similar(:results => 1,
|
718
|
+
:name => 'herpderp')}.to_not raise_error
|
719
|
+
end
|
709
720
|
end
|
710
721
|
|
711
722
|
describe "#artist_suggest" do
|
@@ -0,0 +1 @@
|
|
1
|
+
{"response": {"status": {"version": "4.2", "code": 5, "message": "The Identifier specified does not exist: ARH6W4X11F"}}}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: echowrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- spec/fixtures/artist/reviews.json
|
178
178
|
- spec/fixtures/artist/search.json
|
179
179
|
- spec/fixtures/artist/similar.json
|
180
|
+
- spec/fixtures/artist/similar_with_no_results.json
|
180
181
|
- spec/fixtures/artist/songs.json
|
181
182
|
- spec/fixtures/artist/suggest.json
|
182
183
|
- spec/fixtures/artist/terms.json
|
@@ -275,6 +276,7 @@ test_files:
|
|
275
276
|
- spec/fixtures/artist/reviews.json
|
276
277
|
- spec/fixtures/artist/search.json
|
277
278
|
- spec/fixtures/artist/similar.json
|
279
|
+
- spec/fixtures/artist/similar_with_no_results.json
|
278
280
|
- spec/fixtures/artist/songs.json
|
279
281
|
- spec/fixtures/artist/suggest.json
|
280
282
|
- spec/fixtures/artist/terms.json
|