echowrap 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/.travis.yml +16 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +22 -0
- data/README.md +111 -0
- data/Rakefile +1 -0
- data/echowrap.gemspec +24 -0
- data/lib/echowrap/analysis.rb +39 -0
- data/lib/echowrap/api/artist.rb +387 -0
- data/lib/echowrap/api/oauth.rb +25 -0
- data/lib/echowrap/api/playlist.rb +248 -0
- data/lib/echowrap/api/sandbox.rb +45 -0
- data/lib/echowrap/api/song.rb +111 -0
- data/lib/echowrap/api/taste_profile.rb +296 -0
- data/lib/echowrap/api/track.rb +64 -0
- data/lib/echowrap/api/utils.rb +57 -0
- data/lib/echowrap/artist.rb +73 -0
- data/lib/echowrap/asset.rb +12 -0
- data/lib/echowrap/audio_summary.rb +15 -0
- data/lib/echowrap/base.rb +88 -0
- data/lib/echowrap/biography.rb +13 -0
- data/lib/echowrap/blog.rb +8 -0
- data/lib/echowrap/call_list.rb +8 -0
- data/lib/echowrap/category_map.rb +8 -0
- data/lib/echowrap/client.rb +80 -0
- data/lib/echowrap/configurable.rb +84 -0
- data/lib/echowrap/default.rb +88 -0
- data/lib/echowrap/doc_counts.rb +8 -0
- data/lib/echowrap/echonest_id.rb +8 -0
- data/lib/echowrap/error/bad_gateway.rb +11 -0
- data/lib/echowrap/error/bad_request.rb +10 -0
- data/lib/echowrap/error/client_error.rb +35 -0
- data/lib/echowrap/error/configuration_error.rb +8 -0
- data/lib/echowrap/error/forbidden.rb +10 -0
- data/lib/echowrap/error/gateway_timeout.rb +11 -0
- data/lib/echowrap/error/internal_server_error.rb +11 -0
- data/lib/echowrap/error/not_acceptable.rb +10 -0
- data/lib/echowrap/error/not_found.rb +10 -0
- data/lib/echowrap/error/server_error.rb +28 -0
- data/lib/echowrap/error/service_unavailable.rb +11 -0
- data/lib/echowrap/error/too_many_requests.rb +12 -0
- data/lib/echowrap/error/unauthorized.rb +10 -0
- data/lib/echowrap/error/unprocessable_entity.rb +10 -0
- data/lib/echowrap/error.rb +32 -0
- data/lib/echowrap/familiarity.rb +8 -0
- data/lib/echowrap/feed.rb +14 -0
- data/lib/echowrap/foreign_id.rb +10 -0
- data/lib/echowrap/genre.rb +8 -0
- data/lib/echowrap/hotttnesss.rb +8 -0
- data/lib/echowrap/image.rb +15 -0
- data/lib/echowrap/item.rb +95 -0
- data/lib/echowrap/item_request.rb +8 -0
- data/lib/echowrap/keyvalues.rb +8 -0
- data/lib/echowrap/license.rb +10 -0
- data/lib/echowrap/location.rb +8 -0
- data/lib/echowrap/meta.rb +9 -0
- data/lib/echowrap/news_article.rb +8 -0
- data/lib/echowrap/options.rb +10 -0
- data/lib/echowrap/playlist.rb +47 -0
- data/lib/echowrap/prediction.rb +7 -0
- data/lib/echowrap/rate_limit.rb +47 -0
- data/lib/echowrap/reference.rb +8 -0
- data/lib/echowrap/request/multipart_with_file.rb +36 -0
- data/lib/echowrap/response/parse_json.rb +25 -0
- data/lib/echowrap/response/raise_error.rb +31 -0
- data/lib/echowrap/review.rb +8 -0
- data/lib/echowrap/rule.rb +8 -0
- data/lib/echowrap/sandbox.rb +11 -0
- data/lib/echowrap/seeds.rb +9 -0
- data/lib/echowrap/sequenced_data/bar.rb +4 -0
- data/lib/echowrap/sequenced_data/beat.rb +4 -0
- data/lib/echowrap/sequenced_data/section.rb +6 -0
- data/lib/echowrap/sequenced_data/segment.rb +4 -0
- data/lib/echowrap/sequenced_data/tatum.rb +4 -0
- data/lib/echowrap/sequenced_data.rb +12 -0
- data/lib/echowrap/song.rb +24 -0
- data/lib/echowrap/status.rb +12 -0
- data/lib/echowrap/taste_profile.rb +28 -0
- data/lib/echowrap/term.rb +8 -0
- data/lib/echowrap/track.rb +21 -0
- data/lib/echowrap/update_info.rb +8 -0
- data/lib/echowrap/urls.rb +9 -0
- data/lib/echowrap/version.rb +18 -0
- data/lib/echowrap/video.rb +7 -0
- data/lib/echowrap/years_active.rb +8 -0
- data/lib/echowrap.rb +78 -0
- data/spec/echonest/api/artist_spec.rb +901 -0
- data/spec/echonest/api/oauth_spec.rb +29 -0
- data/spec/echonest/api/playlist_spec.rb +274 -0
- data/spec/echonest/api/sandbox_spec.rb +67 -0
- data/spec/echonest/api/song_spec.rb +326 -0
- data/spec/echonest/api/taste_profile_spec.rb +403 -0
- data/spec/echonest/api/track_spec.rb +167 -0
- data/spec/echonest/base_spec.rb +119 -0
- data/spec/echonest/client_spec.rb +174 -0
- data/spec/echonest/error_spec.rb +20 -0
- data/spec/echonest/rate_limit_spec.rb +76 -0
- data/spec/echonest_spec.rb +65 -0
- data/spec/fixtures/artist/biographies.json +1 -0
- data/spec/fixtures/artist/blogs.json +1 -0
- data/spec/fixtures/artist/extract.json +1 -0
- data/spec/fixtures/artist/familiarity.json +1 -0
- data/spec/fixtures/artist/hotttnesss.json +1 -0
- data/spec/fixtures/artist/images.json +1 -0
- data/spec/fixtures/artist/list_genres.json +1 -0
- data/spec/fixtures/artist/list_terms.json +1 -0
- data/spec/fixtures/artist/news.json +1 -0
- data/spec/fixtures/artist/profile.json +1 -0
- data/spec/fixtures/artist/reviews.json +1 -0
- data/spec/fixtures/artist/search.json +1 -0
- data/spec/fixtures/artist/similar.json +1 -0
- data/spec/fixtures/artist/songs.json +1 -0
- data/spec/fixtures/artist/suggest.json +1 -0
- data/spec/fixtures/artist/terms.json +1 -0
- data/spec/fixtures/artist/top_hottt.json +1 -0
- data/spec/fixtures/artist/top_terms.json +1 -0
- data/spec/fixtures/artist/twitter.json +1 -0
- data/spec/fixtures/artist/urls.json +1 -0
- data/spec/fixtures/artist/video.json +1 -0
- data/spec/fixtures/billie_jean_fingerprint.txt +1 -0
- data/spec/fixtures/billie_jean_query.json +16 -0
- data/spec/fixtures/oauth/timestamp.json +1 -0
- data/spec/fixtures/playlist/basic.json +1 -0
- data/spec/fixtures/playlist/dynamic/create.json +1 -0
- data/spec/fixtures/playlist/dynamic/delete.json +1 -0
- data/spec/fixtures/playlist/dynamic/feedback.json +1 -0
- data/spec/fixtures/playlist/dynamic/info.json +1 -0
- data/spec/fixtures/playlist/dynamic/next.json +1 -0
- data/spec/fixtures/playlist/dynamic/restart.json +1 -0
- data/spec/fixtures/playlist/dynamic/steer.json +1 -0
- data/spec/fixtures/playlist/static.json +1 -0
- data/spec/fixtures/sandbox/access.json +19 -0
- data/spec/fixtures/sandbox/list.json +1 -0
- data/spec/fixtures/song/identify.json +19 -0
- data/spec/fixtures/song/profile.json +1 -0
- data/spec/fixtures/song/search.json +1 -0
- data/spec/fixtures/taste_profile/ban.json +9 -0
- data/spec/fixtures/taste_profile/create.json +1 -0
- data/spec/fixtures/taste_profile/delete.json +11 -0
- data/spec/fixtures/taste_profile/favorite.json +9 -0
- data/spec/fixtures/taste_profile/feed.json +1 -0
- data/spec/fixtures/taste_profile/keyvalues.json +4 -0
- data/spec/fixtures/taste_profile/list.json +1 -0
- data/spec/fixtures/taste_profile/play.json +9 -0
- data/spec/fixtures/taste_profile/predict.json +1 -0
- data/spec/fixtures/taste_profile/profile.json +1 -0
- data/spec/fixtures/taste_profile/rate.json +9 -0
- data/spec/fixtures/taste_profile/read.json +1 -0
- data/spec/fixtures/taste_profile/similar.json +14 -0
- data/spec/fixtures/taste_profile/skip.json +9 -0
- data/spec/fixtures/taste_profile/status.json +2 -0
- data/spec/fixtures/taste_profile/update.json +10 -0
- data/spec/fixtures/taste_profile/update_request_data.json +4 -0
- data/spec/fixtures/technolol-music.mp3 +0 -0
- data/spec/fixtures/track/analysis.json +3 -0
- data/spec/fixtures/track/profile.json +35 -0
- data/spec/fixtures/track/upload.json +21 -0
- data/spec/helper.rb +50 -0
- metadata +323 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Echowrap::API::Oauth do
|
4
|
+
before do
|
5
|
+
@client = new_test_client
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#oauth_timestamp" do
|
9
|
+
|
10
|
+
before do
|
11
|
+
stub_get("/api/v4/oauth/timestamp").
|
12
|
+
to_return(:body => fixture("oauth/timestamp.json"),
|
13
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
14
|
+
end
|
15
|
+
|
16
|
+
it "requests the correct resource" do
|
17
|
+
@client.oauth_timestamp
|
18
|
+
expect(a_get("/api/v4/oauth/timestamp"))
|
19
|
+
.to have_been_made
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns timestamp" do
|
23
|
+
timestamp = @client.oauth_timestamp
|
24
|
+
expect(timestamp).to be_an Integer
|
25
|
+
expect(timestamp).to eq 1369548063
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,274 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Echowrap::API::Playlist do
|
4
|
+
before do
|
5
|
+
@client = new_test_client
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#playlist_basic" do
|
9
|
+
|
10
|
+
before do
|
11
|
+
stub_get("/api/v4/playlist/basic").
|
12
|
+
with(:query => {:artist => 'radiohead'}).
|
13
|
+
to_return(:body => fixture("playlist/basic.json"),
|
14
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
it "requests the correct resource" do
|
19
|
+
@client.playlist_basic(:artist => 'radiohead')
|
20
|
+
expect(a_get("/api/v4/playlist/basic")
|
21
|
+
.with(:query => {:artist => 'radiohead'},
|
22
|
+
))
|
23
|
+
.to have_been_made
|
24
|
+
end
|
25
|
+
|
26
|
+
it "returns songs" do
|
27
|
+
songs = @client.playlist_basic(:artist => 'radiohead')
|
28
|
+
expect(songs).to be_an Array
|
29
|
+
expect(songs.first.title).to eq "Only In Dreams"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "returns songs with tracks" do
|
33
|
+
songs = @client.playlist_basic(:artist => 'radiohead')
|
34
|
+
expect(songs).to be_an Array
|
35
|
+
expect(songs.first.tracks.first.id).to eq "TRWKBOB13A79B0C90E"
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "#playlist_static" do
|
41
|
+
|
42
|
+
before do
|
43
|
+
stub_get("/api/v4/playlist/static").
|
44
|
+
with(:query => {:artist => 'radiohead'}).
|
45
|
+
to_return(:body => fixture("playlist/static.json"),
|
46
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
it "requests the correct resource" do
|
51
|
+
@client.playlist_static(:artist => 'radiohead')
|
52
|
+
expect(a_get("/api/v4/playlist/static")
|
53
|
+
.with(:query => {:artist => 'radiohead'},
|
54
|
+
))
|
55
|
+
.to have_been_made
|
56
|
+
end
|
57
|
+
|
58
|
+
it "returns songs" do
|
59
|
+
songs = @client.playlist_static(:artist => 'radiohead')
|
60
|
+
expect(songs).to be_an Array
|
61
|
+
expect(songs.first.title).to eq "Knockdown Dragout"
|
62
|
+
end
|
63
|
+
|
64
|
+
it "returns songs with tracks" do
|
65
|
+
songs = @client.playlist_static(:artist => 'radiohead')
|
66
|
+
expect(songs).to be_an Array
|
67
|
+
expect(songs.first.tracks.first.id).to eq "TRDXNUI13A79B0B146"
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "#playlist_dynamic_create" do
|
73
|
+
|
74
|
+
before do
|
75
|
+
stub_get("/api/v4/playlist/dynamic/create").
|
76
|
+
with(:query => {:artist => 'radiohead'}).
|
77
|
+
to_return(:body => fixture("playlist/dynamic/create.json"),
|
78
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
it "requests the correct resource" do
|
83
|
+
@client.playlist_dynamic_create(:artist => 'radiohead')
|
84
|
+
expect(a_get("/api/v4/playlist/dynamic/create")
|
85
|
+
.with(:query => {:artist => 'radiohead'},
|
86
|
+
))
|
87
|
+
.to have_been_made
|
88
|
+
end
|
89
|
+
|
90
|
+
it "returns session id" do
|
91
|
+
playlist = @client.playlist_dynamic_create(:artist => 'radiohead')
|
92
|
+
expect(playlist).to be_an Echowrap::Playlist
|
93
|
+
expect(playlist.session_id).to eq "7c88f9c365294bab8534943d735f587c"
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "#playlist_dynamic_restart" do
|
99
|
+
|
100
|
+
before do
|
101
|
+
stub_get("/api/v4/playlist/dynamic/restart").
|
102
|
+
with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :artist => 'radiohead'}).
|
103
|
+
to_return(:body => fixture("playlist/dynamic/restart.json"),
|
104
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
it "requests the correct resource" do
|
109
|
+
@client.playlist_dynamic_restart(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :artist => 'radiohead')
|
110
|
+
expect(a_get("/api/v4/playlist/dynamic/restart")
|
111
|
+
.with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :artist => 'radiohead'},
|
112
|
+
))
|
113
|
+
.to have_been_made
|
114
|
+
end
|
115
|
+
|
116
|
+
it "returns session id" do
|
117
|
+
playlist = @client.playlist_dynamic_restart(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :artist => 'radiohead')
|
118
|
+
expect(playlist).to be_an Echowrap::Playlist
|
119
|
+
expect(playlist.session_id).to eq "a8cddde7afdf4ac09b510aa1c1c50bf9"
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
describe "#playlist_dynamic_next" do
|
125
|
+
|
126
|
+
before do
|
127
|
+
stub_get("/api/v4/playlist/dynamic/next").
|
128
|
+
with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9'}).
|
129
|
+
to_return(:body => fixture("playlist/dynamic/next.json"),
|
130
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
it "requests the correct resource" do
|
135
|
+
@client.playlist_dynamic_next(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9')
|
136
|
+
expect(a_get("/api/v4/playlist/dynamic/next")
|
137
|
+
.with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9'},
|
138
|
+
))
|
139
|
+
.to have_been_made
|
140
|
+
end
|
141
|
+
|
142
|
+
it "returns songs" do
|
143
|
+
playlist = @client.playlist_dynamic_next(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9')
|
144
|
+
expect(playlist).to be_an Echowrap::Playlist
|
145
|
+
expect(playlist.songs.first.id).to eq "SOXIAKX12AF72AC774"
|
146
|
+
end
|
147
|
+
|
148
|
+
it "returns lookahead" do
|
149
|
+
playlist = @client.playlist_dynamic_next(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9')
|
150
|
+
expect(playlist).to be_an Echowrap::Playlist
|
151
|
+
expect(playlist.lookahead.first.id).to eq "SOOVSGI12AB017E8ED"
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
describe "#playlist_dynamic_feedback" do
|
156
|
+
|
157
|
+
before do
|
158
|
+
stub_get("/api/v4/playlist/dynamic/feedback").
|
159
|
+
with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :favorite_song => 'SOCZMFK12AC468668F'}).
|
160
|
+
to_return(:body => fixture("playlist/dynamic/feedback.json"),
|
161
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
162
|
+
end
|
163
|
+
|
164
|
+
|
165
|
+
it "requests the correct resource" do
|
166
|
+
@client.playlist_dynamic_feedback(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :favorite_song => 'SOCZMFK12AC468668F')
|
167
|
+
expect(a_get("/api/v4/playlist/dynamic/feedback")
|
168
|
+
.with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :favorite_song => 'SOCZMFK12AC468668F'},
|
169
|
+
))
|
170
|
+
.to have_been_made
|
171
|
+
end
|
172
|
+
|
173
|
+
it "returns boolean with response result" do
|
174
|
+
result = @client.playlist_dynamic_feedback(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :favorite_song => 'SOCZMFK12AC468668F')
|
175
|
+
expect(result).to be_true
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
describe "#playlist_dynamic_steer" do
|
180
|
+
|
181
|
+
before do
|
182
|
+
stub_get("/api/v4/playlist/dynamic/steer").
|
183
|
+
with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :min_danceability => 0.5}).
|
184
|
+
to_return(:body => fixture("playlist/dynamic/steer.json"),
|
185
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
186
|
+
end
|
187
|
+
|
188
|
+
|
189
|
+
it "requests the correct resource" do
|
190
|
+
@client.playlist_dynamic_steer(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :min_danceability => 0.5)
|
191
|
+
expect(a_get("/api/v4/playlist/dynamic/steer")
|
192
|
+
.with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :min_danceability => 0.5},
|
193
|
+
))
|
194
|
+
.to have_been_made
|
195
|
+
end
|
196
|
+
|
197
|
+
it "returns boolean with response result" do
|
198
|
+
result = @client.playlist_dynamic_steer(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9', :min_danceability => 0.5)
|
199
|
+
expect(result).to be_true
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
describe "#playlist_dynamic_info" do
|
204
|
+
|
205
|
+
before do
|
206
|
+
stub_get("/api/v4/playlist/dynamic/info").
|
207
|
+
with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9'}).
|
208
|
+
to_return(:body => fixture("playlist/dynamic/info.json"),
|
209
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
210
|
+
end
|
211
|
+
|
212
|
+
|
213
|
+
it "requests the correct resource" do
|
214
|
+
@client.playlist_dynamic_info(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9')
|
215
|
+
expect(a_get("/api/v4/playlist/dynamic/info")
|
216
|
+
.with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9'},
|
217
|
+
))
|
218
|
+
.to have_been_made
|
219
|
+
end
|
220
|
+
|
221
|
+
it "returns category map" do
|
222
|
+
playlist = @client.playlist_dynamic_info(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9')
|
223
|
+
expect(playlist.category_map).to be_an Echowrap::CategoryMap
|
224
|
+
expect(playlist.category_map.childrens).to eq "any"
|
225
|
+
end
|
226
|
+
|
227
|
+
it "returns category seeds" do
|
228
|
+
playlist = @client.playlist_dynamic_info(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9')
|
229
|
+
expect(playlist.seeds).to be_an Echowrap::Seeds
|
230
|
+
expect(playlist.seeds.artist_ids).to eq ['ARF8HTQ1187B9AE693']
|
231
|
+
end
|
232
|
+
|
233
|
+
it "returns rules" do
|
234
|
+
playlist = @client.playlist_dynamic_info(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9')
|
235
|
+
expect(playlist.rules).to be_an Array
|
236
|
+
expect(playlist.rules.first.rule).to eq "Don't put two copies of the same song in a playlist."
|
237
|
+
end
|
238
|
+
|
239
|
+
it "returns call list" do
|
240
|
+
playlist = @client.playlist_dynamic_info(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9')
|
241
|
+
expect(playlist.call_list).to be_an Array
|
242
|
+
expect(playlist.call_list.first.action).to eq 'create'
|
243
|
+
end
|
244
|
+
|
245
|
+
it "returns call list" do
|
246
|
+
playlist = @client.playlist_dynamic_info(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9')
|
247
|
+
expect(playlist.options).to be_an Echowrap::Options
|
248
|
+
expect(playlist.options.rank_type).to eq 'relevance'
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
describe "#playlist_dynamic_delete" do
|
253
|
+
|
254
|
+
before do
|
255
|
+
stub_get("/api/v4/playlist/dynamic/delete").
|
256
|
+
with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9'}).
|
257
|
+
to_return(:body => fixture("playlist/dynamic/delete.json"),
|
258
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
259
|
+
end
|
260
|
+
|
261
|
+
it "requests the correct resource" do
|
262
|
+
@client.playlist_dynamic_delete(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9')
|
263
|
+
expect(a_get("/api/v4/playlist/dynamic/delete")
|
264
|
+
.with(:query => {:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9'},
|
265
|
+
))
|
266
|
+
.to have_been_made
|
267
|
+
end
|
268
|
+
|
269
|
+
it "returns boolean with response result" do
|
270
|
+
result = @client.playlist_dynamic_delete(:session_id => 'a8cddde7afdf4ac09b510aa1c1c50bf9')
|
271
|
+
expect(result).to be_true
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Echowrap::API::Sandbox do
|
4
|
+
before do
|
5
|
+
@client = new_test_client
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#sandbox_list" do
|
9
|
+
|
10
|
+
before do
|
11
|
+
stub_get("/api/v4/sandbox/list").
|
12
|
+
with(:query => {:sandbox => 'emi_evanescence'}).
|
13
|
+
to_return(:body => fixture("sandbox/list.json"),
|
14
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
15
|
+
end
|
16
|
+
|
17
|
+
it "requests the correct resource" do
|
18
|
+
@client.sandbox_list(:sandbox => "emi_evanescence")
|
19
|
+
expect(a_get("/api/v4/sandbox/list").
|
20
|
+
with(:query => {:sandbox => 'emi_evanescence'})).
|
21
|
+
to have_been_made
|
22
|
+
end
|
23
|
+
|
24
|
+
it "returns a sandbox" do
|
25
|
+
sandbox = @client.sandbox_list(:sandbox => "emi_evanescence")
|
26
|
+
expect(sandbox).to be_a Echowrap::Sandbox
|
27
|
+
expect(sandbox.total).to eq 455
|
28
|
+
end
|
29
|
+
|
30
|
+
it "returns assets with the sandbox" do
|
31
|
+
sandbox = @client.sandbox_list(:sandbox => "emi_evanescence")
|
32
|
+
expect(sandbox.assets).to be_an Array
|
33
|
+
expect(sandbox.assets.first.id).to eq '2d2b8d352d6f2bc8297266117116421d'
|
34
|
+
end
|
35
|
+
|
36
|
+
it "returns echonest_ids with the assets with the sandbox" do
|
37
|
+
sandbox = @client.sandbox_list(:sandbox => "emi_evanescence")
|
38
|
+
expect(sandbox.assets.last.echonest_ids).to be_an Array
|
39
|
+
expect(sandbox.assets.last.echonest_ids.first.id).to eq 'TRFQBKY133B7EA9267'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#sandbox_access" do
|
44
|
+
|
45
|
+
before do
|
46
|
+
@client = Echowrap::Client.new(:api_key => "AK", :consumer_key => "CK", :shared_secret => "SS")
|
47
|
+
stub_get("/api/v4/sandbox/access", false).
|
48
|
+
with(:query => hash_including({:sandbox => 'emi_evanescence', :id => '2d2b8d352d6f2bc8297266117116421d'})).
|
49
|
+
to_return(:body => fixture("sandbox/access.json"),
|
50
|
+
:headers => {:content_type => "application/json; charset=utf-8"})
|
51
|
+
end
|
52
|
+
|
53
|
+
it "requests the correct resource" do
|
54
|
+
@client.sandbox_access(:sandbox => "emi_evanescence", :id => '2d2b8d352d6f2bc8297266117116421d')
|
55
|
+
expect(a_get("/api/v4/sandbox/access", false).
|
56
|
+
with(:query => hash_including({:sandbox => 'emi_evanescence', :id => '2d2b8d352d6f2bc8297266117116421d'}))).
|
57
|
+
to have_been_made
|
58
|
+
end
|
59
|
+
|
60
|
+
it "returns assets with the sandbox" do
|
61
|
+
assets = @client.sandbox_access(:sandbox => "emi_evanescence", :id => '2d2b8d352d6f2bc8297266117116421d')
|
62
|
+
expect(assets).to be_an Array
|
63
|
+
expect(assets.first.id).to eq 'c1b89c9b9e0ee9e53650f1d4e393d716'
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|