beatport 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -5
- data/Gemfile.lock +22 -20
- data/Rakefile +7 -7
- data/VERSION +1 -1
- data/beatport.gemspec +56 -20
- data/lib/beatport/catalog.rb +2 -0
- data/lib/beatport/catalog/djprofile.rb +7 -0
- data/lib/beatport/catalog/part.rb +7 -0
- data/lib/beatport/support/query_builder.rb +1 -1
- data/spec/catalog/account_type_spec.rb +18 -5
- data/spec/catalog/artist_spec.rb +61 -41
- data/spec/catalog/audio_format_spec.rb +12 -4
- data/spec/catalog/autocomplete_spec.rb +9 -3
- data/spec/catalog/chart_spec.rb +11 -5
- data/spec/catalog/country_spec.rb +4 -2
- data/spec/catalog/currency_spec.rb +3 -1
- data/spec/catalog/genre_spec.rb +30 -12
- data/spec/catalog/home_spec.rb +7 -5
- data/spec/catalog/label_spec.rb +21 -10
- data/spec/catalog/release_spec.rb +11 -7
- data/spec/catalog/search_spec.rb +22 -8
- data/spec/catalog/slide_spec.rb +4 -0
- data/spec/catalog/source_type_spec.rb +3 -1
- data/spec/catalog/track_spec.rb +9 -7
- data/spec/fixtures/account_type_all.yml +40 -0
- data/spec/fixtures/account_type_visa.yml +38 -0
- data/spec/fixtures/artist_7181.yml +43 -0
- data/spec/fixtures/artist_7181_7182.yml +44 -0
- data/spec/fixtures/artist_7181_top_downloads.yml +105 -0
- data/spec/fixtures/artist_all.yml +64 -0
- data/spec/fixtures/artist_all_5_per_page.yml +53 -0
- data/spec/fixtures/artist_all_for_facets.yml +38 -0
- data/spec/fixtures/artist_all_return_facets.yml +144 -0
- data/spec/fixtures/artist_all_sorted.yml +44 -0
- data/spec/fixtures/audio_format_2.yml +38 -0
- data/spec/fixtures/audio_format_all.yml +44 -0
- data/spec/fixtures/audio_format_wav.yml +38 -0
- data/spec/fixtures/autocomplete_lutzen.yml +41 -0
- data/spec/fixtures/autocomplete_lutzen_page_3.yml +39 -0
- data/spec/fixtures/chart_15722.yml +39 -0
- data/spec/fixtures/country_au.yml +43 -0
- data/spec/fixtures/currency_all.yml +127 -0
- data/spec/fixtures/genre_7.yml +38 -0
- data/spec/fixtures/genre_all.yml +47 -0
- data/spec/fixtures/genre_all_with_subgenres.yml +62 -0
- data/spec/fixtures/genre_invalid.yml +38 -0
- data/spec/fixtures/label_1390.yml +43 -0
- data/spec/fixtures/label_all.yml +76 -0
- data/spec/fixtures/release_164808.yml +55 -0
- data/spec/fixtures/search_ANJCDCO011D.yml +38 -0
- data/spec/fixtures/search_anjunadeep_genre_trance.yml +101 -0
- data/spec/fixtures/search_archipel.yml +102 -0
- data/spec/fixtures/search_believe_2004.yml +220 -0
- data/spec/fixtures/source_type_all.yml +38 -0
- data/spec/fixtures/track_1217790.yml +45 -0
- data/spec/spec_helper.rb +7 -0
- metadata +179 -134
data/Gemfile
CHANGED
@@ -9,10 +9,12 @@ gem 'money' # https://github.com/aflatter/money
|
|
9
9
|
# Add dependencies to develop your gem here.
|
10
10
|
# Include everything needed to run rake, tests, features, etc.
|
11
11
|
group :development do
|
12
|
-
gem
|
13
|
-
gem
|
14
|
-
gem
|
15
|
-
gem "rcov", ">= 0"
|
16
|
-
gem 'yard', '>=0'
|
12
|
+
gem 'bundler'
|
13
|
+
gem 'fakeweb'
|
14
|
+
gem 'jeweler', '~> 1.6.3'
|
15
|
+
#gem "rcov", ">= 0"
|
17
16
|
gem 'log_buddy'
|
17
|
+
gem 'rspec', '>= 0'
|
18
|
+
gem 'yard', '>=0'
|
19
|
+
gem 'vcr'
|
18
20
|
end
|
data/Gemfile.lock
CHANGED
@@ -2,43 +2,45 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
diff-lcs (1.1.3)
|
5
|
+
fakeweb (1.3.0)
|
5
6
|
git (1.2.5)
|
6
|
-
httparty (0.
|
7
|
-
multi_json
|
7
|
+
httparty (0.9.0)
|
8
|
+
multi_json (~> 1.0)
|
8
9
|
multi_xml
|
9
|
-
i18n (0.6.
|
10
|
+
i18n (0.6.1)
|
10
11
|
jeweler (1.6.4)
|
11
12
|
bundler (~> 1.0)
|
12
13
|
git (>= 1.2.5)
|
13
14
|
rake
|
14
|
-
json (1.
|
15
|
-
log_buddy (0.
|
16
|
-
money (
|
15
|
+
json (1.7.5)
|
16
|
+
log_buddy (0.7.0)
|
17
|
+
money (5.0.0)
|
17
18
|
i18n (~> 0.4)
|
18
19
|
json
|
19
|
-
multi_json (1.
|
20
|
-
multi_xml (0.
|
20
|
+
multi_json (1.3.6)
|
21
|
+
multi_xml (0.5.1)
|
21
22
|
rake (0.9.2.2)
|
22
|
-
|
23
|
-
|
24
|
-
rspec-
|
25
|
-
rspec-
|
26
|
-
|
27
|
-
rspec-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
yard (0.
|
23
|
+
rspec (2.11.0)
|
24
|
+
rspec-core (~> 2.11.0)
|
25
|
+
rspec-expectations (~> 2.11.0)
|
26
|
+
rspec-mocks (~> 2.11.0)
|
27
|
+
rspec-core (2.11.1)
|
28
|
+
rspec-expectations (2.11.3)
|
29
|
+
diff-lcs (~> 1.1.3)
|
30
|
+
rspec-mocks (2.11.3)
|
31
|
+
vcr (2.2.5)
|
32
|
+
yard (0.8.2.1)
|
32
33
|
|
33
34
|
PLATFORMS
|
34
35
|
ruby
|
35
36
|
|
36
37
|
DEPENDENCIES
|
37
|
-
bundler
|
38
|
+
bundler
|
39
|
+
fakeweb
|
38
40
|
httparty
|
39
41
|
jeweler (~> 1.6.3)
|
40
42
|
log_buddy
|
41
43
|
money
|
42
|
-
rcov
|
43
44
|
rspec
|
45
|
+
vcr
|
44
46
|
yard
|
data/Rakefile
CHANGED
@@ -27,13 +27,13 @@ Jeweler::RubygemsDotOrgTasks.new
|
|
27
27
|
|
28
28
|
#task :default => :test
|
29
29
|
|
30
|
-
require 'rcov/rcovtask'
|
31
|
-
Rcov::RcovTask.new do |test|
|
32
|
-
test.libs << 'test'
|
33
|
-
test.pattern = 'test/**/test_*.rb'
|
34
|
-
test.verbose = true
|
35
|
-
test.rcov_opts << '--exclude "gems/*"'
|
36
|
-
end
|
30
|
+
#require 'rcov/rcovtask'
|
31
|
+
#Rcov::RcovTask.new do |test|
|
32
|
+
# test.libs << 'test'
|
33
|
+
# test.pattern = 'test/**/test_*.rb'
|
34
|
+
# test.verbose = true
|
35
|
+
# test.rcov_opts << '--exclude "gems/*"'
|
36
|
+
#end
|
37
37
|
|
38
38
|
|
39
39
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
data/beatport.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.1.
|
7
|
+
s.name = "beatport"
|
8
|
+
s.version = "0.1.5"
|
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 =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2012-10-10"
|
13
|
+
s.description = "A ruby gem for accessing the beatport api"
|
14
|
+
s.email = "mateo.murphy@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
17
|
"README.rdoc"
|
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
"lib/beatport/catalog/chart_overview.rb",
|
38
38
|
"lib/beatport/catalog/country.rb",
|
39
39
|
"lib/beatport/catalog/currency.rb",
|
40
|
+
"lib/beatport/catalog/djprofile.rb",
|
40
41
|
"lib/beatport/catalog/feature.rb",
|
41
42
|
"lib/beatport/catalog/genre.rb",
|
42
43
|
"lib/beatport/catalog/home.rb",
|
@@ -48,6 +49,7 @@ Gem::Specification.new do |s|
|
|
48
49
|
"lib/beatport/catalog/label.rb",
|
49
50
|
"lib/beatport/catalog/list.rb",
|
50
51
|
"lib/beatport/catalog/mixed.rb",
|
52
|
+
"lib/beatport/catalog/part.rb",
|
51
53
|
"lib/beatport/catalog/recommendations.rb",
|
52
54
|
"lib/beatport/catalog/release.rb",
|
53
55
|
"lib/beatport/catalog/search.rb",
|
@@ -84,16 +86,47 @@ Gem::Specification.new do |s|
|
|
84
86
|
"spec/catalog/source_type_spec.rb",
|
85
87
|
"spec/catalog/track_spec.rb",
|
86
88
|
"spec/collection_spec.rb",
|
89
|
+
"spec/fixtures/account_type_all.yml",
|
90
|
+
"spec/fixtures/account_type_visa.yml",
|
91
|
+
"spec/fixtures/artist_7181.yml",
|
92
|
+
"spec/fixtures/artist_7181_7182.yml",
|
93
|
+
"spec/fixtures/artist_7181_top_downloads.yml",
|
94
|
+
"spec/fixtures/artist_all.yml",
|
95
|
+
"spec/fixtures/artist_all_5_per_page.yml",
|
96
|
+
"spec/fixtures/artist_all_for_facets.yml",
|
97
|
+
"spec/fixtures/artist_all_return_facets.yml",
|
98
|
+
"spec/fixtures/artist_all_sorted.yml",
|
99
|
+
"spec/fixtures/audio_format_2.yml",
|
100
|
+
"spec/fixtures/audio_format_all.yml",
|
101
|
+
"spec/fixtures/audio_format_wav.yml",
|
102
|
+
"spec/fixtures/autocomplete_lutzen.yml",
|
103
|
+
"spec/fixtures/autocomplete_lutzen_page_3.yml",
|
104
|
+
"spec/fixtures/chart_15722.yml",
|
105
|
+
"spec/fixtures/country_au.yml",
|
106
|
+
"spec/fixtures/currency_all.yml",
|
107
|
+
"spec/fixtures/genre_7.yml",
|
108
|
+
"spec/fixtures/genre_all.yml",
|
109
|
+
"spec/fixtures/genre_all_with_subgenres.yml",
|
110
|
+
"spec/fixtures/genre_invalid.yml",
|
111
|
+
"spec/fixtures/label_1390.yml",
|
112
|
+
"spec/fixtures/label_all.yml",
|
113
|
+
"spec/fixtures/release_164808.yml",
|
114
|
+
"spec/fixtures/search_ANJCDCO011D.yml",
|
115
|
+
"spec/fixtures/search_anjunadeep_genre_trance.yml",
|
116
|
+
"spec/fixtures/search_archipel.yml",
|
117
|
+
"spec/fixtures/search_believe_2004.yml",
|
118
|
+
"spec/fixtures/source_type_all.yml",
|
119
|
+
"spec/fixtures/track_1217790.yml",
|
87
120
|
"spec/item_spec.rb",
|
88
121
|
"spec/spec_helper.rb",
|
89
122
|
"spec/support/inflector_spec.rb",
|
90
123
|
"spec/support/query_builder_spec.rb"
|
91
124
|
]
|
92
|
-
s.homepage =
|
125
|
+
s.homepage = "http://github.com/mateomurphy/beatport"
|
93
126
|
s.licenses = ["MIT"]
|
94
127
|
s.require_paths = ["lib"]
|
95
|
-
s.rubygems_version =
|
96
|
-
s.summary =
|
128
|
+
s.rubygems_version = "1.8.24"
|
129
|
+
s.summary = "ruby gem for accessing the beatport api"
|
97
130
|
|
98
131
|
if s.respond_to? :specification_version then
|
99
132
|
s.specification_version = 3
|
@@ -101,31 +134,34 @@ Gem::Specification.new do |s|
|
|
101
134
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
102
135
|
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
103
136
|
s.add_runtime_dependency(%q<money>, [">= 0"])
|
104
|
-
s.add_development_dependency(%q<
|
105
|
-
s.add_development_dependency(%q<
|
137
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
138
|
+
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
106
139
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.3"])
|
107
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
108
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
109
140
|
s.add_development_dependency(%q<log_buddy>, [">= 0"])
|
141
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
142
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
143
|
+
s.add_development_dependency(%q<vcr>, [">= 0"])
|
110
144
|
else
|
111
145
|
s.add_dependency(%q<httparty>, [">= 0"])
|
112
146
|
s.add_dependency(%q<money>, [">= 0"])
|
113
|
-
s.add_dependency(%q<
|
114
|
-
s.add_dependency(%q<
|
147
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
148
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
115
149
|
s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
|
116
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
117
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
118
150
|
s.add_dependency(%q<log_buddy>, [">= 0"])
|
151
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
152
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
153
|
+
s.add_dependency(%q<vcr>, [">= 0"])
|
119
154
|
end
|
120
155
|
else
|
121
156
|
s.add_dependency(%q<httparty>, [">= 0"])
|
122
157
|
s.add_dependency(%q<money>, [">= 0"])
|
123
|
-
s.add_dependency(%q<
|
124
|
-
s.add_dependency(%q<
|
158
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
159
|
+
s.add_dependency(%q<fakeweb>, [">= 0"])
|
125
160
|
s.add_dependency(%q<jeweler>, ["~> 1.6.3"])
|
126
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
127
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
128
161
|
s.add_dependency(%q<log_buddy>, [">= 0"])
|
162
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
163
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
164
|
+
s.add_dependency(%q<vcr>, [">= 0"])
|
129
165
|
end
|
130
166
|
end
|
131
167
|
|
data/lib/beatport/catalog.rb
CHANGED
@@ -9,6 +9,7 @@ module Beatport
|
|
9
9
|
autoload :ChartOverview, 'beatport/catalog/chart_overview'
|
10
10
|
autoload :Country, 'beatport/catalog/country'
|
11
11
|
autoload :Currency, 'beatport/catalog/currency'
|
12
|
+
autoload :Djprofile, 'beatport/catalog/djprofile'
|
12
13
|
autoload :Feature, 'beatport/catalog/feature'
|
13
14
|
autoload :Genre, 'beatport/catalog/genre'
|
14
15
|
autoload :Home, 'beatport/catalog/home'
|
@@ -20,6 +21,7 @@ module Beatport
|
|
20
21
|
autoload :Label, 'beatport/catalog/label'
|
21
22
|
autoload :List, 'beatport/catalog/list'
|
22
23
|
autoload :Mixed, 'beatport/catalog/mixed'
|
24
|
+
autoload :Part, 'beatport/catalog/part'
|
23
25
|
autoload :Recommendations, 'beatport/catalog/recommendations'
|
24
26
|
autoload :Release, 'beatport/catalog/release'
|
25
27
|
autoload :Search, 'beatport/catalog/search'
|
@@ -3,20 +3,28 @@ require 'spec_helper'
|
|
3
3
|
module Beatport::Catalog
|
4
4
|
describe AccountType do
|
5
5
|
describe 'structure' do
|
6
|
-
subject
|
6
|
+
subject do
|
7
|
+
VCR.use_cassette "account_type_all" do
|
8
|
+
AccountType.all.first
|
9
|
+
end
|
10
|
+
end
|
7
11
|
|
8
12
|
it { should be_an(AccountType) }
|
9
13
|
its (:code) { should == "AMEX" }
|
10
|
-
its (:bpid) { should ==
|
14
|
+
its (:bpid) { should == 1 }
|
11
15
|
its (:name) { should == "American Express"}
|
12
16
|
its (:cybersource_card_type) { should == "003" }
|
13
17
|
its (:issue_number_or_start_date_required) { should == false }
|
14
18
|
its (:validation_regex) { should == /^3[47][0-9]{13}$/ }
|
15
|
-
its (:'images.small.url') { should == "https://
|
19
|
+
its (:'images.small.url') { should == "https://secure-beatport.bpddn.com/images/creditcard/logo_cc_amex_37x23.gif"}
|
16
20
|
end
|
17
21
|
|
18
22
|
describe '.all' do
|
19
|
-
subject
|
23
|
+
subject do
|
24
|
+
VCR.use_cassette "account_type_all" do
|
25
|
+
AccountType.all
|
26
|
+
end
|
27
|
+
end
|
20
28
|
|
21
29
|
its (:length) { should be > 1 }
|
22
30
|
end
|
@@ -29,7 +37,12 @@ module Beatport::Catalog
|
|
29
37
|
end
|
30
38
|
|
31
39
|
context "by name" do
|
32
|
-
subject
|
40
|
+
subject do
|
41
|
+
VCR.use_cassette "account_type_visa" do
|
42
|
+
AccountType.find('Visa')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
33
46
|
its (:name) { should == "Visa" }
|
34
47
|
end
|
35
48
|
end
|
data/spec/catalog/artist_spec.rb
CHANGED
@@ -3,7 +3,9 @@ require 'spec_helper'
|
|
3
3
|
module Beatport::Catalog
|
4
4
|
describe Artist do
|
5
5
|
describe 'structure' do
|
6
|
-
subject
|
6
|
+
subject do
|
7
|
+
VCR.use_cassette('artist_7181') { Artist.find(7181) }
|
8
|
+
end
|
7
9
|
|
8
10
|
it { should be_an(Artist) }
|
9
11
|
its (:id) { should == 7181 }
|
@@ -13,24 +15,28 @@ module Beatport::Catalog
|
|
13
15
|
its (:last_publish_date) { should >= Date.new(2011, 12, 15)}
|
14
16
|
its (:biography) { should == "" }
|
15
17
|
its (:'genres.length') { should be > 1 }
|
16
|
-
its (:'sub_genres.length') { should be > 1 }
|
17
|
-
its (:'top_downloads.length') { should be > 1 }
|
18
|
-
its (:'images.small.url') { should == "http://geo-media.beatport.com/
|
19
|
-
its (:'images.medium.url') { should == "http://geo-media.beatport.com/
|
20
|
-
its (:'images.large.url') { should == "http://geo-media.beatport.com/
|
18
|
+
its (:'sub_genres.length') { should be > 1 }
|
19
|
+
its (:'top_downloads.length') { VCR.use_cassette('artist_7181_top_downloads') { should be > 1 } }
|
20
|
+
its (:'images.small.url') { should == "http://geo-media.beatport.com/image/491527.jpg" }
|
21
|
+
its (:'images.medium.url') { should == "http://geo-media.beatport.com/image/491530.jpg" }
|
22
|
+
its (:'images.large.url') { should == "http://geo-media.beatport.com/image/4686424.jpg" }
|
21
23
|
# its (:'featured_releases.length') { should be > 1 }
|
22
24
|
end
|
23
25
|
|
24
26
|
describe '.find' do
|
25
27
|
context 'with a single id' do
|
26
|
-
subject
|
28
|
+
subject do
|
29
|
+
VCR.use_cassette('artist_7181') { Artist.find(7181) }
|
30
|
+
end
|
27
31
|
|
28
32
|
it { should be_an(Artist) }
|
29
33
|
its (:id) { should == 7181 }
|
30
34
|
end
|
31
35
|
|
32
36
|
context 'with multiple ids' do
|
33
|
-
subject
|
37
|
+
subject do
|
38
|
+
VCR.use_cassette('artist_7181_7182') { Artist.find(7181, 7182) }
|
39
|
+
end
|
34
40
|
|
35
41
|
# it { should be_a(Collection) }
|
36
42
|
its (:length) { should == 2 }
|
@@ -40,7 +46,9 @@ module Beatport::Catalog
|
|
40
46
|
end
|
41
47
|
|
42
48
|
context 'with an array of ids' do
|
43
|
-
subject
|
49
|
+
subject do
|
50
|
+
VCR.use_cassette('artist_7181_7182') { Artist.find(7181, 7182) }
|
51
|
+
end
|
44
52
|
|
45
53
|
# it { should be_a(Collection) }
|
46
54
|
its (:length) { should == 2 }
|
@@ -52,53 +60,65 @@ module Beatport::Catalog
|
|
52
60
|
|
53
61
|
describe '.all' do
|
54
62
|
it "should get arbitrary artists" do
|
55
|
-
|
56
|
-
|
63
|
+
VCR.use_cassette('artist_all') do
|
64
|
+
artists = Artist.all
|
65
|
+
artists.length.should == 10
|
66
|
+
end
|
57
67
|
end
|
58
68
|
|
59
69
|
it "should get the first page with 5 artists per page" do
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
70
|
+
VCR.use_cassette('artist_all_5_per_page') do
|
71
|
+
artists = Artist.all :per_page => 5, :page => 1
|
72
|
+
artists.length.should == 5
|
73
|
+
artists.page.should == 1
|
74
|
+
artists.per_page.should == 5
|
75
|
+
end
|
64
76
|
end
|
65
77
|
|
66
78
|
it "should get the first page with 5 artists per page, sorted by publish date and artist id, for the House genre" do
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
old_id = nil
|
71
|
-
old_date = artists.first.last_publish_date
|
72
|
-
|
73
|
-
artists.each do |artist|
|
74
|
-
old_id = nil if old_date.to_s != artist.last_publish_date.to_s
|
79
|
+
VCR.use_cassette('artist_all_sorted') do
|
80
|
+
artists = Artist.all(:sort_by=> { :publish_date => 'asc', :artist_id => 'asc' }, :genre_id=> 5, :per_page=>5, :page=>1)
|
81
|
+
artists.length.should == 5
|
75
82
|
|
76
|
-
|
77
|
-
|
78
|
-
artist.id.should be >= old_id if old_id
|
79
|
-
artist.last_publish_date.should be >= old_date if old_date
|
83
|
+
old_id = nil
|
84
|
+
old_date = artists.first.last_publish_date
|
80
85
|
|
81
|
-
|
82
|
-
|
86
|
+
artists.each do |artist|
|
87
|
+
old_id = nil if old_date.to_s != artist.last_publish_date.to_s
|
88
|
+
|
89
|
+
# beatport has some bad genre data?
|
90
|
+
# artist.genres.map(&:id).should include(5)
|
91
|
+
artist.id.should be >= old_id if old_id
|
92
|
+
artist.last_publish_date.should be >= old_date if old_date
|
93
|
+
|
94
|
+
old_id = artist.id
|
95
|
+
old_date = artist.publish_date
|
96
|
+
end
|
83
97
|
end
|
84
98
|
end
|
85
99
|
|
86
100
|
it "should get arbitrary artists with filter metadata for all genre names and artist names" do
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
101
|
+
VCR.use_cassette('artist_all_return_facets') do
|
102
|
+
artists = Artist.all :return_facets => ['genre_name', 'performer_name']
|
103
|
+
|
104
|
+
artists.facets['fields']['performer_name'].count.should be > 1
|
105
|
+
artists.facets['fields']['genre_name'].count.should be > 1
|
106
|
+
end
|
91
107
|
end
|
92
108
|
|
93
109
|
it "should get all trance artists for above & beyond" do
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
artists =
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
110
|
+
pending "Request doesn't return any results"
|
111
|
+
|
112
|
+
VCR.use_cassette('artist_all_for_facets') do
|
113
|
+
artists = Artist.all :facets => {:genre_name => ['Trance', 'Progessive House']}
|
114
|
+
|
115
|
+
artists.each do |artist|
|
116
|
+
artists = artist['artists'].map { |a| a['name'] }
|
117
|
+
artists.should include("Above & Beyond")
|
118
|
+
|
119
|
+
genres = artist['genres'].map { |a| a['name'] }
|
120
|
+
genres.should include('Trance')
|
121
|
+
end
|
102
122
|
end
|
103
123
|
end
|
104
124
|
end
|