echonest-ruby-api 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -0
- data/fixtures/vcr_cassettes/images_whitespace.yml +84 -0
- data/lib/echonest-ruby-api/base.rb +1 -1
- data/lib/echonest-ruby-api/version.rb +1 -1
- data/spec/artist_spec.rb +7 -0
- metadata +3 -3
data/README.md
CHANGED
@@ -0,0 +1,84 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://developer.echonest.com/api/v4/artist/images?api_key=BNOAEBT3IZYZI6WXI&format=json&name=Bob%20Marley
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers: {}
|
10
|
+
response:
|
11
|
+
status:
|
12
|
+
code: 200
|
13
|
+
message: OK
|
14
|
+
headers:
|
15
|
+
Date:
|
16
|
+
- Mon, 17 Jun 2013 18:39:13 GMT
|
17
|
+
Content-Type:
|
18
|
+
- application/json; charset=utf-8
|
19
|
+
Content-Length:
|
20
|
+
- '3514'
|
21
|
+
Vary:
|
22
|
+
- Accept-Encoding
|
23
|
+
X-Request-Id:
|
24
|
+
- G7d6WfNxRmKnS6a4UP6Djg
|
25
|
+
Etag:
|
26
|
+
- ! '"b9b9cfa02c362649b53e832a81ed6e2112b2c01e"'
|
27
|
+
X-Worker-Node:
|
28
|
+
- 2d6ca:15157
|
29
|
+
X-Ratelimit-Remaining:
|
30
|
+
- '19'
|
31
|
+
Server:
|
32
|
+
- TornadoServer/3.0.1
|
33
|
+
X-Ratelimit-Limit:
|
34
|
+
- '20'
|
35
|
+
Cache-Control:
|
36
|
+
- max-age=86400
|
37
|
+
Access-Control-Allow-Origin:
|
38
|
+
- ! '*'
|
39
|
+
X-Ratelimit-Used:
|
40
|
+
- '1'
|
41
|
+
Connection:
|
42
|
+
- Keep-alive
|
43
|
+
Keep-Alive:
|
44
|
+
- timeout=15, max=100
|
45
|
+
Via:
|
46
|
+
- 1.1 ID-0000627501223666 uproxy-3
|
47
|
+
body:
|
48
|
+
encoding: US-ASCII
|
49
|
+
string: ! '{"response": {"status": {"version": "4.2", "code": 0, "message":
|
50
|
+
"Success"}, "start": 0, "total": 141, "images": [{"url": "http://upload.wikimedia.org/wikipedia/commons/0/0f/LocationAfrica.png",
|
51
|
+
"license": {"type": "unknown", "attribution": "n/a", "url": "http://en.wikipedia.org/wiki/File:LocationAfrica.png"}},
|
52
|
+
{"url": "http://upload.wikimedia.org/wikipedia/commons/3/3a/Bob-Marley-in-Concert_Zurich_05-30-80.jpg",
|
53
|
+
"license": {"type": "cc-by-sa", "attribution": "CdaMVvWgS", "url": "http://upload.wikimedia.org/wikipedia/commons/3/3a/Bob-Marley-in-Concert_Zurich_05-30-80.jpg"}},
|
54
|
+
{"url": "http://upload.wikimedia.org/wikipedia/commons/thumb/6/61/Bob-marley-wailers-crystal-palace.jpg/800px-Bob-marley-wailers-crystal-palace.jpg",
|
55
|
+
"license": {"type": "cc-by-sa", "attribution": "Tankfield", "url": "http://en.wikipedia.org/wiki/File:Bob-marley-wailers-crystal-palace.jpg"}},
|
56
|
+
{"url": "http://upload.wikimedia.org/wikipedia/commons/6/68/Bob-Marley_3.jpg",
|
57
|
+
"license": {"type": "cc-by-sa", "attribution": "Leahtwosaints", "url": "http://upload.wikimedia.org/wikipedia/commons/6/68/Bob-Marley_3.jpg"}},
|
58
|
+
{"url": "http://upload.wikimedia.org/wikipedia/commons/6/61/Bob-marley-wailers-crystal-palace.jpg",
|
59
|
+
"license": {"type": "cc-by-sa", "attribution": "Fountain Posters", "url":
|
60
|
+
"http://upload.wikimedia.org/wikipedia/commons/6/61/Bob-marley-wailers-crystal-palace.jpg"}},
|
61
|
+
{"url": "http://upload.wikimedia.org/wikipedia/commons/8/84/Bob_Marley_house_in_Nine_Mile.jpg",
|
62
|
+
"license": {"type": "cc-by-sa", "attribution": "File Upload Bot (Magnus Manske)",
|
63
|
+
"url": "http://upload.wikimedia.org/wikipedia/commons/8/84/Bob_Marley_house_in_Nine_Mile.jpg"}},
|
64
|
+
{"url": "http://upload.wikimedia.org/wikipedia/commons/1/1e/Bob_Marley_Wax.jpg",
|
65
|
+
"license": {"type": "cc-by-sa", "attribution": "Sub-Zero 88", "url": "http://upload.wikimedia.org/wikipedia/commons/1/1e/Bob_Marley_Wax.jpg"}},
|
66
|
+
{"url": "http://upload.wikimedia.org/wikipedia/commons/4/44/Bob-Star.jpg",
|
67
|
+
"license": {"type": "cc-by-sa", "attribution": "Dioz", "url": "http://upload.wikimedia.org/wikipedia/commons/4/44/Bob-Star.jpg"}},
|
68
|
+
{"url": "http://upload.wikimedia.org/wikipedia/commons/5/5e/Bob-Marley.jpg",
|
69
|
+
"license": {"type": "cc-by-sa", "attribution": "LobStoR", "url": "http://upload.wikimedia.org/wikipedia/commons/5/5e/Bob-Marley.jpg"}},
|
70
|
+
{"url": "http://upload.wikimedia.org/wikipedia/commons/0/03/Bob_Marley_apartment_in_London.jpg",
|
71
|
+
"license": {"type": "cc-by", "attribution": "Fountain Posters", "url": "http://upload.wikimedia.org/wikipedia/commons/0/03/Bob_Marley_apartment_in_London.jpg"}},
|
72
|
+
{"url": "http://userserve-ak.last.fm/serve/_/3604577/Bob+Marley+Esther+Anderson.jpg",
|
73
|
+
"license": {"type": "unknown", "attribution": "last.fm", "url": "http://www.last.fm/music/Bob+Marley/+images"}},
|
74
|
+
{"url": "http://userserve-ak.last.fm/serve/_/3154905/Bob+Marley+BobMarley.jpg",
|
75
|
+
"license": {"type": "unknown", "attribution": "last.fm", "url": "http://www.last.fm/music/Bob+Marley/+images"}},
|
76
|
+
{"url": "http://userserve-ak.last.fm/serve/_/46289809/Bob+Marley+bob_marley_80.jpg",
|
77
|
+
"license": {"type": "unknown", "attribution": "n/a", "url": "http://www.last.fm/music/Bob+Marley/+images"}},
|
78
|
+
{"url": "http://userserve-ak.last.fm/serve/_/24579307/Bob+Marley+0000173918002.jpg",
|
79
|
+
"license": {"type": "unknown", "attribution": "last.fm", "url": "http://www.last.fm/music/Bob+Marley/+images"}},
|
80
|
+
{"url": "http://userserve-ak.last.fm/serve/_/23882297/Bob+Marley+bob.jpg",
|
81
|
+
"license": {"type": "unknown", "attribution": "n/a", "url": "http://www.last.fm/music/Bob+Marley/+images"}}]}}'
|
82
|
+
http_version:
|
83
|
+
recorded_at: Mon, 17 Jun 2013 18:39:13 GMT
|
84
|
+
recorded_with: VCR 2.4.0
|
@@ -56,7 +56,7 @@ module Echonest
|
|
56
56
|
query_string << "#{ key }=#{ value }&"
|
57
57
|
end
|
58
58
|
#puts "#{ Base.base_uri }#{ endpoint }?api_key=#{ @api_key }&format=json&#{ query_string }"
|
59
|
-
response = HTTParty.get("#{ Base.base_uri }#{ endpoint }?api_key=#{ @api_key }&format=json&#{ query_string }")
|
59
|
+
response = HTTParty.get(URI.escape("#{ Base.base_uri }#{ endpoint }?api_key=#{ @api_key }&format=json&#{ query_string }"))
|
60
60
|
json = MultiJson.load(response.body, symbolize_keys: true)
|
61
61
|
response_code = json[:response][:status][:code]
|
62
62
|
|
data/spec/artist_spec.rb
CHANGED
@@ -101,6 +101,13 @@ describe Echonest::Artist do
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
it 'should allow Artists with whitespace in their names' do
|
105
|
+
VCR.use_cassette('images_whitespace') do
|
106
|
+
@a = Echonest::Artist.new('BNOAEBT3IZYZI6WXI', 'Bob Marley')
|
107
|
+
@a.images.should be_a Array
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
104
111
|
it 'should only return urls in the array' do
|
105
112
|
VCR.use_cassette('images') do
|
106
113
|
create_valid_artist
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: echonest-ruby-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.2.1
|
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-
|
12
|
+
date: 2013-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- fixtures/vcr_cassettes/familiarity.yml
|
176
176
|
- fixtures/vcr_cassettes/hotttnesss.yml
|
177
177
|
- fixtures/vcr_cassettes/images.yml
|
178
|
+
- fixtures/vcr_cassettes/images_whitespace.yml
|
178
179
|
- fixtures/vcr_cassettes/invalid_api_key_error.yml
|
179
180
|
- fixtures/vcr_cassettes/list_genres.yml
|
180
181
|
- fixtures/vcr_cassettes/playlist.yml
|
@@ -240,4 +241,3 @@ test_files:
|
|
240
241
|
- spec/playlist_spec.rb
|
241
242
|
- spec/song_spec.rb
|
242
243
|
- spec/spec_helper.rb
|
243
|
-
has_rdoc:
|