relaton-doi 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: f6165c455d9e93d58c276f6822b9f37d3c47b19a43daae5cbe9f4b13dafeb70e
4
- data.tar.gz: fbe2077d29570724250addffd80a07d53073303eb55066e007caa2943e0932c7
3
+ metadata.gz: 5e538770eb9a82088798f558cda642323ee84380d9ecd56e5ce37efc02f7202f
4
+ data.tar.gz: ec5587181416122694e351a5183112be91d342fd59c2c00eb50075cece268efb
5
5
  SHA512:
6
- metadata.gz: 12d38b33fa066cf92cbecf2a0f4398aa264d941a0e6f09b8099c390e4eb31108ddec4862a395f60a031a3994090f7676ed54705a90d6e7f78ec4b2202f1f632c
7
- data.tar.gz: d2174bd65dfc7e96e1e1a4c0ec08387a32dd82d3432d8ebb9d792b2d964d21b46468c325f7402345ec702fdd66d1fd430c3309f064781b692f84caa531bc88fc
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
 
@@ -1,3 +1,5 @@
1
+ require "faraday"
2
+
1
3
  module RelatonDoi
2
4
  module Crossref
3
5
  extend self
@@ -16,14 +18,14 @@ module RelatonDoi
16
18
  # RelatonNist::NistBibliographicItem] The bibitem.
17
19
  #
18
20
  def get(doi)
19
- Util.warn "(#{doi}) Fetching from search.crossref.org ..."
21
+ Util.info "Fetching from search.crossref.org ...", key: doi
20
22
  id = doi.sub(%r{^doi:}, "")
21
23
  message = get_by_id id
22
24
  if message
23
- Util.warn "(#{doi}) Found: `#{message['DOI']}`"
25
+ Util.info "Found: `#{message['DOI']}`", key: doi
24
26
  Parser.parse message
25
27
  else
26
- Util.warn("(#{doi}) Not found.")
28
+ Util.info "Not found.", key: doi
27
29
  nil
28
30
  end
29
31
  end
@@ -35,10 +37,10 @@ module RelatonDoi
35
37
  #
36
38
  # @return [Hash] The document.
37
39
  #
38
- def get_by_id(id)
40
+ def get_by_id(id) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
39
41
  # resp = Serrano.works ids: id
40
42
  n = 0
41
- url = "https://api.crossref.org/works/#{ERB::Util.url_encode(id)}"
43
+ url = "https://api.crossref.org/works/#{CGI.escape(id)}"
42
44
  loop do
43
45
  resp = Faraday.get url, nil, HEADER
44
46
  case resp.status
@@ -51,6 +53,7 @@ module RelatonDoi
51
53
  if n > 1
52
54
  raise RelatonBib::RequestError, "Crossref error: #{resp.body}"
53
55
  end
56
+
54
57
  n += 1
55
58
  sleep resp.headers["x-rate-limit-interval"].to_i * n
56
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.1"
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,13 +34,13 @@ 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
- # spec.add_dependency "serrano", "~> 1.4.0"
43
+ spec.add_dependency "faraday", "~> 2.7"
44
44
 
45
45
  # For more information and examples about making a new gem, checkout our
46
46
  # guide at: https://bundler.io/guides/creating_gem.html
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.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-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,84 @@ 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
+ - !ruby/object:Gem::Dependency
84
+ name: faraday
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.7'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.7'
83
97
  description: 'RelatonDOI: retrieve Standards for bibliographic using DOI through Crossrefand
84
98
  provide Relaton object.'
85
99
  email:
@@ -101,7 +115,6 @@ files:
101
115
  - bin/rspec
102
116
  - bin/setup
103
117
  - lib/relaton_doi.rb
104
- - lib/relaton_doi/config.rb
105
118
  - lib/relaton_doi/crossref.rb
106
119
  - lib/relaton_doi/parser.rb
107
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