discogs-wrapper 1.1.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -4,44 +4,44 @@ describe Discogs::Wrapper do
4
4
 
5
5
  before do
6
6
  @wrapper = Discogs::Wrapper.new("some_user_agent")
7
- @artist_name = "Root"
7
+ @label_id = 1000
8
8
  end
9
9
 
10
10
  describe "when asking for label information" do
11
11
 
12
12
  before do
13
13
  @http_request = mock(Net::HTTP)
14
- @http_response = mock(Net::HTTPResponse, :code => "200", :body => valid_label_xml)
15
- @http_response_as_file = mock(StringIO, :read => valid_label_xml)
14
+ @http_response = mock(Net::HTTPResponse, :code => "200", :body => read_sample("label"))
15
+ @http_response_as_file = mock(StringIO, :read => read_sample("label"))
16
16
  Zlib::GzipReader.should_receive(:new).and_return(@http_response_as_file)
17
17
  @http_request.should_receive(:start).and_return(@http_response)
18
18
  Net::HTTP.should_receive(:new).and_return(@http_request)
19
19
 
20
- @label = @wrapper.get_label(@label_name)
20
+ @label = @wrapper.get_label(@label_id)
21
21
  end
22
22
 
23
23
  describe "when calling simple label attributes" do
24
24
 
25
25
  it "should have a name attribute" do
26
- @label.name.should == "Sombre Records"
26
+ @label.name.should == "Warner Bros. Records"
27
27
  end
28
28
 
29
- it "should have a contact info attribute" do
30
- @label.contactinfo.should == "Unknown, Germany"
29
+ it "should have a releases_url attribute" do
30
+ @label.releases_url.should =~ /labels\/1000\/releases/
31
31
  end
32
32
 
33
33
  it "should have a profile attribute" do
34
- @label.profile.should == "Released some OK LPs"
34
+ @label.profile.should =~ /Founded in 1958/
35
35
  end
36
36
 
37
37
  it "should have a parent label attribute" do
38
- @label.parentlabel.should == "SuperSombre"
38
+ @label.parent_label.name.should == "Warner Music Group"
39
39
  end
40
40
 
41
41
  it "should have one or more URLs" do
42
42
  @label.urls.should be_instance_of(Array)
43
- @label.urls[0].should == "http://www.sombrerecords.com"
44
- @label.urls[1].should == "http://www.discogs.com/label/Sombre+Records"
43
+ @label.urls[0].should == "http://www.warnerbrosrecords.com/"
44
+ @label.urls[1].should == "http://www.facebook.com/WarnerBrosRecords"
45
45
  end
46
46
 
47
47
  end
@@ -50,17 +50,17 @@ describe Discogs::Wrapper do
50
50
 
51
51
  it "should have a traversible list of images" do
52
52
  @label.images.should be_instance_of(Array)
53
- @label.images[0].should be_instance_of(Discogs::Image)
54
53
  end
55
54
 
56
55
  it "should have a traversible list of sub-labels" do
57
56
  @label.sublabels.should be_instance_of(Array)
58
- @label.sublabels[0].should == "SubSombre"
59
- @label.sublabels[1].should == "Sony BMG"
57
+ @label.sublabels[0].name.should == "1017 Brick Squad Records"
60
58
  end
61
59
 
62
60
  it "should have specifications for each image" do
63
- specs = [ [ '400', '300', 'primary' ], [ '450', '350', 'secondary' ] ]
61
+ specs = [ [ 600, 780, 'primary' ], [ 533, 698, 'secondary' ], [ 600, 600, 'secondary' ],
62
+ [ 532, 532, 'secondary' ], [ 175, 192, 'secondary' ], [ 200, 94, 'secondary' ],
63
+ [ 500, 493, 'secondary' ] ]
64
64
 
65
65
  @label.images.each_with_index do |image, index|
66
66
  image.width.should == specs[index][0]
@@ -69,19 +69,6 @@ describe Discogs::Wrapper do
69
69
  end
70
70
  end
71
71
 
72
- it "should have a traversible list of releases" do
73
- @label.releases.should be_instance_of(Array)
74
- @label.releases[0].should be_instance_of(Discogs::Label::Release)
75
- end
76
-
77
- it "should have a catno for the first release" do
78
- @label.releases[0].catno.should == "SMB01"
79
- end
80
-
81
- it "should have an artist name for the second release" do
82
- @label.releases[1].artist.should == "Moonblood"
83
- end
84
-
85
72
  end
86
73
 
87
74
  end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe Discogs::Wrapper do
4
+
5
+ before do
6
+ @oauth_access_token = mock(OAuth::AccessToken)
7
+ @wrapper = Discogs::Wrapper.new("some_user_agent", @oauth_access_token)
8
+ @listing_id = 41578240
9
+ end
10
+
11
+ describe ".get_listing" do
12
+
13
+ before do
14
+ @oauth_response = mock(OAuth::AccessToken, :code => "200", :body => read_sample("listing"))
15
+ @oauth_response_as_file = mock(StringIO, :read => read_sample("listing"))
16
+ Zlib::GzipReader.should_receive(:new).and_return(@oauth_response_as_file)
17
+ @oauth_access_token.should_receive(:get).and_return(@oauth_response)
18
+
19
+ @listing = @wrapper.get_listing(@listing_id)
20
+ end
21
+
22
+ describe "when calling simple listing attributes" do
23
+
24
+ it "should have a username" do
25
+ @listing.status.should == "For Sale"
26
+ end
27
+
28
+ it "should have a weight" do
29
+ @listing.weight.should == 239.0
30
+ end
31
+
32
+ it "should have a seller" do
33
+ @listing.seller.username.should == "EmpireDVDs"
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+
40
+ end
@@ -1,18 +1,19 @@
1
+
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Discogs::Wrapper do
4
5
 
5
6
  before do
6
7
  @wrapper = Discogs::Wrapper.new("some_user_agent")
7
- @master_release_id = "666666"
8
+ @master_release_id = "9800"
8
9
  end
9
10
 
10
- describe "when asking for master_release information" do
11
+ describe ".get_master_release" do
11
12
 
12
13
  before do
13
14
  @http_request = mock(Net::HTTP)
14
- @http_response = mock(Net::HTTPResponse, :code => "200", :body => valid_master_release_xml)
15
- @http_response_as_file = mock(StringIO, :read => valid_master_release_xml)
15
+ @http_response = mock(Net::HTTPResponse, :code => "200", :body => read_sample("master_release"))
16
+ @http_response_as_file = mock(StringIO, :read => read_sample("master_release"))
16
17
  Zlib::GzipReader.should_receive(:new).and_return(@http_response_as_file)
17
18
  @http_request.should_receive(:start).and_return(@http_response)
18
19
  Net::HTTP.should_receive(:new).and_return(@http_request)
@@ -20,46 +21,40 @@ describe Discogs::Wrapper do
20
21
  @master_release = @wrapper.get_master_release(@master_release_id)
21
22
  end
22
23
 
23
- describe "when calling simple master_release attributes" do
24
+ describe "when calling simple master release attributes" do
24
25
 
25
26
  it "should have an ID attribute" do
26
- @master_release.id.should == "6119"
27
+ @master_release.id.should == 9800
27
28
  end
28
29
 
29
30
  it "should have a main_release attribute" do
30
- @master_release.main_release.should == "1025"
31
+ @master_release.main_release.should == 5160870
31
32
  end
32
33
 
33
34
  it "should have one or more tracks" do
34
35
  @master_release.tracklist.should be_instance_of(Array)
35
- @master_release.tracklist[0].should be_instance_of(Discogs::MasterRelease::Track)
36
+ @master_release.tracklist[0].duration.should == "2:56"
36
37
  end
37
38
 
38
39
  it "should have one or more genres" do
39
40
  @master_release.genres.should be_instance_of(Array)
40
- @master_release.genres[0].should == "Electronic"
41
+ @master_release.genres[0].should == "Rock"
41
42
  end
42
43
 
43
- it "should have one or more versions" do
44
- @master_release.versions.should be_instance_of(Array)
45
- @master_release.versions[0].should be_instance_of(Discogs::MasterRelease::Version)
44
+ it "should have a versions_url" do
45
+ @master_release.versions_url.should =~ /masters\/9800\/versions/
46
46
  end
47
47
 
48
48
  it "should have one or more images" do
49
49
  @master_release.images.should be_instance_of(Array)
50
- @master_release.images[0].should be_instance_of(Discogs::Image)
51
50
  end
52
51
 
53
52
  end
54
53
 
55
54
  describe "when calling complex master_release attributes" do
56
55
 
57
- it "should have a duration for the first track" do
58
- @master_release.tracklist[0].duration.should == "4:42"
59
- end
60
-
61
56
  it "should have specifications for each image" do
62
- specs = [ [ '600', '590', 'primary' ], [ '600', '594', 'secondary' ], [ '600', '297', 'secondary' ], [ '600', '601', 'secondary' ], [ '600', '600', 'secondary' ] ]
57
+ specs = [ [ 600, 607, 'primary' ], [ 600, 604, 'secondary' ], [ 600, 598, 'secondary' ], [ 600, 601, 'secondary' ] ]
63
58
  @master_release.images.each_with_index do |image, index|
64
59
  image.width.should == specs[index][0]
65
60
  image.height.should == specs[index][1]
@@ -67,39 +62,18 @@ describe Discogs::Wrapper do
67
62
  end
68
63
  end
69
64
 
70
- it "should have attributes for each version" do
71
- specs = [ [ '1025', 'US', '2x12", Album' ], [ '4179', 'US', 'CD, Album' ], [ '416774', 'US', '12"' ] ]
72
- @master_release.versions.each_with_index do |version, index|
73
- version.id.should == specs[index][0]
74
- version.country.should == specs[index][1]
75
- version.format.should == specs[index][2]
76
- end
77
- end
78
-
79
65
  it "should have a traversible list of styles" do
80
66
  @master_release.styles.should be_instance_of(Array)
81
- @master_release.styles[0].should == "Deep House"
82
- end
83
-
84
- it "should have an artist associated to the second track" do
85
- @master_release.tracklist[1].artists.should be_instance_of(Array)
86
- @master_release.tracklist[1].artists[0].should be_instance_of(Discogs::MasterRelease::Track::Artist)
87
- @master_release.tracklist[1].artists[0].name.should == "Arakain"
67
+ @master_release.styles[0].should == "Prog Rock"
88
68
  end
89
69
 
90
70
  it "should have an extra artist associated to the second track" do
91
71
  @master_release.tracklist[1].extraartists.should be_instance_of(Array)
92
- @master_release.tracklist[1].extraartists[0].should be_instance_of(Discogs::MasterRelease::Track::Artist)
93
- @master_release.tracklist[1].extraartists[0].name.should == "Debustrol"
94
- @master_release.tracklist[1].extraartists[0].role.should == "Sadism"
95
- end
96
-
97
- it "should have no artist associated to the third track" do
98
- @master_release.tracklist[2].artists.should be_nil
72
+ @master_release.tracklist[1].extraartists[0].role.should == "Lead Vocals"
99
73
  end
100
74
 
101
75
  end
102
76
 
103
77
  end
104
78
 
105
- end
79
+ end
@@ -0,0 +1,49 @@
1
+ require 'spec_helper'
2
+
3
+ describe Discogs::Wrapper do
4
+
5
+ before do
6
+ @wrapper = Discogs::Wrapper.new("some_user_agent")
7
+ @master_id = "9800"
8
+ end
9
+
10
+ describe ".get_master_release_versions" do
11
+
12
+ before do
13
+ @http_request = mock(Net::HTTP)
14
+ @http_response = mock(Net::HTTPResponse, :code => "200", :body => read_sample("master_release_versions"))
15
+ @http_response_as_file = mock(StringIO, :read => read_sample("master_release_versions"))
16
+ Zlib::GzipReader.should_receive(:new).and_return(@http_response_as_file)
17
+ @http_request.should_receive(:start).and_return(@http_response)
18
+ Net::HTTP.should_receive(:new).and_return(@http_request)
19
+
20
+ @master_versions = @wrapper.get_master_release_versions(@master_id)
21
+ end
22
+
23
+ describe "when calling simple master release versions attributes" do
24
+
25
+ it "should have 3 versions per page" do
26
+ @master_versions.versions.length.should == 3
27
+ end
28
+
29
+ it "should have 3 versions total" do
30
+ @master_versions.pagination.items.should == 3
31
+ end
32
+
33
+ it "should have a first version with a label" do
34
+ @master_versions.versions.first.label.should == "Panton"
35
+ end
36
+
37
+ it "should have a first release with a released field" do
38
+ @master_versions.versions.first.released.should == "1982"
39
+ end
40
+
41
+ it "should not have a bogus attribute" do
42
+ @master_versions.bogus_attribute.should be_nil
43
+ end
44
+
45
+ end
46
+
47
+ end
48
+
49
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe Discogs::Wrapper do
4
+
5
+ before do
6
+ @oauth_access_token = mock(OAuth::AccessToken)
7
+ @wrapper = Discogs::Wrapper.new("some_user_agent", @oauth_access_token)
8
+ @order_id = "1-1"
9
+ end
10
+
11
+ describe ".get_order_messages" do
12
+
13
+ before do
14
+ @oauth_response = mock(OAuth::AccessToken, :code => "200", :body => read_sample("order_messages"))
15
+ @oauth_response_as_file = mock(StringIO, :read => read_sample("order_messages"))
16
+ Zlib::GzipReader.should_receive(:new).and_return(@oauth_response_as_file)
17
+ @oauth_access_token.should_receive(:get).and_return(@oauth_response)
18
+
19
+ @order_messages = @wrapper.get_order_messages(@order_id)
20
+ end
21
+
22
+ describe "when calling simple order messages attributes" do
23
+
24
+ it "should have an array of messages" do
25
+ @order_messages.messages.should be_instance_of(Array)
26
+ end
27
+
28
+ it "should have a username for the first message" do
29
+ @order_messages.messages[0].from.username.should == "example_seller"
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe Discogs::Wrapper do
4
+
5
+ before do
6
+ @oauth_access_token = mock(OAuth::AccessToken)
7
+ @wrapper = Discogs::Wrapper.new("some_user_agent", @oauth_access_token)
8
+ @order_id = "1-1"
9
+ end
10
+
11
+ describe ".get_order" do
12
+
13
+ before do
14
+ @oauth_response = mock(OAuth::AccessToken, :code => "200", :body => read_sample("order"))
15
+ @oauth_response_as_file = mock(StringIO, :read => read_sample("order"))
16
+ Zlib::GzipReader.should_receive(:new).and_return(@oauth_response_as_file)
17
+ @oauth_access_token.should_receive(:get).and_return(@oauth_response)
18
+
19
+ @order = @wrapper.get_order(@order_id)
20
+ end
21
+
22
+ describe "when calling simple order attributes" do
23
+
24
+ it "should have a status" do
25
+ @order.status.should == "New Order"
26
+ end
27
+
28
+ it "should have a fee" do
29
+ @order.fee.value.should == 2.52
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe Discogs::Wrapper do
4
+
5
+ before do
6
+ @oauth_access_token = mock(OAuth::AccessToken)
7
+ @wrapper = Discogs::Wrapper.new("some_user_agent", @oauth_access_token)
8
+ @release_id = "1"
9
+ end
10
+
11
+ describe ".get_price_suggestions" do
12
+
13
+ before do
14
+ @oauth_response = mock(OAuth::AccessToken, :code => "200", :body => read_sample("price_suggestions"))
15
+ @oauth_response_as_file = mock(StringIO, :read => read_sample("price_suggestions"))
16
+ Zlib::GzipReader.should_receive(:new).and_return(@oauth_response_as_file)
17
+ @oauth_access_token.should_receive(:get).and_return(@oauth_response)
18
+
19
+ @price_suggestions = @wrapper.get_price_suggestions(@release_id)
20
+ end
21
+
22
+ describe "when calling simple price suggestion attributes" do
23
+
24
+ it "should have a block for Near Mint" do
25
+ @price_suggestions["Near Mint (NM or M-)"].should_not be_nil
26
+ end
27
+
28
+ it "should have a price for Mint" do
29
+ @price_suggestions["Mint (M)"].value.should == 14.319139100000001
30
+ end
31
+
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -1,18 +1,19 @@
1
+
1
2
  require 'spec_helper'
2
3
 
3
4
  describe Discogs::Wrapper do
4
5
 
5
6
  before do
6
7
  @wrapper = Discogs::Wrapper.new("some_user_agent")
7
- @release_id = "666666"
8
+ @release_id = "1"
8
9
  end
9
10
 
10
- describe "when asking for release information" do
11
+ describe ".get_release" do
11
12
 
12
13
  before do
13
14
  @http_request = mock(Net::HTTP)
14
- @http_response = mock(Net::HTTPResponse, :code => "200", :body => valid_release_xml)
15
- @http_response_as_file = mock(StringIO, :read => valid_release_xml)
15
+ @http_response = mock(Net::HTTPResponse, :code => "200", :body => read_sample("release"))
16
+ @http_response_as_file = mock(StringIO, :read => read_sample("release"))
16
17
  Zlib::GzipReader.should_receive(:new).and_return(@http_response_as_file)
17
18
  @http_request.should_receive(:start).and_return(@http_response)
18
19
  Net::HTTP.should_receive(:new).and_return(@http_request)
@@ -23,58 +24,48 @@ describe Discogs::Wrapper do
23
24
  describe "when calling simple release attributes" do
24
25
 
25
26
  it "should have a title attribute" do
26
- @release.title.should == "Into the Abyss"
27
+ @release.title.should == "Stockholm"
27
28
  end
28
29
 
29
30
  it "should have an ID attribute" do
30
- @release.id.should == "666666"
31
+ @release.id.should == 1
31
32
  end
32
33
 
33
34
  it "should have a master_id attribute" do
34
- @release.master_id.should == "6111"
35
+ @release.master_id.should == 5427
35
36
  end
36
37
 
37
38
  it "should have one or more extra artists" do
38
39
  @release.extraartists.should be_instance_of(Array)
39
- @release.extraartists[0].should be_instance_of(Discogs::Release::Artist)
40
+ @release.extraartists[0].id.should == 239
40
41
  end
41
42
 
42
43
  it "should have one or more tracks" do
43
44
  @release.tracklist.should be_instance_of(Array)
44
- @release.tracklist[0].should be_instance_of(Discogs::Release::Track)
45
+ @release.tracklist[0].position.should == "A"
45
46
  end
46
47
 
47
48
  it "should have one or more genres" do
48
49
  @release.genres.should be_instance_of(Array)
49
- @release.genres[0].should == "Heavy Metal"
50
+ @release.genres[0].should == "Electronic"
50
51
  end
51
52
 
52
53
  it "should have one or more formats" do
53
54
  @release.formats.should be_instance_of(Array)
54
- @release.formats[0].should be_instance_of(Discogs::Release::Format)
55
+ @release.formats[0].name.should == "Vinyl"
55
56
  end
56
57
 
57
58
  it "should have one or more images" do
58
59
  @release.images.should be_instance_of(Array)
59
- @release.images[0].should be_instance_of(Discogs::Image)
60
- end
61
-
62
- it "should have one or more videos" do
63
- @release.videos.should be_instance_of(Array)
64
- @release.videos[0].should be_instance_of(Discogs::Video)
60
+ @release.images[0].type.should == "primary"
65
61
  end
66
62
 
67
-
68
63
  end
69
64
 
70
65
  describe "when calling complex release attributes" do
71
66
 
72
- it "should have a duration for the first track" do
73
- @release.tracklist[0].duration.should == "8:11"
74
- end
75
-
76
67
  it "should have specifications for each image" do
77
- specs = [ [ '600', '595', 'primary' ], [ '600', '593', 'secondary' ], [ '600', '539', 'secondary' ], [ '600', '452', 'secondary' ], [ '600', '567', 'secondary' ] ]
68
+ specs = [ [ 600, 600, 'primary' ], [ 600, 600, 'secondary' ], [ 600, 600, 'secondary' ], [ 600, 600, 'secondary' ] ]
78
69
  @release.images.each_with_index do |image, index|
79
70
  image.width.should == specs[index][0]
80
71
  image.height.should == specs[index][1]
@@ -83,52 +74,35 @@ describe Discogs::Wrapper do
83
74
  end
84
75
 
85
76
  it "should have specifications for each video" do
86
- specs = [ [ '334', 'true', 'http://www.youtube.com/watch?v=QVdDhOnoR8k' ], [ '350', 'true', 'http://www.youtube.com/watch?v=QVdDhOnoR7k' ] ]
77
+ specs = [ [ 380, true, 'http://www.youtube.com/watch?v=5rA8CTKKEP4' ], [ 335, true, 'http://www.youtube.com/watch?v=QVdDhOnoR8k' ],
78
+ [ 290, true, 'http://www.youtube.com/watch?v=AHuQWcylaU4' ], [ 175, true, 'http://www.youtube.com/watch?v=sLZvvJVir5g' ],
79
+ [ 324, true, 'http://www.youtube.com/watch?v=js_g1qtPmL0' ], [ 289, true, 'http://www.youtube.com/watch?v=hy47qgyJeG0' ] ]
87
80
  @release.videos.each_with_index do |video, index|
88
81
  video.duration.should == specs[index][0]
89
82
  video.embed.should == specs[index][1]
90
- video.src.should == specs[index][2]
83
+ video.uri.should == specs[index][2]
91
84
  end
92
85
  end
93
86
 
94
87
  it "should have a traversible list of styles" do
95
88
  @release.styles.should be_instance_of(Array)
96
- @release.styles[0].should == "Black Metal"
97
- @release.styles[1].should == "Thrash"
89
+ @release.styles[0].should == "Deep House"
98
90
  end
99
91
 
100
92
  it "should have a traversible list of labels" do
101
93
  @release.styles.should be_instance_of(Array)
102
- @release.labels[0].should be_instance_of(Discogs::Release::Label)
103
- @release.labels[0].catno.should == "Death9"
104
- @release.labels[0].name.should == "Culted"
94
+ @release.labels[0].catno.should == "SK032"
95
+ @release.labels[0].name.should == "Svek"
105
96
  end
106
97
 
107
98
  it "should have a name and quantity for the first format" do
108
- @release.formats[0].name.should == "CD"
109
- @release.formats[0].qty.should == "1"
110
- end
111
-
112
- it "should have an array of descriptions for the first format" do
113
- @release.formats[0].descriptions.should be_instance_of(Array)
114
- @release.formats[0].descriptions[0].should == "Album"
115
- end
116
-
117
- it "should have an artist associated to the second track" do
118
- @release.tracklist[1].artists.should be_instance_of(Array)
119
- @release.tracklist[1].artists[0].should be_instance_of(Discogs::Release::Track::Artist)
120
- @release.tracklist[1].artists[0].name.should == "Arakain"
121
- end
122
-
123
- it "should have an extra artist associated to the second track" do
124
- @release.tracklist[1].extraartists.should be_instance_of(Array)
125
- @release.tracklist[1].extraartists[0].should be_instance_of(Discogs::Release::Track::Artist)
126
- @release.tracklist[1].extraartists[0].name.should == "Debustrol"
127
- @release.tracklist[1].extraartists[0].role.should == "Sadism"
99
+ @release.formats.should be_instance_of(Array)
100
+ @release.formats[0].name.should == "Vinyl"
101
+ @release.formats[0].qty.should == "2"
128
102
  end
129
103
 
130
104
  it "should have a role associated to the first extra artist" do
131
- @release.extraartists[0].role.should == "Lyrics By"
105
+ @release.extraartists[0].role.should == "Music By [All Tracks By]"
132
106
  end
133
107
 
134
108
  it "should have no artist associated to the third track" do
@@ -139,4 +113,4 @@ describe Discogs::Wrapper do
139
113
 
140
114
  end
141
115
 
142
- end
116
+ end