discogs-wrapper 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -39,7 +39,7 @@ USAGE
39
39
  artist = wrapper.get_artist("Master's Hammer")
40
40
  release = wrapper.get_release("611973") # Supply an ID.
41
41
  label = wrapper.get_label("Monitor Records")
42
- search_results = wrapper.search("Necrovore")
42
+ search = wrapper.search("Necrovore")
43
43
 
44
44
  artist.name # => "Master's Hammer"
45
45
  artist.releases[0].title # => "Finished"
@@ -72,8 +72,7 @@ USAGE
72
72
  search.results[3].summary # => "First and only demo tape"
73
73
  search.results(:release)[0] # => <Discogs::Search::Result:0x343de34a>
74
74
 
75
-
76
75
  LICENSE
77
- -------
76
+ -----
78
77
 
79
- <a rel="license" href="http://creativecommons.org/licenses/by/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/3.0/80x15.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Discogs::Wrapper</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="https://github.com/buntine/discogs" property="cc:attributionName" rel="cc:attributionURL">Andrew Buntine</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.<br />Based on a work at <a xmlns:dct="http://purl.org/dc/terms/" href="http://www.discogs.com/help/api" rel="dct:source">www.discogs.com</a>.
78
+ See the LICENCE file. Copyright (c) Andrew Buntine 2011
data/discogs.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = "discogs-wrapper"
4
- s.version = "1.1.1"
5
- s.date = "2011-10-23"
4
+ s.version = "1.1.2"
5
+ s.date = "2011-10-24"
6
6
  s.summary = "Discogs::Wrapper is a full wrapper for the http://www.discogs.com API V2"
7
7
  s.homepage = "http://www.github.com/buntine/discogs"
8
8
  s.email = "info@andrewbuntine.com"
@@ -10,9 +10,9 @@ Gem::Specification.new do |s|
10
10
 
11
11
  s.description = "Discogs::Wrapper is a full wrapper for the http://www.discogs.com API V2"
12
12
 
13
- s.files = ["lib/wrapper", "lib/wrapper/resource_mappings.rb", "lib/wrapper/wrapper.rb", "lib/wrapper/resource.rb", "lib/wrapper/resources", "lib/wrapper/resources/format.rb", "lib/wrapper/resources/search.rb", "lib/wrapper/resources/label_release.rb", "lib/wrapper/resources/artist.rb", "lib/wrapper/resources/release_artist.rb", "lib/wrapper/resources/artist_release.rb", "lib/wrapper/resources/release_label.rb", "lib/wrapper/resources/generic_list.rb", "lib/wrapper/resources/search_result.rb", "lib/wrapper/resources/label.rb", "lib/wrapper/resources/image.rb", "lib/wrapper/resources/track.rb", "lib/wrapper/resources/release.rb", "lib/wrapper/resources/master_release.rb", "lib/wrapper/resources/video.rb", "lib/discogs.rb", "Rakefile", "README.markdown", "discogs.gemspec"]
13
+ s.files = ["lib/wrapper", "lib/wrapper/resource_mappings.rb", "lib/wrapper/wrapper.rb", "lib/wrapper/resource.rb", "lib/wrapper/resources", "lib/wrapper/resources/format.rb", "lib/wrapper/resources/search.rb", "lib/wrapper/resources/label_release.rb", "lib/wrapper/resources/artist.rb", "lib/wrapper/resources/release_artist.rb", "lib/wrapper/resources/artist_release.rb", "lib/wrapper/resources/release_label.rb", "lib/wrapper/resources/generic_list.rb", "lib/wrapper/resources/search_result.rb", "lib/wrapper/resources/label.rb", "lib/wrapper/resources/image.rb", "lib/wrapper/resources/track.rb", "lib/wrapper/resources/release.rb", "lib/wrapper/resources/master_release.rb", "lib/wrapper/resources/master_release_version.rb", "lib/wrapper/resources/video.rb", "lib/discogs.rb", "Rakefile", "README.markdown", "discogs.gemspec"]
14
14
 
15
- s.test_files = ["spec/wrapper_methods/get_release_spec.rb", "spec/wrapper_methods/get_master_release_spec.rb", "spec/wrapper_methods/search_spec.rb", "spec/wrapper_methods/get_artist_spec.rb", "spec/wrapper_methods/get_label_spec.rb", "spec/resource_spec.rb", "spec/resources/label_spec.rb", "spec/resources/generic_list_spec.rb", "spec/resources/artist_release_spec.rb", "spec/resources/artist_spec.rb", "spec/resources/release_artist_spec.rb", "spec/resources/search_spec.rb", "spec/resources/label_release_spec.rb", "spec/resources/release_label_spec.rb", "spec/resources/release_spec.rb", "spec/resources/master_release_spec.rb", "spec/resources/video_spec.rb", "spec/resources/search_result_spec.rb", "spec/resources/image_spec.rb", "spec/resources/track_spec.rb", "spec/resources/format_spec.rb", "spec/wrapper_spec.rb", "spec/spec_helper.rb"]
15
+ s.test_files = ["spec/wrapper_methods/get_release_spec.rb", "spec/wrapper_methods/get_master_release_spec.rb", "spec/wrapper_methods/search_spec.rb", "spec/wrapper_methods/get_artist_spec.rb", "spec/wrapper_methods/get_label_spec.rb", "spec/resource_spec.rb", "spec/resources/label_spec.rb", "spec/resources/generic_list_spec.rb", "spec/resources/artist_release_spec.rb", "spec/resources/artist_spec.rb", "spec/resources/release_artist_spec.rb", "spec/resources/search_spec.rb", "spec/resources/label_release_spec.rb", "spec/resources/release_label_spec.rb", "spec/resources/release_spec.rb", "spec/resources/master_release_spec.rb", "spec/resources/master_release_version_spec.rb", "spec/resources/video_spec.rb", "spec/resources/search_result_spec.rb", "spec/resources/image_spec.rb", "spec/resources/track_spec.rb", "spec/resources/format_spec.rb", "spec/wrapper_spec.rb", "spec/spec_helper.rb"]
16
16
 
17
17
  s.platform = Gem::Platform::RUBY
18
18
 
@@ -13,7 +13,7 @@ class Discogs::MasterRelease < Discogs::Resource
13
13
  :images,
14
14
  :videos,
15
15
  :tracklist,
16
- :artists
17
- #:versions,
18
- #:videos
16
+ :artists,
17
+ :versions
18
+
19
19
  end
@@ -0,0 +1,17 @@
1
+ # Represents an master release version in the Discogs API.
2
+
3
+ require File.dirname(__FILE__) + "/master_release"
4
+
5
+ class Discogs::MasterRelease::Version < Discogs::Resource
6
+
7
+ attr_accessor :id,
8
+ :status,
9
+ :title,
10
+ :format,
11
+ :label,
12
+ :catno,
13
+ :country,
14
+ :released,
15
+ :thumb
16
+
17
+ end
@@ -0,0 +1,55 @@
1
+ require File.dirname(__FILE__) + "/../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
@@ -40,6 +40,11 @@ describe Discogs::Wrapper do
40
40
  @master_release.genres[0].should == "Electronic"
41
41
  end
42
42
 
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)
46
+ end
47
+
43
48
  it "should have one or more images" do
44
49
  @master_release.images.should be_instance_of(Array)
45
50
  @master_release.images[0].should be_instance_of(Discogs::Image)
@@ -62,6 +67,15 @@ describe Discogs::Wrapper do
62
67
  end
63
68
  end
64
69
 
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
+
65
79
  it "should have a traversible list of styles" do
66
80
  @master_release.styles.should be_instance_of(Array)
67
81
  @master_release.styles[0].should == "Deep House"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discogs-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 1
10
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Buntine
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-10-23 00:00:00 +11:00
19
+ date: 2011-10-24 00:00:00 +11:00
20
20
  default_executable:
21
21
  dependencies: []
22
22
 
@@ -46,6 +46,7 @@ files:
46
46
  - lib/wrapper/resources/track.rb
47
47
  - lib/wrapper/resources/release.rb
48
48
  - lib/wrapper/resources/master_release.rb
49
+ - lib/wrapper/resources/master_release_version.rb
49
50
  - lib/wrapper/resources/video.rb
50
51
  - lib/discogs.rb
51
52
  - Rakefile
@@ -67,6 +68,7 @@ files:
67
68
  - spec/resources/release_label_spec.rb
68
69
  - spec/resources/release_spec.rb
69
70
  - spec/resources/master_release_spec.rb
71
+ - spec/resources/master_release_version_spec.rb
70
72
  - spec/resources/video_spec.rb
71
73
  - spec/resources/search_result_spec.rb
72
74
  - spec/resources/image_spec.rb
@@ -125,6 +127,7 @@ test_files:
125
127
  - spec/resources/release_label_spec.rb
126
128
  - spec/resources/release_spec.rb
127
129
  - spec/resources/master_release_spec.rb
130
+ - spec/resources/master_release_version_spec.rb
128
131
  - spec/resources/video_spec.rb
129
132
  - spec/resources/search_result_spec.rb
130
133
  - spec/resources/image_spec.rb