relaton-isbn 1.18.1 → 1.20.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: 878ec251b7038e780fe8e283b413dbbce5c98671eb68030dbb148e47755e2892
4
+ data.tar.gz: fbd91513eedc98d1ab3baef8024b3ee0ce8399e180140f43e9b3f787703d7fb9
5
5
  SHA512:
6
- metadata.gz: 83c0031a254e37b55f1c1f3a5a3003be0058f0a6355e93f7f3cb8b6566a0fd8e33bc1f5d25acaf9b642d936cb08e7e1f6256e18b272b42d4460b2c6351c57ae0
7
- data.tar.gz: f637880b51318e33f72553ea0e71f2cde606474844297f2590acebe9cc708add88dd94528db6797dcd06ae93d4de5bdae148f67db41dcb4cf885e0fbf04c3a87
6
+ metadata.gz: 71d254c3e69f318056ae64ca52af5daa4e157723757fc74f11ce8832272f141e2a56d5b15ce29edd94393d1f0dc49340440365ce533b1e773f4d1becb98e3a98
7
+ data.tar.gz: e7c6e7529f3886906c7d6a74f0a2a708237dda71a29583c64aee831105322a5fbfd6899a2e3dbf9613b6b71f4fe5c68e231d7dfa736e565b60f8d661e5057eca
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.20.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.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-29 00:00:00.000000000 Z
11
+ date: 2024-12-13 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.20.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.20.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
@@ -52,7 +51,7 @@ licenses:
52
51
  metadata:
53
52
  homepage_uri: https://github.com/relaton/relaton-isbn
54
53
  source_code_uri: https://github.com/relaton/relaton-isbn
55
- post_install_message:
54
+ post_install_message:
56
55
  rdoc_options: []
57
56
  require_paths:
58
57
  - lib
@@ -67,8 +66,8 @@ 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
71
- signing_key:
69
+ rubygems_version: 3.3.27
70
+ signing_key:
72
71
  specification_version: 4
73
72
  summary: 'RelatonIsbn: retrieve publications by ISBN for bibliographic use using the
74
73
  BibliographicItem model'
@@ -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