coverart 0.0.4 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c27208a52cad6e750a836f14369e2fc289f74b81
4
- data.tar.gz: 3dc1a9c30d07979258416c6ab03941d727ba4a51
2
+ SHA256:
3
+ metadata.gz: 7482832207a739151da57cf58a4aea094663db2f926c6eb3e02656d5ca323564
4
+ data.tar.gz: ac62f312553eb8513837665ad318b0daf9c45113205e91cf9868fac036169f3d
5
5
  SHA512:
6
- metadata.gz: ae64811fd4d7ab482de42357c3f2f277e4577ab8ebcb6d1fec95fd55cc355ced5cc22dfc221334b3d8be5b37a5087548bd6bf8442ed3006009ab994d4d4175b7
7
- data.tar.gz: 11f8a3045447a36c209482a66558b00e9d5d4c116fa43c09d0bcc9080a11b1335721b90f5feff58c1d8cc0f4f201a1e2930575a9c799f61a2658254d47d09e61
6
+ metadata.gz: 70560e663fd9f5955ee18d64fcd20a4b48ad3dd756e8126d407e0b2f0d26950159a62a9f3333f16b8c7637b862302dafe59d98d140be696c87a3c10874a31a38
7
+ data.tar.gz: 24ced50a671e4b86562d29d69419699bdc2430180c9a5a10489515547c4bf42f47421c09c33fb49f567788e157e5993f3db1ce949641deb2b56a58152fb9922d
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Savater Sebastien
1
+ Copyright (c) 2022 Savater Sebastien
2
2
 
3
3
  MIT License
4
4
 
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,67 +1,89 @@
1
- # Cover Art
1
+ # Coverart
2
2
 
3
3
  A tiny client for the [Cover Art Archive](http://coverartarchive.org) web service.
4
4
 
5
- It works great with the [Musicbrainz clien](https://github.com/inkstak/coverart).
5
+ It works great with the [Musicbrainz client](http://github.com/inkstak/musicbrainz).
6
6
 
7
- [![Build Status](https://travis-ci.org/inkstak/coverart.svg)](https://travis-ci.org/inkstak/coverart)
8
- [![Gem Version](https://badge.fury.io/rb/coverart.png)](http://badge.fury.io/rb/coverart)
7
+ [![Gem Version](https://badge.fury.io/rb/coverart.svg)](https://rubygems.org/gems/coverart)
8
+ [![CI Status](https://github.com/inkstak/coverart/actions/workflows/ci.yml/badge.svg)](https://github.com/inkstak/coverart/actions/workflows/ci.yml)
9
+ [![Maintainability](https://api.codeclimate.com/v1/badges/9bb8b75ea8c66b1a9c94/maintainability)](https://codeclimate.com/github/inkstak/coverart/maintainability)
9
10
 
10
- ### Ruby Version
11
-
12
- Ruby version 1.9.0+ required.
13
11
 
14
12
  ### Installation
15
13
 
16
- Is this really necessary to explain ?
17
-
18
- gem install coverart
19
-
14
+ ```bash
15
+ bundle add coverart
16
+ ```
20
17
 
21
18
  ### Usage
22
19
 
23
- Read the [JSON API manual](http://wiki.musicbrainz.org/Cover_Art_Archive/API)
20
+ You should first read the [JSON API manual](http://wiki.musicbrainz.org/Cover_Art_Archive/API) by Musicbrainz.
24
21
 
25
- require 'coverart'
26
- api = CoverArt::Client.new
27
- api.get '/release/76df3287-6cda-33eb-8e9a-044b5e15ffdd'
22
+ ```ruby
23
+ require "coverart"
28
24
 
25
+ client = Coverart::Client.new
26
+ client.get("/release/76df3287-6cda-33eb-8e9a-044b5e15ffdd")
27
+ ```
29
28
 
30
29
  You can also use shortcuts :
31
30
 
32
- # Get the front image URL
33
- api.front '76df3287-6cda-33eb-8e9a-044b5e15ffdd'
34
-
35
- # Get the back image URL
36
- api.back '99b09d02-9cc9-3fed-8431-f162165a9371'
31
+ ```ruby
32
+ # Get the front image URL
33
+ client.front("76df3287-6cda-33eb-8e9a-044b5e15ffdd")
37
34
 
38
- # Get the front image URL for a release group
39
- api.group '76df3287-6cda-33eb-8e9a-044b5e15ffdd'
35
+ # Get the back image URL
36
+ client.back("99b09d02-9cc9-3fed-8431-f162165a9371")
40
37
 
38
+ # Get the front image URL for a release group
39
+ client.group("76df3287-6cda-33eb-8e9a-044b5e15ffdd")
40
+ ```
41
41
 
42
42
  ### Caching & middlewares
43
43
 
44
44
  In order to perform caching, you can use [faraday_middleware](http://github.com/lostisland/faraday_middleware)
45
45
  or your own middlewares:
46
46
 
47
- # Please note that faraday_middleware and active_support are not included as dependencies
48
- # you may install them
47
+ ```ruby
48
+ # FYI: faraday_middleware and active_support are not present in dependencies.
49
+ # Add them to your bundle.
49
50
 
50
- require 'coverart'
51
- require 'faraday_middleware'
52
- require 'active_support'
53
-
54
- api = CoverArt::Client.new do |f|
55
- f.response :caching do
56
- ActiveSupport::Cache.lookup_store :file_store, './tmp/cache', namespace: 'covertart', expires_in: 3600
57
- end
58
- end
51
+ require "coverart"
52
+ require "faraday_middleware"
53
+ require "active_support"
59
54
 
55
+ client = Coverart::Client.new do |connection|
56
+ connection.response :caching do
57
+ ActiveSupport::Cache.lookup_store(:file_store, "./tmp/cache", namespace: "covertart", expires_in: 3600)
58
+ end
59
+ end
60
+ ```
60
61
 
61
62
  ## Contributing
62
63
 
63
- 1. Fork it
64
- 2. Create your feature branch (`git checkout -b my-new-feature`)
65
- 3. Commit your changes (`git commit -am 'Added some feature'`)
66
- 4. Push to the branch (`git push origin my-new-feature`)
67
- 5. Create new Pull Request
64
+ 1. Don't hesitate to submit your feature/idea/fix in [issues](https://github.com/inkstak/coverart)
65
+ 2. Fork the [repository](https://github.com/inkstak/coverart)
66
+ 3. Create your feature branch
67
+ 4. Ensure RSpec & Rubocop are passing
68
+ 4. Create a pull request
69
+
70
+ ### Tests & lint
71
+
72
+ ```bash
73
+ bundle exec rspec
74
+ bundle exec rubocop
75
+ ```
76
+
77
+ Both can be run with:
78
+
79
+ ```bash
80
+ bundle exec rake
81
+ ```
82
+
83
+ Rubocop uses [Standard](https://github.com/testdouble/standard) cops
84
+
85
+ ## License & credits
86
+
87
+ Please see [LICENSE](https://github.com/inkstak/coverart/blob/main/LICENSE) for further details.
88
+
89
+ Contributors: [./graphs/contributors](https://github.com/inkstak/coverart/graphs/contributors)
@@ -1,43 +1,48 @@
1
- module CoverArt
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "json"
5
+
6
+ module Coverart
2
7
  class Client
3
- ENDPOINT = 'http://coverartarchive.org'
8
+ ENDPOINT = "http://coverartarchive.org"
4
9
 
5
10
  attr_reader :http
6
11
 
7
- def initialize &block
8
- @http ||= Faraday.new url: ENDPOINT do |f|
9
- yield f if block_given?
10
- f.adapter Faraday.default_adapter
12
+ def initialize(&block)
13
+ @http ||= Faraday.new(url: ENDPOINT) do |connection|
14
+ connection.adapter Faraday.default_adapter
15
+ yield connection if block
11
16
  end
12
17
  end
13
18
 
14
- def get url
15
- response = http.get url
19
+ def get(url)
20
+ response = http.get(url)
16
21
 
17
22
  case response.status
18
- when 404 then nil
19
- when 200 then JSON.parse response.body
23
+ when 404 then nil
24
+ when 200 then JSON.parse response.body
20
25
  when 300..310
21
- if response.headers[:location].match /\.(jpg|jpeg|png|gif)/
26
+ if response.headers[:location].match?(/\.(jpg|jpeg|png|gif)/)
22
27
  response.headers[:location]
23
28
  else
24
29
  get response.headers[:location]
25
30
  end
26
31
  else
27
- raise "Unexpected response (#{ response.status }) at #{ url }"
32
+ raise "Unexpected response (#{response.status}) at #{url}"
28
33
  end
29
34
  end
30
35
 
31
36
  def front mbid
32
- get "/release/#{ mbid }/front"
37
+ get("/release/#{mbid}/front")
33
38
  end
34
39
 
35
40
  def back mbid
36
- get "/release/#{ mbid }/back"
41
+ get("/release/#{mbid}/back")
37
42
  end
38
43
 
39
44
  def group mbid
40
- get "/release-group/#{ mbid }/front"
45
+ get("/release-group/#{mbid}/front")
41
46
  end
42
47
  end
43
48
  end
@@ -1,3 +1,5 @@
1
- module CoverArt
2
- VERSION = '0.0.4'
1
+ # frozen_string_literal: true
2
+
3
+ module Coverart
4
+ VERSION = "1.0.1"
3
5
  end
data/lib/coverart.rb CHANGED
@@ -1,3 +1,9 @@
1
- require 'faraday'
2
- require 'json'
3
- require 'coverart/client'
1
+ # frozen_string_literal: true
2
+
3
+ require "zeitwerk"
4
+ Zeitwerk::Loader.for_gem.setup
5
+
6
+ module Coverart
7
+ end
8
+
9
+ CoverArt = Coverart
metadata CHANGED
@@ -1,39 +1,191 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coverart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Savater Sebastien
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-16 00:00:00.000000000 Z
11
+ date: 2022-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - ">="
18
32
  - !ruby/object:Gem::Version
19
33
  version: '0'
20
- type: :runtime
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: gem-release
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-performance
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: standard
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: webmock
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: zeitwerk
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
21
175
  prerelease: false
22
176
  version_requirements: !ruby/object:Gem::Requirement
23
177
  requirements:
24
178
  - - ">="
25
179
  - !ruby/object:Gem::Version
26
180
  version: '0'
27
- description:
28
- email: savater.sebastien@gmail.com
181
+ description:
182
+ email: github.60k5k@simplelogin.co
29
183
  executables: []
30
184
  extensions: []
31
185
  extra_rdoc_files: []
32
186
  files:
33
- - Gemfile
34
187
  - LICENSE
35
188
  - README.md
36
- - coverart.gemspec
37
189
  - lib/coverart.rb
38
190
  - lib/coverart/client.rb
39
191
  - lib/coverart/version.rb
@@ -41,7 +193,7 @@ homepage: http://github.com/inkstak/coverart
41
193
  licenses:
42
194
  - MIT
43
195
  metadata: {}
44
- post_install_message:
196
+ post_install_message:
45
197
  rdoc_options: []
46
198
  require_paths:
47
199
  - lib
@@ -56,9 +208,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
208
  - !ruby/object:Gem::Version
57
209
  version: '0'
58
210
  requirements: []
59
- rubyforge_project:
60
- rubygems_version: 2.2.2
61
- signing_key:
211
+ rubygems_version: 3.3.7
212
+ signing_key:
62
213
  specification_version: 4
63
214
  summary: A tiny client for the Cover Art Archive web service
64
215
  test_files: []
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
3
-
4
- gem 'rspec'
5
- gem 'webmock'
data/coverart.gemspec DELETED
@@ -1,18 +0,0 @@
1
- require File.expand_path('../lib/coverart/version', __FILE__)
2
-
3
- Gem::Specification.new do |s|
4
- s.name = 'coverart'
5
- s.version = CoverArt::VERSION
6
-
7
- s.authors = ['Savater Sebastien']
8
- s.email = 'savater.sebastien@gmail.com'
9
-
10
- s.homepage = 'http://github.com/inkstak/coverart'
11
- s.summary = 'A tiny client for the Cover Art Archive web service'
12
- s.license = 'MIT'
13
-
14
- s.files = %w(Gemfile LICENSE README.md coverart.gemspec)
15
- s.files += Dir.glob('lib/**/*')
16
-
17
- s.add_dependency 'faraday'
18
- end