relaton-isbn 1.18.1 → 1.19.0

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
2
  SHA256:
3
- metadata.gz: ec7bde42f98693e22129a90cd430b87eff8200d2efdf507d1f65c0c250b1b459
4
- data.tar.gz: 4f6c8ea2d557fa5cead11673a685533338779032b8e85743e5ea54890a73370e
3
+ metadata.gz: 06f70a5b69dd360292a5692cd5ea5f1228c9261bdc73fe2cb9e385f1d7683173
4
+ data.tar.gz: 729a5c5eb601e1ed36f93bf27e3dfce38f0cfcce2819f3a66838ffe6a3cc0ba3
5
5
  SHA512:
6
- metadata.gz: 83c0031a254e37b55f1c1f3a5a3003be0058f0a6355e93f7f3cb8b6566a0fd8e33bc1f5d25acaf9b642d936cb08e7e1f6256e18b272b42d4460b2c6351c57ae0
7
- data.tar.gz: f637880b51318e33f72553ea0e71f2cde606474844297f2590acebe9cc708add88dd94528db6797dcd06ae93d4de5bdae148f67db41dcb4cf885e0fbf04c3a87
6
+ metadata.gz: 164de6cc7b1e1a2b5dedf3feeddb5cf92384206cfde6052fa20fd4d1798962fd3d8d9712062cea6f6b336fdec1568aa84f4d8887a0b085bfee7eb40b9e756734
7
+ data.tar.gz: b0ed039de5c4c242c2294adbe332389816d4776f9517ef6a274fd3ba69adeacf36868d548d1032ff8ba0624eda3b7782c4abba66c0e561eeee5deaf89dc7a4c7
data/README.adoc CHANGED
@@ -39,26 +39,15 @@ $ gem install relaton-isbn
39
39
 
40
40
  == Usage
41
41
 
42
- === Configuration
42
+ === Retrieving bibliographic items using OpenLibrary API
43
43
 
44
- Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonIsbn.configure` block.
44
+ To retrieve bibliographic items, use `RelatonIsbn::OpenLibrary.get` method with ISBN-10 or ISBN-13 as an argument. Allowed prefixes are `ISBN`, `isbn:`. Prefix and hyphens are optional. The method returns `RelatonBib::BibliographicItem` object.
45
45
 
46
46
  [source,ruby]
47
47
  ----
48
48
  require 'relaton_isbn'
49
49
  => true
50
50
 
51
- RelatonIsbn.configure do |config|
52
- config.logger.level = Logger::DEBUG
53
- end
54
- ----
55
-
56
- === Retrieving bibliographic items using OpenLibrary API
57
-
58
- To retrieve bibliographic items, use `RelatonIsbn::OpenLibrary.get` method with ISBN-10 or ISBN-13 as an argument. Allowed prefixes are `ISBN`, `isbn:`. Prefix and hyphens are optional. The method returns `RelatonBib::BibliographicItem` object.
59
-
60
- [source,ruby]
61
- ----
62
51
  # get document by ISBN-13
63
52
  > ibitem = RelatonIsbn::OpenLibrary.get "ISBN 978-0-12-064481-0"
64
53
  [relaton-isbn] (ISBN 9780120644810) Fetching from OpenLibrary ...
@@ -129,6 +118,10 @@ To retrieve bibliographic items, use `RelatonIsbn::OpenLibrary.get` method with
129
118
  "place"=>[{"city"=>"Boston"}, {"city"=>"London"}]}
130
119
  ----
131
120
 
121
+ === Logging
122
+
123
+ RelatonIsbn uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.
124
+
132
125
  == Development
133
126
 
134
127
  After checking out the repo, run `bin/setup` to install dependencies. Then, run
@@ -8,22 +8,22 @@ module RelatonIsbn
8
8
  ENDPOINT = "http://openlibrary.org/api/volumes/brief/isbn/".freeze
9
9
 
10
10
  def get(ref, _date = nil, _opts = {}) # rubocop:disable Metrics/MethodLength
11
- Util.warn "(#{ref}) Fetching from OpenLibrary ..."
11
+ Util.info "Fetching from OpenLibrary ...", key: ref
12
12
 
13
13
  isbn = Isbn.new(ref).parse
14
14
  unless isbn
15
- Util.warn "(#{ref}) Incorrect ISBN."
15
+ Util.info "Incorrect ISBN.", key: ref
16
16
  return
17
17
  end
18
18
 
19
19
  resp = request_api isbn
20
20
  unless resp
21
- Util.warn "(#{ref}) Not found."
21
+ Util.info "Not found.", key: ref
22
22
  return
23
23
  end
24
24
 
25
25
  bib = Parser.parse resp
26
- Util.warn "(#{ref}) Found: `#{bib.docidentifier.first.id}`"
26
+ Util.info "Found: `#{bib.docidentifier.first.id}`", key: ref
27
27
  bib
28
28
  end
29
29
 
@@ -1,9 +1,6 @@
1
1
  module RelatonIsbn
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonIsbn.configuration.logger
7
- end
4
+ PROGNAME = "relaton-isbn".freeze
8
5
  end
9
6
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIsbn
2
- VERSION = "1.18.1".freeze
2
+ VERSION = "1.19.0".freeze
3
3
  end
data/lib/relaton_isbn.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require "net/http"
2
2
  require "relaton_bib"
3
3
  require_relative "relaton_isbn/version"
4
- require_relative "relaton_isbn/config"
5
4
  require_relative "relaton_isbn/util"
6
5
  require_relative "relaton_isbn/isbn"
7
6
  require_relative "relaton_isbn/parser"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-isbn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.1
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-29 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: relaton-bib
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.18.0
19
+ version: 1.19.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.18.0
26
+ version: 1.19.0
27
27
  description: 'RelatonIsbn: retrieve publications by ISBN for bibliographic use using
28
28
  the BibliographicItem model'
29
29
  email:
@@ -38,7 +38,6 @@ files:
38
38
  - README.adoc
39
39
  - Rakefile
40
40
  - lib/relaton_isbn.rb
41
- - lib/relaton_isbn/config.rb
42
41
  - lib/relaton_isbn/isbn.rb
43
42
  - lib/relaton_isbn/open_library.rb
44
43
  - lib/relaton_isbn/parser.rb
@@ -67,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
66
  - !ruby/object:Gem::Version
68
67
  version: '0'
69
68
  requirements: []
70
- rubygems_version: 3.3.26
69
+ rubygems_version: 3.3.27
71
70
  signing_key:
72
71
  specification_version: 4
73
72
  summary: 'RelatonIsbn: retrieve publications by ISBN for bibliographic use using the
@@ -1,10 +0,0 @@
1
- module RelatonIsbn
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-isbn".freeze
9
- end
10
- end