beatport 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/beatport.gemspec +2 -2
- data/lib/beatport/collection.rb +1 -1
- data/spec/catalog/genre_spec.rb +6 -6
- data/spec/collection_spec.rb +17 -1
- data/spec/fixtures/genre.yml +70 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
data/beatport.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "beatport"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Mateo Murphy"]
|
12
|
-
s.date = "2013-02-
|
12
|
+
s.date = "2013-02-12"
|
13
13
|
s.description = "A ruby gem for accessing the beatport api"
|
14
14
|
s.email = "mateo.murphy@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/beatport/collection.rb
CHANGED
@@ -5,7 +5,7 @@ module Beatport
|
|
5
5
|
include Enumerable
|
6
6
|
extend Forwardable
|
7
7
|
|
8
|
-
def_delegators :@results, :each, :'<=>', :length, :==, :===, :to_a
|
8
|
+
def_delegators :@results, :each, :'<=>', :length, :==, :===, :[], :to_a
|
9
9
|
|
10
10
|
attr_reader :host, :path, :query, :next_query
|
11
11
|
attr_reader :per_page_options, :page, :per_page, :total_pages, :count
|
data/spec/catalog/genre_spec.rb
CHANGED
@@ -39,16 +39,16 @@ module Beatport::Catalog
|
|
39
39
|
Genre.find(7).name.should == "Trance"
|
40
40
|
end
|
41
41
|
|
42
|
-
it
|
43
|
-
|
42
|
+
it 'does not find trance via the slug' do
|
43
|
+
Genre.find('trance').should be_nil
|
44
|
+
end
|
44
45
|
|
45
|
-
|
46
|
+
it "should retrieve information about the trance genre via the slug" do
|
47
|
+
Genre.find('breaks').name.should == "Breaks"
|
46
48
|
end
|
47
49
|
|
48
50
|
it "should retrieve information about the trance genre via the slug passed as a symbol" do
|
49
|
-
|
50
|
-
|
51
|
-
Genre.find(:trance).name.should == "Trance"
|
51
|
+
Genre.find(:breaks).name.should == "Breaks"
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should return nil with an invalid id" do
|
data/spec/collection_spec.rb
CHANGED
@@ -1,7 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
module Beatport
|
3
|
+
module Beatport
|
4
4
|
describe Collection do
|
5
|
+
let :data do
|
6
|
+
JSON.parse('{"metadata":{"host":"api.beatport.com","path":"\/catalog\/autocomplete","query":"query=lutzen","page":1,"perPage":10,"count":39,"totalPages":4,"nextQuery":"query=lutzen&page=2","perPageOptions":[{"value":50,"applyQuery":"query=lutzen&perPage=50"},{"value":100,"applyQuery":"query=lutzen&perPage=100"},{"value":150,"applyQuery":"query=lutzen&perPage=150"}],"facets":{"fields":[]},"spellcheck":{"suggestions":[]}},"results":[{"name":"Lutzencraft"},{"name":"Lutzenfierht"},{"name":"Lutzenkirchen"},{"name":"Lutzenkirchin"},{"name":"LXR aka Lutzenkirchen"},{"name":"LXR aka Lutzenkrichen"},{"name":"Tobias Lutzenkirchen"},{"name":"Lutzenkirchen Top 10"},{"name":"Lutzenkirchen Best Of"},{"name":"Lutzenkirchen Charts"}]}')
|
7
|
+
end
|
8
|
+
|
9
|
+
subject :collection do
|
10
|
+
Collection.new(Item, data)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'array methods' do
|
14
|
+
[:each, :'<=>', :length, :==, :===, :[], :to_a].each do |method|
|
15
|
+
it "responds to ##{method}" do
|
16
|
+
collection.should respond_to(method)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
5
21
|
describe '.new' do
|
6
22
|
it "should raise an error when given invalid data" do
|
7
23
|
expect { Collection.new(Item, 1) }.to raise_exception
|
data/spec/fixtures/genre.yml
CHANGED
@@ -326,4 +326,74 @@ http_interactions:
|
|
326
326
|
string: ! '{"metadata":{"page":1,"perPage":0,"count":0},"results":[]}'
|
327
327
|
http_version:
|
328
328
|
recorded_at: Fri, 08 Feb 2013 21:07:02 GMT
|
329
|
+
- request:
|
330
|
+
method: get
|
331
|
+
uri: http://api.beatport.com/catalog/3/genres?slug=breaks&subgenres=true
|
332
|
+
body:
|
333
|
+
encoding: US-ASCII
|
334
|
+
string: ''
|
335
|
+
headers: {}
|
336
|
+
response:
|
337
|
+
status:
|
338
|
+
code: 200
|
339
|
+
message: OK
|
340
|
+
headers:
|
341
|
+
Date:
|
342
|
+
- Tue, 12 Feb 2013 19:22:25 GMT
|
343
|
+
Server:
|
344
|
+
- Apache
|
345
|
+
Expires:
|
346
|
+
- Tue, 12 Feb 2013 19:52:25 GMT
|
347
|
+
Pragma:
|
348
|
+
- public
|
349
|
+
Cache-Control:
|
350
|
+
- public, max-age=1800
|
351
|
+
Access-Control-Allow-Origin:
|
352
|
+
- ! '*'
|
353
|
+
Transfer-Encoding:
|
354
|
+
- chunked
|
355
|
+
Content-Type:
|
356
|
+
- application/json
|
357
|
+
body:
|
358
|
+
encoding: US-ASCII
|
359
|
+
string: ! '{"metadata":{"page":1,"perPage":1,"count":1},"results":[{"id":9,"name":"Breaks","type":"genre","slug":"breaks","subgenres":[{"id":34,"name":"2
|
360
|
+
Step","slug":"2-step"},{"id":37,"name":"Acid","slug":"acid"},{"id":33,"name":"Big
|
361
|
+
Beat","slug":"big-beat"},{"id":35,"name":"Electro","slug":"electro"},{"id":62,"name":"Funky
|
362
|
+
Breaks","slug":"funky-breaks"},{"id":63,"name":"Hardcore Breaks","slug":"hardcore-breaks"},{"id":36,"name":"Nu
|
363
|
+
Skool","slug":"nu-skool"},{"id":38,"name":"Progressive","slug":"progressive"},{"id":96,"name":"Psybreaks","slug":"psybreaks"}]}]}'
|
364
|
+
http_version:
|
365
|
+
recorded_at: Tue, 12 Feb 2013 19:22:25 GMT
|
366
|
+
- request:
|
367
|
+
method: get
|
368
|
+
uri: http://api.beatport.com/catalog/3/genres?slug=trance&subgenres=true
|
369
|
+
body:
|
370
|
+
encoding: US-ASCII
|
371
|
+
string: ''
|
372
|
+
headers: {}
|
373
|
+
response:
|
374
|
+
status:
|
375
|
+
code: 200
|
376
|
+
message: OK
|
377
|
+
headers:
|
378
|
+
Date:
|
379
|
+
- Tue, 12 Feb 2013 19:23:00 GMT
|
380
|
+
Server:
|
381
|
+
- Apache
|
382
|
+
Expires:
|
383
|
+
- Tue, 12 Feb 2013 19:53:00 GMT
|
384
|
+
Pragma:
|
385
|
+
- public
|
386
|
+
Cache-Control:
|
387
|
+
- public, max-age=1800
|
388
|
+
Access-Control-Allow-Origin:
|
389
|
+
- ! '*'
|
390
|
+
Transfer-Encoding:
|
391
|
+
- chunked
|
392
|
+
Content-Type:
|
393
|
+
- application/json
|
394
|
+
body:
|
395
|
+
encoding: US-ASCII
|
396
|
+
string: ! '{"metadata":{"page":1,"perPage":0,"count":0},"results":[]}'
|
397
|
+
http_version:
|
398
|
+
recorded_at: Tue, 12 Feb 2013 19:23:00 GMT
|
329
399
|
recorded_with: VCR 2.4.0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beatport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
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-02-
|
12
|
+
date: 2013-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -269,7 +269,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
269
269
|
version: '0'
|
270
270
|
segments:
|
271
271
|
- 0
|
272
|
-
hash:
|
272
|
+
hash: -4339444266390201649
|
273
273
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
274
274
|
none: false
|
275
275
|
requirements:
|