relaton-doi 1.18.2 → 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: 3b48dd4b37b780ce903cf5a8f55ac14d0af28b3d8b02fe62119bccddfe4526b3
4
- data.tar.gz: 9ff9d9787377ac3707aaf15979215775cc2c8f09e5add367f086faac1ab45f8b
3
+ metadata.gz: 5e538770eb9a82088798f558cda642323ee84380d9ecd56e5ce37efc02f7202f
4
+ data.tar.gz: ec5587181416122694e351a5183112be91d342fd59c2c00eb50075cece268efb
5
5
  SHA512:
6
- metadata.gz: 130af41cc36abc26376728b40fa798e10ef907c03e3a4fc9a2c2b156436071419e2cbf58d569f867b03900e1301c2dd05431e1a036c91c8dc595c71968aed78d
7
- data.tar.gz: 56227622d4d4d2d6644b2feabdd5454d7b039db9ca8b8c9bfe56db02fbbf8279815fa20f40c747e15d3528b67dcb696310870fff657d729a3924413405d1433c
6
+ metadata.gz: bc7c3a8df13e5ebabd5a05104365a9c0aeb06d1cd5e811ef45947faddfe4eb68212d534bd90ee263cf2adb4acc947fa2545328984f0504cbdc56cfd4b9e4a5d6
7
+ data.tar.gz: 82eb7f142beb2fed9e58fb04e3137a7be43cd62e5ec5afb3b3f02590187a1742d52fbb5369b244817b51bdc5f69120029c1bd87a7c23b24b40f26b57fa211a5c
data/README.adoc CHANGED
@@ -41,20 +41,6 @@ $ gem install relaton-doi
41
41
 
42
42
  == Usage
43
43
 
44
- === Configuration
45
-
46
- 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 `RelatonDoi.configure` block.
47
-
48
- [source,ruby]
49
- ----
50
- require 'relaton_doi'
51
- => true
52
-
53
- RelatonDoi.configure do |config|
54
- config.logger.level = Logger::DEBUG
55
- end
56
- ----
57
-
58
44
  === Retrieving items of known type using DOI
59
45
 
60
46
  If the resulting bibliographic item returned from CrossRef is a known Relaton
@@ -110,6 +96,9 @@ RelatonDoi::Crossref.get "doi:10.1109/ACCESS.2017.2739804"
110
96
  ...
111
97
  ----
112
98
 
99
+ === Logging
100
+
101
+ RelatonDoi 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.
113
102
 
114
103
  == Development
115
104
 
@@ -18,14 +18,14 @@ module RelatonDoi
18
18
  # RelatonNist::NistBibliographicItem] The bibitem.
19
19
  #
20
20
  def get(doi)
21
- Util.warn "(#{doi}) Fetching from search.crossref.org ..."
21
+ Util.info "Fetching from search.crossref.org ...", key: doi
22
22
  id = doi.sub(%r{^doi:}, "")
23
23
  message = get_by_id id
24
24
  if message
25
- Util.warn "(#{doi}) Found: `#{message['DOI']}`"
25
+ Util.info "Found: `#{message['DOI']}`", key: doi
26
26
  Parser.parse message
27
27
  else
28
- Util.warn("(#{doi}) Not found.")
28
+ Util.info "Not found.", key: doi
29
29
  nil
30
30
  end
31
31
  end
@@ -37,7 +37,7 @@ module RelatonDoi
37
37
  #
38
38
  # @return [Hash] The document.
39
39
  #
40
- def get_by_id(id)
40
+ def get_by_id(id) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
41
41
  # resp = Serrano.works ids: id
42
42
  n = 0
43
43
  url = "https://api.crossref.org/works/#{CGI.escape(id)}"
@@ -53,6 +53,7 @@ module RelatonDoi
53
53
  if n > 1
54
54
  raise RelatonBib::RequestError, "Crossref error: #{resp.body}"
55
55
  end
56
+
56
57
  n += 1
57
58
  sleep resp.headers["x-rate-limit-interval"].to_i * n
58
59
  end
@@ -1,9 +1,6 @@
1
1
  module RelatonDoi
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonDoi.configuration.logger
7
- end
4
+ PROGNAME = "relaton-doi".freeze
8
5
  end
9
6
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonDoi
4
- VERSION = "1.18.2"
4
+ VERSION = "1.19.0"
5
5
  end
data/lib/relaton_doi.rb CHANGED
@@ -8,7 +8,6 @@ require "relaton_ietf"
8
8
  require "relaton_ieee"
9
9
  require "relaton_nist"
10
10
  require_relative "relaton_doi/version"
11
- require_relative "relaton_doi/config"
12
11
  require_relative "relaton_doi/util"
13
12
  require_relative "relaton_doi/parser"
14
13
  require_relative "relaton_doi/crossref"
data/relaton-doi.gemspec CHANGED
@@ -34,11 +34,11 @@ Gem::Specification.new do |spec|
34
34
  # Uncomment to register a new dependency of your gem
35
35
  # spec.add_dependency "example-gem", "~> 1.0"
36
36
 
37
- spec.add_dependency "relaton-bib", "~> 1.18.0"
38
- spec.add_dependency "relaton-bipm", "~> 1.18.0"
39
- spec.add_dependency "relaton-ieee", "~> 1.18.0"
40
- spec.add_dependency "relaton-ietf", "~> 1.18.0"
41
- spec.add_dependency "relaton-nist", "~> 1.18.0"
37
+ spec.add_dependency "relaton-bib", "~> 1.19.0"
38
+ spec.add_dependency "relaton-bipm", "~> 1.19.0"
39
+ spec.add_dependency "relaton-ieee", "~> 1.19.0"
40
+ spec.add_dependency "relaton-ietf", "~> 1.19.0"
41
+ spec.add_dependency "relaton-nist", "~> 1.19.0"
42
42
  # spec.add_dependency "relaton-w3c", "~> 1.10.0"
43
43
  spec.add_dependency "faraday", "~> 2.7"
44
44
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-doi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.2
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-06-03 00:00:00.000000000 Z
11
+ date: 2024-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: relaton-bib
@@ -16,70 +16,70 @@ 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
  - !ruby/object:Gem::Dependency
28
28
  name: relaton-bipm
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.18.0
33
+ version: 1.19.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.18.0
40
+ version: 1.19.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: relaton-ieee
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.18.0
47
+ version: 1.19.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.18.0
54
+ version: 1.19.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: relaton-ietf
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.18.0
61
+ version: 1.19.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.18.0
68
+ version: 1.19.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: relaton-nist
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.18.0
75
+ version: 1.19.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.18.0
82
+ version: 1.19.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: faraday
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -115,7 +115,6 @@ files:
115
115
  - bin/rspec
116
116
  - bin/setup
117
117
  - lib/relaton_doi.rb
118
- - lib/relaton_doi/config.rb
119
118
  - lib/relaton_doi/crossref.rb
120
119
  - lib/relaton_doi/parser.rb
121
120
  - lib/relaton_doi/processor.rb
@@ -1,10 +0,0 @@
1
- module RelatonDoi
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-doi".freeze
9
- end
10
- end