shuffler_fm 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +6 -4
- data/lib/shuffler_fm/api/artists.rb +8 -6
- data/lib/shuffler_fm/api/blogs.rb +9 -6
- data/lib/shuffler_fm/api/channels.rb +7 -4
- data/lib/shuffler_fm/api/charts.rb +6 -4
- data/lib/shuffler_fm/api/genres.rb +2 -2
- data/lib/shuffler_fm/api/tracks.rb +3 -2
- data/lib/shuffler_fm/api.rb +0 -5
- data/lib/shuffler_fm/request.rb +7 -1
- data/lib/shuffler_fm/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/api.yml +72 -3
- data/spec/fixtures/vcr_cassettes/artists.yml +25 -71
- data/spec/fixtures/vcr_cassettes/blogs.yml +53 -53
- data/spec/fixtures/vcr_cassettes/channels.yml +20 -20
- data/spec/fixtures/vcr_cassettes/charts.yml +24 -24
- data/spec/fixtures/vcr_cassettes/genres.yml +19 -19
- data/spec/fixtures/vcr_cassettes/tracks.yml +18 -18
- data/spec/helper.rb +1 -1
- data/spec/shuffler_fm/api/artists_spec.rb +3 -3
- data/spec/shuffler_fm/api_spec.rb +16 -0
- data/spec/shuffler_fm/middleware/error_handler_spec.rb +1 -1
- metadata +183 -187
data/spec/helper.rb
CHANGED
@@ -24,7 +24,7 @@ end
|
|
24
24
|
# setup VCR
|
25
25
|
VCR.configure do |cfg|
|
26
26
|
cfg.filter_sensitive_data('<api-key>') { KEY }
|
27
|
-
cfg.default_cassette_options = { :record => :new_episodes }
|
27
|
+
cfg.default_cassette_options = { :record => :new_episodes, :serialize_with => :syck }
|
28
28
|
cfg.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
29
29
|
cfg.hook_into :webmock
|
30
30
|
end
|
@@ -4,7 +4,8 @@ describe ShufflerFM::API::Artists do
|
|
4
4
|
let!(:api) { ShufflerFM::API.new(KEY) }
|
5
5
|
|
6
6
|
it 'lists artists' do
|
7
|
-
|
7
|
+
#At this moment the service gives a 500 status code on some pages.
|
8
|
+
#We are going arround that
|
8
9
|
api.artists(:page => 3).size.should be(50)
|
9
10
|
end
|
10
11
|
|
@@ -19,7 +20,6 @@ describe ShufflerFM::API::Artists do
|
|
19
20
|
end
|
20
21
|
|
21
22
|
it 'searches for an artist' do
|
22
|
-
api.search_artists('queen').should be_a(Array)
|
23
|
-
api.search_artists('queen', :page => 3).should be_a(Array)
|
23
|
+
api.search_artists('queen', :page => 2).should be_a(Array)
|
24
24
|
end
|
25
25
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
describe ShufflerFM::API do
|
2
2
|
use_vcr_cassette :api
|
3
3
|
|
4
|
+
let!(:api) { ShufflerFM::API.new(KEY) }
|
5
|
+
|
4
6
|
it 'requires a key' do
|
5
7
|
expect { ShufflerFM::API.new(KEY) }.not_to raise_error
|
6
8
|
end
|
@@ -12,4 +14,18 @@ describe ShufflerFM::API do
|
|
12
14
|
expect { api.tracks }.to raise_error(ShufflerFM::Forbidden)
|
13
15
|
end
|
14
16
|
end
|
17
|
+
|
18
|
+
context 'paginates lists' do
|
19
|
+
it 'default is the first page' do
|
20
|
+
api.tracks.first.should eq(api.tracks(:page => 1).first)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'default page size is 50' do
|
24
|
+
api.tracks.size.should be(50)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'page size is a parameter' do
|
28
|
+
api.tracks(:page => 2, :per_page => 10).size.should be(10)
|
29
|
+
end
|
30
|
+
end
|
15
31
|
end
|
@@ -18,7 +18,7 @@ describe ShufflerFM::Middleware::ErrorHandler do
|
|
18
18
|
let!(:api) { ShufflerFM::API.new(KEY) }
|
19
19
|
|
20
20
|
before(:each) do
|
21
|
-
stub_request(:get, "http://api.shuffler.fm/v1/tracks?api-key=#{KEY}&page=
|
21
|
+
stub_request(:get, "http://api.shuffler.fm/v1/tracks?api-key=#{KEY}&page=0").to_return(:status => status)
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should raise #{error.name}" do
|
metadata
CHANGED
@@ -1,231 +1,218 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: shuffler_fm
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Miguel Guinada
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-10-04 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: faraday
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0.8'
|
22
|
-
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0.8'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: faraday_middleware
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
33
24
|
none: false
|
34
|
-
requirements:
|
25
|
+
requirements:
|
35
26
|
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 27
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 8
|
32
|
+
version: "0.8"
|
38
33
|
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: faraday_middleware
|
39
37
|
prerelease: false
|
40
|
-
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
40
|
+
requirements:
|
43
41
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0.3'
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 27
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
- 8
|
47
|
+
version: "0.8"
|
54
48
|
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rash
|
55
52
|
prerelease: false
|
56
|
-
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
54
|
none: false
|
58
|
-
requirements:
|
55
|
+
requirements:
|
59
56
|
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '1.3'
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 13
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
- 3
|
62
|
+
version: "0.3"
|
70
63
|
type: :runtime
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: multi_json
|
71
67
|
prerelease: false
|
72
|
-
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
69
|
none: false
|
74
|
-
requirements:
|
70
|
+
requirements:
|
75
71
|
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 9
|
74
|
+
segments:
|
75
|
+
- 1
|
76
|
+
- 3
|
77
|
+
version: "1.3"
|
78
|
+
type: :runtime
|
79
|
+
version_requirements: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
79
81
|
name: json
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :development
|
87
82
|
prerelease: false
|
88
|
-
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: rake
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
97
84
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
102
92
|
type: :development
|
93
|
+
version_requirements: *id005
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rake
|
103
96
|
prerelease: false
|
104
|
-
|
97
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
105
98
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
version: "0"
|
118
106
|
type: :development
|
107
|
+
version_requirements: *id006
|
108
|
+
- !ruby/object:Gem::Dependency
|
109
|
+
name: pry
|
119
110
|
prerelease: false
|
120
|
-
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: rspec
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
111
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
129
112
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
hash: 3
|
117
|
+
segments:
|
118
|
+
- 0
|
119
|
+
version: "0"
|
134
120
|
type: :development
|
121
|
+
version_requirements: *id007
|
122
|
+
- !ruby/object:Gem::Dependency
|
123
|
+
name: rspec
|
135
124
|
prerelease: false
|
136
|
-
|
125
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
137
126
|
none: false
|
138
|
-
requirements:
|
139
|
-
- -
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ! '>='
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: '0'
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
hash: 3
|
131
|
+
segments:
|
132
|
+
- 0
|
133
|
+
version: "0"
|
150
134
|
type: :development
|
135
|
+
version_requirements: *id008
|
136
|
+
- !ruby/object:Gem::Dependency
|
137
|
+
name: webmock
|
151
138
|
prerelease: false
|
152
|
-
|
139
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
153
140
|
none: false
|
154
|
-
requirements:
|
155
|
-
- -
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ! '>='
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
hash: 3
|
145
|
+
segments:
|
146
|
+
- 0
|
147
|
+
version: "0"
|
166
148
|
type: :development
|
149
|
+
version_requirements: *id009
|
150
|
+
- !ruby/object:Gem::Dependency
|
151
|
+
name: vcr
|
167
152
|
prerelease: false
|
168
|
-
|
153
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
169
154
|
none: false
|
170
|
-
requirements:
|
171
|
-
- -
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
none: false
|
178
|
-
requirements:
|
179
|
-
- - ! '>='
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '0'
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
hash: 3
|
159
|
+
segments:
|
160
|
+
- 0
|
161
|
+
version: "0"
|
182
162
|
type: :development
|
163
|
+
version_requirements: *id010
|
164
|
+
- !ruby/object:Gem::Dependency
|
165
|
+
name: simplecov
|
183
166
|
prerelease: false
|
184
|
-
|
185
|
-
none: false
|
186
|
-
requirements:
|
187
|
-
- - ! '>='
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
version: '0'
|
190
|
-
- !ruby/object:Gem::Dependency
|
191
|
-
name: yard
|
192
|
-
requirement: !ruby/object:Gem::Requirement
|
167
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
193
168
|
none: false
|
194
|
-
requirements:
|
195
|
-
- -
|
196
|
-
- !ruby/object:Gem::Version
|
197
|
-
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
hash: 3
|
173
|
+
segments:
|
174
|
+
- 0
|
175
|
+
version: "0"
|
198
176
|
type: :development
|
177
|
+
version_requirements: *id011
|
178
|
+
- !ruby/object:Gem::Dependency
|
179
|
+
name: yard
|
199
180
|
prerelease: false
|
200
|
-
|
201
|
-
none: false
|
202
|
-
requirements:
|
203
|
-
- - ! '>='
|
204
|
-
- !ruby/object:Gem::Version
|
205
|
-
version: '0'
|
206
|
-
- !ruby/object:Gem::Dependency
|
207
|
-
name: maruku
|
208
|
-
requirement: !ruby/object:Gem::Requirement
|
181
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
209
182
|
none: false
|
210
|
-
requirements:
|
211
|
-
- -
|
212
|
-
- !ruby/object:Gem::Version
|
213
|
-
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
hash: 3
|
187
|
+
segments:
|
188
|
+
- 0
|
189
|
+
version: "0"
|
214
190
|
type: :development
|
191
|
+
version_requirements: *id012
|
192
|
+
- !ruby/object:Gem::Dependency
|
193
|
+
name: maruku
|
215
194
|
prerelease: false
|
216
|
-
|
195
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
217
196
|
none: false
|
218
|
-
requirements:
|
219
|
-
- -
|
220
|
-
- !ruby/object:Gem::Version
|
221
|
-
|
222
|
-
|
223
|
-
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
hash: 3
|
201
|
+
segments:
|
202
|
+
- 0
|
203
|
+
version: "0"
|
204
|
+
type: :development
|
205
|
+
version_requirements: *id013
|
206
|
+
description: " shuffler_fm wraps shuffler.fm's REST api on a thin layer of ruby. "
|
207
|
+
email:
|
224
208
|
- mguinada@gmail.com
|
225
209
|
executables: []
|
210
|
+
|
226
211
|
extensions: []
|
212
|
+
|
227
213
|
extra_rdoc_files: []
|
228
|
-
|
214
|
+
|
215
|
+
files:
|
229
216
|
- .gitignore
|
230
217
|
- .rspec
|
231
218
|
- .travis.yml
|
@@ -270,29 +257,38 @@ files:
|
|
270
257
|
- spec/shufflerfm_spec.rb
|
271
258
|
homepage: https://github.com/mguinada/shuffler_fm
|
272
259
|
licenses: []
|
260
|
+
|
273
261
|
post_install_message:
|
274
262
|
rdoc_options: []
|
275
|
-
|
263
|
+
|
264
|
+
require_paths:
|
276
265
|
- lib
|
277
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
266
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
278
267
|
none: false
|
279
|
-
requirements:
|
280
|
-
- -
|
281
|
-
- !ruby/object:Gem::Version
|
282
|
-
|
283
|
-
|
268
|
+
requirements:
|
269
|
+
- - ">="
|
270
|
+
- !ruby/object:Gem::Version
|
271
|
+
hash: 3
|
272
|
+
segments:
|
273
|
+
- 0
|
274
|
+
version: "0"
|
275
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
284
276
|
none: false
|
285
|
-
requirements:
|
286
|
-
- -
|
287
|
-
- !ruby/object:Gem::Version
|
288
|
-
|
277
|
+
requirements:
|
278
|
+
- - ">="
|
279
|
+
- !ruby/object:Gem::Version
|
280
|
+
hash: 3
|
281
|
+
segments:
|
282
|
+
- 0
|
283
|
+
version: "0"
|
289
284
|
requirements: []
|
285
|
+
|
290
286
|
rubyforge_project:
|
291
|
-
rubygems_version: 1.8.
|
287
|
+
rubygems_version: 1.8.15
|
292
288
|
signing_key:
|
293
289
|
specification_version: 3
|
294
290
|
summary: Ruby API wrapper for http://shuffler.fm
|
295
|
-
test_files:
|
291
|
+
test_files:
|
296
292
|
- spec/config.yml.sample
|
297
293
|
- spec/fixtures/vcr_cassettes/api.yml
|
298
294
|
- spec/fixtures/vcr_cassettes/artists.yml
|