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.
- data/README.markdown +1 -1
- data/Rakefile +13 -14
- data/discogs.gemspec +7 -4
- data/lib/discogs.rb +2 -2
- data/lib/wrapper/resources/artist.rb +5 -2
- data/lib/wrapper/resources/release.rb +2 -1
- data/lib/wrapper/resources/user.rb +11 -0
- data/lib/wrapper/resources/video.rb +3 -3
- data/lib/wrapper/wrapper.rb +6 -2
- data/spec/resource_spec.rb +1 -1
- data/spec/resources/artist_release_spec.rb +1 -1
- data/spec/resources/artist_spec.rb +1 -1
- data/spec/resources/format_spec.rb +1 -1
- data/spec/resources/generic_list_spec.rb +1 -1
- data/spec/resources/image_spec.rb +1 -1
- data/spec/resources/label_release_spec.rb +1 -1
- data/spec/resources/label_spec.rb +1 -1
- data/spec/resources/master_release_spec.rb +1 -1
- data/spec/resources/master_release_version_spec.rb +1 -1
- data/spec/resources/release_artist_spec.rb +1 -1
- data/spec/resources/release_label_spec.rb +1 -1
- data/spec/resources/release_spec.rb +1 -1
- data/spec/resources/search_result_spec.rb +1 -1
- data/spec/resources/search_spec.rb +1 -1
- data/spec/resources/track_spec.rb +1 -1
- data/spec/resources/video_spec.rb +5 -5
- data/spec/spec_helper.rb +5 -1
- data/spec/wrapper_methods/get_artist_spec.rb +13 -1
- data/spec/wrapper_methods/get_label_spec.rb +1 -1
- data/spec/wrapper_methods/get_master_release_spec.rb +1 -1
- data/spec/wrapper_methods/get_release_spec.rb +2 -2
- data/spec/wrapper_methods/search_spec.rb +1 -1
- data/spec/wrapper_spec.rb +1 -1
- metadata +57 -43
data/README.markdown
CHANGED
data/Rakefile
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
require 'rake'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
require '
|
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
|
-
|
10
|
-
t.
|
11
|
-
t.
|
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
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
23
|
+
Gem::PackageTask.new(spec) do |pkg|
|
25
24
|
# pkg.need_zip = true
|
26
25
|
# pkg.need_tar = true
|
27
26
|
end
|
data/discogs.gemspec
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = "discogs-wrapper"
|
4
|
-
s.version = "1.1.
|
5
|
-
s.date = "
|
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
|
data/lib/discogs.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
## Discogs::Wrapper
|
3
|
-
##
|
3
|
+
## Copyright Andrew Buntine
|
4
4
|
##
|
5
|
-
## This library provides full access to the Discogs.com API
|
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 :
|
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")
|
data/lib/wrapper/wrapper.rb
CHANGED
@@ -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)
|
data/spec/resource_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
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
|
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.
|
90
|
+
video.src.should == specs[index][2]
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
data/spec/wrapper_spec.rb
CHANGED
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
|
-
|
5
|
-
prerelease:
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
93
|
-
|
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
|
-
|
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.
|
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
|