discogs-wrapper 1.1.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +9 -0
- data/README.markdown +123 -43
- data/lib/discogs-wrapper.rb +1 -0
- data/lib/discogs.rb +1 -0
- data/lib/wrapper/authentication.rb +56 -0
- data/lib/wrapper/wrapper.rb +732 -43
- data/spec/samples/valid_artist.json +1 -0
- data/spec/samples/valid_artist_releases.json +1 -0
- data/spec/samples/valid_fields.json +48 -0
- data/spec/samples/valid_folder.json +6 -0
- data/spec/samples/valid_identity.json +6 -0
- data/spec/samples/valid_label.json +1 -0
- data/spec/samples/valid_label_releases.json +1 -0
- data/spec/samples/valid_listing.json +1 -0
- data/spec/samples/valid_master_release.json +1 -0
- data/spec/samples/valid_master_release_versions.json +1 -0
- data/spec/samples/valid_order.json +57 -0
- data/spec/samples/valid_order_messages.json +102 -0
- data/spec/samples/valid_orders.json +68 -0
- data/spec/samples/valid_price_suggestions.json +34 -0
- data/spec/samples/valid_release.json +1 -0
- data/spec/samples/valid_search_results.json +1 -0
- data/spec/samples/valid_user.json +1 -0
- data/spec/samples/valid_user_collection.json +1 -0
- data/spec/samples/valid_user_folder.json +6 -0
- data/spec/samples/valid_user_folders.json +16 -0
- data/spec/samples/valid_user_inventory.json +41 -0
- data/spec/samples/valid_user_profile.json +25 -0
- data/spec/samples/valid_user_wantlist.json +1 -0
- data/spec/samples/valid_wantlist_release.json +41 -0
- data/spec/spec_helper.rb +4 -18
- data/spec/wrapper_methods/add_release_to_user_wantlist_spec.rb +42 -0
- data/spec/wrapper_methods/edit_release_in_user_wantlist_spec.rb +38 -0
- data/spec/wrapper_methods/edit_user_spec.rb +36 -0
- data/spec/wrapper_methods/get_artist_releases_spec.rb +49 -0
- data/spec/wrapper_methods/get_artist_spec.rb +15 -75
- data/spec/wrapper_methods/get_identity_spec.rb +35 -0
- data/spec/wrapper_methods/get_label_releases_spec.rb +49 -0
- data/spec/wrapper_methods/get_label_spec.rb +15 -28
- data/spec/wrapper_methods/get_listing_spec.rb +40 -0
- data/spec/wrapper_methods/get_master_release_spec.rb +16 -42
- data/spec/wrapper_methods/get_master_release_versions_spec.rb +49 -0
- data/spec/wrapper_methods/get_order_messages_spec.rb +36 -0
- data/spec/wrapper_methods/get_order_spec.rb +36 -0
- data/spec/wrapper_methods/get_price_suggestions_spec.rb +36 -0
- data/spec/wrapper_methods/get_release_spec.rb +26 -52
- data/spec/wrapper_methods/get_user_collection_spec.rb +41 -0
- data/spec/wrapper_methods/get_user_folder_spec.rb +46 -0
- data/spec/wrapper_methods/get_user_folders_spec.rb +42 -0
- data/spec/wrapper_methods/get_user_inventory_spec.rb +45 -0
- data/spec/wrapper_methods/get_user_spec.rb +45 -0
- data/spec/wrapper_methods/get_user_wantlist_spec.rb +49 -0
- data/spec/wrapper_methods/search_spec.rb +22 -293
- data/spec/wrapper_spec.rb +124 -45
- metadata +162 -67
- data/Rakefile +0 -26
- data/discogs.gemspec +0 -22
- data/lib/wrapper/resource.rb +0 -80
- data/lib/wrapper/resource_mappings.rb +0 -80
- data/lib/wrapper/resources/artist.rb +0 -40
- data/lib/wrapper/resources/artist_release.rb +0 -28
- data/lib/wrapper/resources/format.rb +0 -11
- data/lib/wrapper/resources/generic_list.rb +0 -29
- data/lib/wrapper/resources/image.rb +0 -11
- data/lib/wrapper/resources/label.rb +0 -16
- data/lib/wrapper/resources/label_release.rb +0 -17
- data/lib/wrapper/resources/master_release.rb +0 -19
- data/lib/wrapper/resources/master_release_version.rb +0 -17
- data/lib/wrapper/resources/release.rb +0 -25
- data/lib/wrapper/resources/release_artist.rb +0 -21
- data/lib/wrapper/resources/release_label.rb +0 -10
- data/lib/wrapper/resources/search.rb +0 -61
- data/lib/wrapper/resources/search_result.rb +0 -17
- data/lib/wrapper/resources/track.rb +0 -19
- data/lib/wrapper/resources/user.rb +0 -11
- data/lib/wrapper/resources/video.rb +0 -11
- data/spec/resource_spec.rb +0 -27
- data/spec/resources/artist_release_spec.rb +0 -59
- data/spec/resources/artist_spec.rb +0 -15
- data/spec/resources/format_spec.rb +0 -41
- data/spec/resources/generic_list_spec.rb +0 -66
- data/spec/resources/image_spec.rb +0 -43
- data/spec/resources/label_release_spec.rb +0 -55
- data/spec/resources/label_spec.rb +0 -15
- data/spec/resources/master_release_spec.rb +0 -15
- data/spec/resources/master_release_version_spec.rb +0 -55
- data/spec/resources/release_artist_spec.rb +0 -43
- data/spec/resources/release_label_spec.rb +0 -31
- data/spec/resources/release_spec.rb +0 -15
- data/spec/resources/search_result_spec.rb +0 -47
- data/spec/resources/search_spec.rb +0 -15
- data/spec/resources/track_spec.rb +0 -56
- data/spec/resources/video_spec.rb +0 -43
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Discogs::Label do
|
4
|
-
|
5
|
-
it "should map to empty array" do
|
6
|
-
Discogs::Label.element_names.should == []
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should map plural to empty array" do
|
10
|
-
Discogs::Label.plural_element_names.should == []
|
11
|
-
end
|
12
|
-
|
13
|
-
## See ./spec/wrapper_methods/get_label_spec.rb for extensive tests of this class.
|
14
|
-
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Discogs::MasterRelease do
|
4
|
-
|
5
|
-
it "should map to empty array" do
|
6
|
-
Discogs::Release.element_names.should == []
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should map plural to empty array" do
|
10
|
-
Discogs::Release.plural_element_names.should == []
|
11
|
-
end
|
12
|
-
|
13
|
-
## See ./spec/wrapper_methods/get_master_release_spec.rb for extensive tests of this class.
|
14
|
-
|
15
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Discogs::MasterRelease::Version do
|
4
|
-
|
5
|
-
it "should map to version" do
|
6
|
-
Discogs::MasterRelease::Version.element_names.should == [ :version ]
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should map to plural versions" do
|
10
|
-
Discogs::MasterRelease::Version.plural_element_names.should == [ :versions ]
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "when asking for master-release-version information" do
|
14
|
-
|
15
|
-
before do
|
16
|
-
data = File.read(File.join(File.dirname(__FILE__), "..", "samples", "valid_master_release_version.xml"))
|
17
|
-
@version = Discogs::MasterRelease::Version.new(data)
|
18
|
-
@version.build!
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have an ID attribute" do
|
22
|
-
@version.id.should == "1025"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should have a status attribute" do
|
26
|
-
@version.status.should == "Accepted"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should have a title attribute" do
|
30
|
-
@version.title.should == "Silentintroduction"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should have a label attribute" do
|
34
|
-
@version.label.should == "Planet E"
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should have a catno attribute" do
|
38
|
-
@version.catno.should == "PE65234"
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should have a country attribute" do
|
42
|
-
@version.country.should == "US"
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should have a released attribute" do
|
46
|
-
@version.released.should == "1997-11-00"
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should have a thumb attribute" do
|
50
|
-
@version.thumb.should == "http://api.discogs.com/image/R-150-1025-1316440394.jpeg"
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Discogs::Release::Artist do
|
4
|
-
|
5
|
-
it "should map to artist" do
|
6
|
-
Discogs::Release::Artist.element_names.should == [ :artist ]
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should map to plural artists and extraartists" do
|
10
|
-
Discogs::Release::Artist.plural_element_names.should == [ :artists, :extraartists ]
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "when asking for release-artist information" do
|
14
|
-
|
15
|
-
before do
|
16
|
-
data = File.read(File.join(File.dirname(__FILE__), "..", "samples", "valid_release_artist.xml"))
|
17
|
-
@release_artist = Discogs::Release::Artist.new(data)
|
18
|
-
@release_artist.build!
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have a name attribute" do
|
22
|
-
@release_artist.name.should == "Master's Hammer"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should have a role attribute" do
|
26
|
-
@release_artist.role.should == "Shrieks"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should have a join attribute" do
|
30
|
-
@release_artist.join.should == "Relatives"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should have an anv attribute" do
|
34
|
-
@release_artist.anv.should == "wtf?"
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should have a tracks attribute" do
|
38
|
-
@release_artist.tracks.should == "1,2,4"
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Discogs::Release::Label do
|
4
|
-
|
5
|
-
it "should map to label" do
|
6
|
-
Discogs::Release::Label.element_names.should == [ :label ]
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should map to plural labels" do
|
10
|
-
Discogs::Release::Label.plural_element_names.should == [ :labels ]
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "when asking for release-label information" do
|
14
|
-
|
15
|
-
before do
|
16
|
-
data = File.read(File.join(File.dirname(__FILE__), "..", "samples", "valid_release_label.xml"))
|
17
|
-
@release_label = Discogs::Release::Label.new(data)
|
18
|
-
@release_label.build!
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have a name attribute" do
|
22
|
-
@release_label.name.should == "Toxic Diffusion"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should have a catno attribute" do
|
26
|
-
@release_label.catno.should == "clp89"
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Discogs::Release do
|
4
|
-
|
5
|
-
it "should map to empty array" do
|
6
|
-
Discogs::Release.element_names.should == []
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should map plural to empty array" do
|
10
|
-
Discogs::Release.plural_element_names.should == []
|
11
|
-
end
|
12
|
-
|
13
|
-
## See ./spec/wrapper_methods/get_release_spec.rb for extensive tests of this class.
|
14
|
-
|
15
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Discogs::Search::Result do
|
4
|
-
|
5
|
-
it "should map to result" do
|
6
|
-
Discogs::Search::Result.element_names.should == [ :result ]
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should map to plural exactresults and searchresults" do
|
10
|
-
Discogs::Search::Result.plural_element_names.should == [ :exactresults, :searchresults ]
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "when asking for search result information" do
|
14
|
-
|
15
|
-
before do
|
16
|
-
data = File.read(File.join(File.dirname(__FILE__), "..", "samples", "valid_search_result.xml"))
|
17
|
-
@search_result = Discogs::Search::Result.new(data)
|
18
|
-
@search_result.build!
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have a number attribute" do
|
22
|
-
@search_result.num.should == "2"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should have a type attribute" do
|
26
|
-
@search_result.type.should == "artist"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should have a title attribute" do
|
30
|
-
@search_result.title.should == "Karin Slaughter"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should have a uri attribute" do
|
34
|
-
@search_result.uri.should == "http://www.discogs.com/artist/Karin+Slaughter"
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should have a summary attribute" do
|
38
|
-
@search_result.summary.should == "Karin Slaughter Karin Slaughter"
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should have a anv attribute" do
|
42
|
-
@search_result.anv.should == "Slaughter"
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Discogs::Search do
|
4
|
-
|
5
|
-
it "should map to empty array" do
|
6
|
-
Discogs::Search.element_names.should == []
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should map plural to empty array" do
|
10
|
-
Discogs::Search.plural_element_names.should == []
|
11
|
-
end
|
12
|
-
|
13
|
-
## See ./spec/wrapper_methods/search_spec.rb for extensive tests of this class.
|
14
|
-
|
15
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Discogs::Release::Track do
|
4
|
-
|
5
|
-
it "should map to track" do
|
6
|
-
Discogs::Release::Track.element_names.should == [ :track ]
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should map to plural tracklist" do
|
10
|
-
Discogs::Release::Track.plural_element_names.should == [ :tracklist ]
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "when asking for track information" do
|
14
|
-
|
15
|
-
before do
|
16
|
-
data = File.read(File.join(File.dirname(__FILE__), "..", "samples", "valid_track.xml"))
|
17
|
-
@track = Discogs::Release::Track.new(data)
|
18
|
-
@track.build!
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have a title attribute" do
|
22
|
-
@track.title.should == "A dark forest spreads all around"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should have a duration attribute" do
|
26
|
-
@track.duration.should == "7:31"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should have a position attribute" do
|
30
|
-
@track.position.should == "2"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should have an array of artists" do
|
34
|
-
@track.artists.should be_instance_of(Array)
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should have an array of extra artists" do
|
38
|
-
@track.extraartists.should be_instance_of(Array)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should have built each artist" do
|
42
|
-
@track.artists[0].should be_instance_of(Discogs::Release::Track::Artist)
|
43
|
-
|
44
|
-
@track.artists[0].name.should == "Master's Hammer"
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should have built each extra artist" do
|
48
|
-
@track.extraartists[0].should be_instance_of(Discogs::Release::Track::Artist)
|
49
|
-
|
50
|
-
@track.extraartists[0].name.should == "Root"
|
51
|
-
@track.extraartists[0].role.should == "Imagery"
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Discogs::Video do
|
4
|
-
|
5
|
-
it "should map to video" do
|
6
|
-
Discogs::Video.element_names.should == [ :video ]
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should map to plural videos" do
|
10
|
-
Discogs::Video.plural_element_names.should == [ :videos ]
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "when asking for video information" do
|
14
|
-
|
15
|
-
before do
|
16
|
-
data = File.read(File.join(File.dirname(__FILE__), "..", "samples", "valid_video.xml"))
|
17
|
-
@video = Discogs::Video.new(data)
|
18
|
-
@video.build!
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have a duration attribute" do
|
22
|
-
@video.duration.should == "334"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should have a embed attribute" do
|
26
|
-
@video.embed.should == "true"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should have a description attribute" do
|
30
|
-
@video.description.should == "The Persuader-Stockholm-Sodermalm"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should have a title attribute" do
|
34
|
-
@video.title.should == "The Persuader"
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should have a src attribute" do
|
38
|
-
@video.src.should == "http://www.youtube.com/watch?v=QVdDhOnoR8k"
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|