discogs-wrapper 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -75,4 +75,4 @@ USAGE
75
75
  LICENSE
76
76
  -----
77
77
 
78
- See the LICENCE file. Copyright (c) Andrew Buntine 2011
78
+ See the LICENCE file. Copyright (c) Andrew Buntine
data/Rakefile CHANGED
@@ -1,27 +1,26 @@
1
1
  require 'rake'
2
- require 'spec'
3
- require 'spec/rake/spectask'
4
- require 'rake/gempackagetask'
2
+ require 'rspec'
3
+ require 'rspec/core/rake_task'
4
+ require 'rubygems/package_task'
5
+
5
6
 
6
- task :default => :spec
7
7
 
8
8
  desc "Run all specs in spec directory"
9
- Spec::Rake::SpecTask.new(:spec) do |t|
10
- t.spec_opts = ["--colour", "--format progress", "--loadby mtime", "--reverse"]
11
- t.spec_files = FileList[ 'spec/**/*_spec.rb' ]
9
+ RSpec::Core::RakeTask.new(:spec) do |t|
10
+ t.rspec_opts = ["--colour"]
11
+ t.pattern = 'spec/**/*_spec.rb'
12
12
  end
13
13
 
14
- desc "Run all specs and generate RCov report"
15
- Spec::Rake::SpecTask.new('cov') do |t|
16
- t.spec_files = FileList['spec/**/*.rb']
17
- t.spec_opts = ["--colour"]
18
- t.rcov = true
19
- t.rcov_opts = ['-T --no-html --exclude', 'spec\/,gems\/']
14
+ desc "Run all specs and generate simplecov report"
15
+ task :cov do |t|
16
+ ENV['COVERAGE'] = 'true'
17
+ Rake::Task["spec"].execute
18
+ `open coverage/index.html`
20
19
  end
21
20
 
22
21
  spec = eval(File.read("discogs.gemspec"))
23
22
 
24
- Rake::GemPackageTask.new(spec) do |pkg|
23
+ Gem::PackageTask.new(spec) do |pkg|
25
24
  # pkg.need_zip = true
26
25
  # pkg.need_tar = true
27
26
  end
@@ -1,19 +1,22 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = "discogs-wrapper"
4
- s.version = "1.1.3"
5
- s.date = "2012-07-04"
4
+ s.version = "1.1.4"
5
+ s.date = "2013-08-13"
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"
9
- s.authors = ["Andrew Buntine"]
9
+ s.authors = ["Andrew Buntine", "Many more contributors"]
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/master_release_version.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/wrapper/resources/user.rb", "lib/discogs.rb", "Rakefile", "README.markdown", "discogs.gemspec"]
14
14
 
15
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
+
19
+ s.add_development_dependency "rspec", "= 2.12.0"
20
+ s.add_development_dependency "simplecov", "= 0.7.1"
18
21
 
19
22
  end
@@ -1,8 +1,8 @@
1
1
 
2
2
  ## Discogs::Wrapper
3
- ## by Andrew Buntine, 2009
3
+ ## Copyright Andrew Buntine
4
4
  ##
5
- ## This library provides full access to the Discogs.com API v1.0
5
+ ## This library provides full access to the Discogs.com API v2.0
6
6
  ##
7
7
  ## Please file all bug reports at http://www.github.com/buntine/discogs, or
8
8
  ## email me at info@andrewbuntine.com.
@@ -4,14 +4,17 @@ class Discogs::Artist < Discogs::Resource
4
4
 
5
5
  no_mapping
6
6
 
7
- attr_accessor :name,
7
+ attr_accessor :id,
8
+ :name,
8
9
  :realname,
9
10
  :images,
10
11
  :urls,
11
12
  :namevariations,
12
13
  :aliases,
13
14
  :members,
14
- :releases
15
+ :releases,
16
+ :profile,
17
+ :data_quality
15
18
 
16
19
  def main_releases
17
20
  filter_releases("Main")
@@ -19,6 +19,7 @@ class Discogs::Release < Discogs::Resource
19
19
  :formats,
20
20
  :styles,
21
21
  :genres,
22
- :tracklist
22
+ :tracklist,
23
+ :identifiers
23
24
 
24
25
  end
@@ -0,0 +1,11 @@
1
+ # Represents an user in the Discogs API.
2
+
3
+ class Discogs::User < Discogs::Resource
4
+
5
+ no_mapping
6
+
7
+ attr_accessor :username,
8
+ :uri,
9
+ :name
10
+
11
+ end
@@ -2,10 +2,10 @@
2
2
 
3
3
  class Discogs::Video < Discogs::Resource
4
4
 
5
- attr_accessor :uri,
6
- :duration,
5
+ attr_accessor :duration,
7
6
  :embed,
8
7
  :description,
9
- :title
8
+ :title,
9
+ :src
10
10
 
11
11
  end
@@ -34,6 +34,10 @@ class Discogs::Wrapper
34
34
  query_and_build "label/#{name}", Discogs::Label, {:releases => 1}
35
35
  end
36
36
 
37
+ def get_user(username)
38
+ query_and_build "users/#{username}", Discogs::User
39
+ end
40
+
37
41
  def search(term, options={})
38
42
  opts = { :type => :all, :page => 1 }.merge(options)
39
43
  params = { :q => term, :type => opts[:type], :page => opts[:page] }
@@ -68,7 +72,7 @@ class Discogs::Wrapper
68
72
  rescue Zlib::GzipFile::Error
69
73
  response_body = response.body
70
74
  end
71
-
75
+
72
76
  response_body
73
77
  end
74
78
 
@@ -90,7 +94,7 @@ class Discogs::Wrapper
90
94
  parameters = { :f => "xml" }.merge(params)
91
95
  querystring = "?" + parameters.map { |key, value| "#{key}=#{value}" }.sort.join("&")
92
96
 
93
- URI.parse(File.join(@@root_host, sanitize_path(path, querystring)))
97
+ URI.parse(File.join(@@root_host, URI.encode(sanitize_path(path, URI.escape(querystring)))))
94
98
  end
95
99
 
96
100
  def sanitize_path(*path_parts)
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Resource do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Artist::Release do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Artist do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Release::Format do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::GenericList do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Image do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Label::Release do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Label do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::MasterRelease do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::MasterRelease::Version do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Release::Artist do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Release::Label do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Release do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Search::Result do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Search do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Release::Track do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Video do
4
4
 
@@ -30,13 +30,13 @@ describe Discogs::Video do
30
30
  @video.description.should == "The Persuader-Stockholm-Sodermalm"
31
31
  end
32
32
 
33
- it "should have a uri attribute" do
34
- @video.uri.should == "http://www.youtube.com/watch?v=QVdDhOnoR8k"
35
- end
36
-
37
33
  it "should have a title attribute" do
38
34
  @video.title.should == "The Persuader"
39
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
40
 
41
41
  end
42
42
 
@@ -1,5 +1,9 @@
1
+ if ENV["COVERAGE"]
2
+ require 'simplecov'
3
+ SimpleCov.start
4
+ end
1
5
  require 'rubygems'
2
- require 'spec'
6
+ require 'rspec'
3
7
  require File.dirname(__FILE__) + '/../lib/discogs'
4
8
 
5
9
  def valid_release_xml
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Wrapper do
4
4
 
@@ -25,11 +25,23 @@ describe Discogs::Wrapper do
25
25
  it "should have a name attribute" do
26
26
  @artist.name.should == "Root"
27
27
  end
28
+
29
+ it "should have an id attribute" do
30
+ @artist.id.should == "123"
31
+ end
28
32
 
29
33
  it "should have a realname attribute" do
30
34
  @artist.realname.should == "Rootan"
31
35
  end
32
36
 
37
+ it "should have a profile attribute" do
38
+ @artist.profile.should == "Richard David James was born to Welsh parents"
39
+ end
40
+
41
+ it "should have a data_quality attribute" do
42
+ @artist.data_quality.should == "Needs Vote"
43
+ end
44
+
33
45
  it "should have one or more aliases" do
34
46
  @artist.aliases.should be_instance_of(Array)
35
47
  @artist.aliases[0].should == "Roooot"
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Wrapper do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Wrapper do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Wrapper do
4
4
 
@@ -87,7 +87,7 @@ describe Discogs::Wrapper do
87
87
  @release.videos.each_with_index do |video, index|
88
88
  video.duration.should == specs[index][0]
89
89
  video.embed.should == specs[index][1]
90
- video.uri.should == specs[index][2]
90
+ video.src.should == specs[index][2]
91
91
  end
92
92
  end
93
93
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Wrapper do
4
4
 
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + "/spec_helper"
1
+ require 'spec_helper'
2
2
 
3
3
  describe Discogs::Wrapper do
4
4
 
metadata CHANGED
@@ -1,33 +1,56 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: discogs-wrapper
3
- version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 1
9
- - 3
10
- version: 1.1.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.4
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Andrew Buntine
9
+ - Many more contributors
14
10
  autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
-
18
- date: 2012-07-04 00:00:00 +10:00
19
- default_executable:
20
- dependencies: []
21
-
22
- description: Discogs::Wrapper is a full wrapper for the http://www.discogs.com API V2
13
+ date: 2013-08-13 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - '='
21
+ - !ruby/object:Gem::Version
22
+ version: 2.12.0
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - '='
29
+ - !ruby/object:Gem::Version
30
+ version: 2.12.0
31
+ - !ruby/object:Gem::Dependency
32
+ name: simplecov
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - '='
37
+ - !ruby/object:Gem::Version
38
+ version: 0.7.1
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - '='
45
+ - !ruby/object:Gem::Version
46
+ version: 0.7.1
47
+ description: Discogs::Wrapper is a full wrapper for the http://www.discogs.com API
48
+ V2
23
49
  email: info@andrewbuntine.com
24
50
  executables: []
25
-
26
51
  extensions: []
27
-
28
52
  extra_rdoc_files: []
29
-
30
- files:
53
+ files:
31
54
  - lib/wrapper/resource_mappings.rb
32
55
  - lib/wrapper/wrapper.rb
33
56
  - lib/wrapper/resource.rb
@@ -47,6 +70,7 @@ files:
47
70
  - lib/wrapper/resources/master_release.rb
48
71
  - lib/wrapper/resources/master_release_version.rb
49
72
  - lib/wrapper/resources/video.rb
73
+ - ./lib/wrapper/resources/user.rb
50
74
  - lib/discogs.rb
51
75
  - Rakefile
52
76
  - README.markdown
@@ -75,41 +99,31 @@ files:
75
99
  - spec/resources/format_spec.rb
76
100
  - spec/wrapper_spec.rb
77
101
  - spec/spec_helper.rb
78
- has_rdoc: true
79
102
  homepage: http://www.github.com/buntine/discogs
80
103
  licenses: []
81
-
82
104
  post_install_message:
83
105
  rdoc_options: []
84
-
85
- require_paths:
106
+ require_paths:
86
107
  - lib
87
- required_ruby_version: !ruby/object:Gem::Requirement
108
+ required_ruby_version: !ruby/object:Gem::Requirement
88
109
  none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 3
93
- segments:
94
- - 0
95
- version: "0"
96
- required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
115
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
105
120
  requirements: []
106
-
107
121
  rubyforge_project:
108
- rubygems_version: 1.3.7
122
+ rubygems_version: 1.8.24
109
123
  signing_key:
110
124
  specification_version: 3
111
125
  summary: Discogs::Wrapper is a full wrapper for the http://www.discogs.com API V2
112
- test_files:
126
+ test_files:
113
127
  - spec/wrapper_methods/get_release_spec.rb
114
128
  - spec/wrapper_methods/get_master_release_spec.rb
115
129
  - spec/wrapper_methods/search_spec.rb