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.
Files changed (93) hide show
  1. data/LICENSE +9 -0
  2. data/README.markdown +123 -43
  3. data/lib/discogs-wrapper.rb +1 -0
  4. data/lib/discogs.rb +1 -0
  5. data/lib/wrapper/authentication.rb +56 -0
  6. data/lib/wrapper/wrapper.rb +732 -43
  7. data/spec/samples/valid_artist.json +1 -0
  8. data/spec/samples/valid_artist_releases.json +1 -0
  9. data/spec/samples/valid_fields.json +48 -0
  10. data/spec/samples/valid_folder.json +6 -0
  11. data/spec/samples/valid_identity.json +6 -0
  12. data/spec/samples/valid_label.json +1 -0
  13. data/spec/samples/valid_label_releases.json +1 -0
  14. data/spec/samples/valid_listing.json +1 -0
  15. data/spec/samples/valid_master_release.json +1 -0
  16. data/spec/samples/valid_master_release_versions.json +1 -0
  17. data/spec/samples/valid_order.json +57 -0
  18. data/spec/samples/valid_order_messages.json +102 -0
  19. data/spec/samples/valid_orders.json +68 -0
  20. data/spec/samples/valid_price_suggestions.json +34 -0
  21. data/spec/samples/valid_release.json +1 -0
  22. data/spec/samples/valid_search_results.json +1 -0
  23. data/spec/samples/valid_user.json +1 -0
  24. data/spec/samples/valid_user_collection.json +1 -0
  25. data/spec/samples/valid_user_folder.json +6 -0
  26. data/spec/samples/valid_user_folders.json +16 -0
  27. data/spec/samples/valid_user_inventory.json +41 -0
  28. data/spec/samples/valid_user_profile.json +25 -0
  29. data/spec/samples/valid_user_wantlist.json +1 -0
  30. data/spec/samples/valid_wantlist_release.json +41 -0
  31. data/spec/spec_helper.rb +4 -18
  32. data/spec/wrapper_methods/add_release_to_user_wantlist_spec.rb +42 -0
  33. data/spec/wrapper_methods/edit_release_in_user_wantlist_spec.rb +38 -0
  34. data/spec/wrapper_methods/edit_user_spec.rb +36 -0
  35. data/spec/wrapper_methods/get_artist_releases_spec.rb +49 -0
  36. data/spec/wrapper_methods/get_artist_spec.rb +15 -75
  37. data/spec/wrapper_methods/get_identity_spec.rb +35 -0
  38. data/spec/wrapper_methods/get_label_releases_spec.rb +49 -0
  39. data/spec/wrapper_methods/get_label_spec.rb +15 -28
  40. data/spec/wrapper_methods/get_listing_spec.rb +40 -0
  41. data/spec/wrapper_methods/get_master_release_spec.rb +16 -42
  42. data/spec/wrapper_methods/get_master_release_versions_spec.rb +49 -0
  43. data/spec/wrapper_methods/get_order_messages_spec.rb +36 -0
  44. data/spec/wrapper_methods/get_order_spec.rb +36 -0
  45. data/spec/wrapper_methods/get_price_suggestions_spec.rb +36 -0
  46. data/spec/wrapper_methods/get_release_spec.rb +26 -52
  47. data/spec/wrapper_methods/get_user_collection_spec.rb +41 -0
  48. data/spec/wrapper_methods/get_user_folder_spec.rb +46 -0
  49. data/spec/wrapper_methods/get_user_folders_spec.rb +42 -0
  50. data/spec/wrapper_methods/get_user_inventory_spec.rb +45 -0
  51. data/spec/wrapper_methods/get_user_spec.rb +45 -0
  52. data/spec/wrapper_methods/get_user_wantlist_spec.rb +49 -0
  53. data/spec/wrapper_methods/search_spec.rb +22 -293
  54. data/spec/wrapper_spec.rb +124 -45
  55. metadata +162 -67
  56. data/Rakefile +0 -26
  57. data/discogs.gemspec +0 -22
  58. data/lib/wrapper/resource.rb +0 -80
  59. data/lib/wrapper/resource_mappings.rb +0 -80
  60. data/lib/wrapper/resources/artist.rb +0 -40
  61. data/lib/wrapper/resources/artist_release.rb +0 -28
  62. data/lib/wrapper/resources/format.rb +0 -11
  63. data/lib/wrapper/resources/generic_list.rb +0 -29
  64. data/lib/wrapper/resources/image.rb +0 -11
  65. data/lib/wrapper/resources/label.rb +0 -16
  66. data/lib/wrapper/resources/label_release.rb +0 -17
  67. data/lib/wrapper/resources/master_release.rb +0 -19
  68. data/lib/wrapper/resources/master_release_version.rb +0 -17
  69. data/lib/wrapper/resources/release.rb +0 -25
  70. data/lib/wrapper/resources/release_artist.rb +0 -21
  71. data/lib/wrapper/resources/release_label.rb +0 -10
  72. data/lib/wrapper/resources/search.rb +0 -61
  73. data/lib/wrapper/resources/search_result.rb +0 -17
  74. data/lib/wrapper/resources/track.rb +0 -19
  75. data/lib/wrapper/resources/user.rb +0 -11
  76. data/lib/wrapper/resources/video.rb +0 -11
  77. data/spec/resource_spec.rb +0 -27
  78. data/spec/resources/artist_release_spec.rb +0 -59
  79. data/spec/resources/artist_spec.rb +0 -15
  80. data/spec/resources/format_spec.rb +0 -41
  81. data/spec/resources/generic_list_spec.rb +0 -66
  82. data/spec/resources/image_spec.rb +0 -43
  83. data/spec/resources/label_release_spec.rb +0 -55
  84. data/spec/resources/label_spec.rb +0 -15
  85. data/spec/resources/master_release_spec.rb +0 -15
  86. data/spec/resources/master_release_version_spec.rb +0 -55
  87. data/spec/resources/release_artist_spec.rb +0 -43
  88. data/spec/resources/release_label_spec.rb +0 -31
  89. data/spec/resources/release_spec.rb +0 -15
  90. data/spec/resources/search_result_spec.rb +0 -47
  91. data/spec/resources/search_spec.rb +0 -15
  92. data/spec/resources/track_spec.rb +0 -56
  93. 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