relaton-doi 1.14.3 → 1.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -0
- data/.github/workflows/release.yml +5 -3
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/Gemfile +7 -4
- data/lib/relaton_doi/parser.rb +13 -43
- data/lib/relaton_doi/version.rb +1 -1
- data/relaton-doi.gemspec +10 -17
- metadata +16 -100
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36fbec3dfe6ed0635449ed79967ab8f78e8ea10569de97b144926de8ea64b330
|
4
|
+
data.tar.gz: 766e94778c9a4a5d4a5a949d3329409604a1d4fe87079f31c1ce71280049c33c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7921e6e71d1526bc2d26240616200ad832a0e228772336764a0ac9484de5427382141c89dc8718a30f12819696304746dc5ddfe060719a034a73fcf0d4f6c6a6
|
7
|
+
data.tar.gz: fdb1f361f3b6cd14bb07401fc3594de0222c4d1d76fcac1f216198075b4827d35d317af30d7f3d372896a163b8fb32335d96ec90931b1eb6cd4cd85c970d4206
|
data/.github/workflows/rake.yml
CHANGED
@@ -7,11 +7,13 @@ on:
|
|
7
7
|
inputs:
|
8
8
|
next_version:
|
9
9
|
description: |
|
10
|
-
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
10
|
+
Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
|
11
|
+
Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
|
11
12
|
required: true
|
12
13
|
default: 'skip'
|
13
|
-
|
14
|
-
|
14
|
+
repository_dispatch:
|
15
|
+
types: [ do-release ]
|
16
|
+
|
15
17
|
|
16
18
|
jobs:
|
17
19
|
release:
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
@@ -5,10 +5,13 @@ source "https://rubygems.org"
|
|
5
5
|
# Specify your gem's dependencies in relaton-doi.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
+
gem "debug"
|
9
|
+
gem "equivalent-xml", "~> 0.6"
|
8
10
|
gem "rake", "~> 13.0"
|
9
|
-
|
10
11
|
gem "rspec", "~> 3.0"
|
11
|
-
|
12
12
|
gem "rubocop", "~> 1.7"
|
13
|
-
|
14
|
-
gem "
|
13
|
+
gem "rubocop-performance"
|
14
|
+
gem "rubocop-rails"
|
15
|
+
gem "simplecov"
|
16
|
+
gem "vcr"
|
17
|
+
gem "webmock"
|
data/lib/relaton_doi/parser.rb
CHANGED
@@ -376,10 +376,7 @@ module RelatonDoi
|
|
376
376
|
has_editors = contribs.any? { |c| c.role&.any? { |r| r.type == "editor" } }
|
377
377
|
return [] if has_authors && has_editors
|
378
378
|
|
379
|
-
|
380
|
-
authors = create_authors_editors(has_authors, "author", item)
|
381
|
-
editors = create_authors_editors(has_editors, "editor", item)
|
382
|
-
authors + editors
|
379
|
+
create_authors_editors(has_authors, "author")
|
383
380
|
end
|
384
381
|
|
385
382
|
#
|
@@ -387,12 +384,14 @@ module RelatonDoi
|
|
387
384
|
#
|
388
385
|
# @return [Hash, nil] parent item
|
389
386
|
#
|
390
|
-
def
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
387
|
+
def parent_item # rubocop:disable Metrics/AbcSize
|
388
|
+
@parent_item ||= begin
|
389
|
+
query = [@src["container-title"][0], fetch_year].compact.join "+"
|
390
|
+
filter = "type:#{%w[book book-set edited-book monograph reference-book].join ',type:'}"
|
391
|
+
resp = Faraday.get "https://api.crossref.org/works?query=#{query}&filter=#{filter}"
|
392
|
+
json = JSON.parse resp.body
|
393
|
+
json["message"]["items"].detect { |i| i["title"].include? @src["container-title"][0] }
|
394
|
+
end
|
396
395
|
end
|
397
396
|
|
398
397
|
#
|
@@ -400,14 +399,13 @@ module RelatonDoi
|
|
400
399
|
#
|
401
400
|
# @param [Boolean] has true if authors or editors are present in the book part
|
402
401
|
# @param [String] type "author" or "editor"
|
403
|
-
# @param [Hash, nil] item parent item
|
404
402
|
#
|
405
403
|
# @return [Array<RelatonBib::ContributionInfo>] authors or editors
|
406
404
|
#
|
407
|
-
def create_authors_editors(has, type
|
408
|
-
return [] if has || !
|
405
|
+
def create_authors_editors(has, type)
|
406
|
+
return [] if has || !parent_item
|
409
407
|
|
410
|
-
RelatonBib.array(
|
408
|
+
RelatonBib.array(parent_item[type]).map { |a| contributor(create_person(a), type) }
|
411
409
|
end
|
412
410
|
|
413
411
|
#
|
@@ -705,40 +703,12 @@ module RelatonDoi
|
|
705
703
|
return [] unless @src["container-title"] && types.include?(@src["type"])
|
706
704
|
|
707
705
|
@src["container-title"].map do |ct|
|
708
|
-
contrib =
|
706
|
+
contrib = create_authors_editors false, "editor"
|
709
707
|
bib = RelatonBib::BibliographicItem.new(title: [content: ct], contributor: contrib)
|
710
708
|
RelatonBib::DocumentRelation.new(type: "includedIn", bibitem: bib)
|
711
709
|
end
|
712
710
|
end
|
713
711
|
|
714
|
-
#
|
715
|
-
# Fetch included in editors.
|
716
|
-
#
|
717
|
-
# @param [String] title container-title
|
718
|
-
#
|
719
|
-
# @return [Array<RelatonBib::ContributionInfo>] The editors contribution info.
|
720
|
-
#
|
721
|
-
def included_in_editors(title)
|
722
|
-
item = fetch_included_in title
|
723
|
-
return [] unless item
|
724
|
-
|
725
|
-
item["editor"].map { |e| contributor(create_person(e), "editor") }
|
726
|
-
end
|
727
|
-
|
728
|
-
#
|
729
|
-
# Fetch included in relation.
|
730
|
-
#
|
731
|
-
# @param [String] title container-title
|
732
|
-
#
|
733
|
-
# @return [Hash] The included in relation item.
|
734
|
-
#
|
735
|
-
def fetch_included_in(title)
|
736
|
-
query = CGI.escape [title, @src["publisher"], @src["publisher-location"], fetch_year].join(", ")
|
737
|
-
resp = Faraday.get %{http://api.crossref.org/works?query.bibliographic="#{query}"&rows=10&filter=type:book}
|
738
|
-
json = JSON.parse resp.body
|
739
|
-
json["message"]["items"].detect { |i| i["title"].include?(title) && i["editor"] }
|
740
|
-
end
|
741
|
-
|
742
712
|
#
|
743
713
|
# Fetch year from the source hash.
|
744
714
|
#
|
data/lib/relaton_doi/version.rb
CHANGED
data/relaton-doi.gemspec
CHANGED
@@ -8,13 +8,13 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Ribose Inc."]
|
9
9
|
spec.email = ["open.source@ribose.com"]
|
10
10
|
|
11
|
-
spec.summary = "RelatonDOI: retrieve Standards for bibliographic "\
|
11
|
+
spec.summary = "RelatonDOI: retrieve Standards for bibliographic " \
|
12
12
|
"using DOI through Crossrefand provide Relaton object."
|
13
|
-
spec.description = "RelatonDOI: retrieve Standards for bibliographic "\
|
13
|
+
spec.description = "RelatonDOI: retrieve Standards for bibliographic " \
|
14
14
|
"using DOI through Crossrefand provide Relaton object."
|
15
15
|
spec.homepage = "https://github.com/relaton/relaton-doi"
|
16
16
|
spec.license = "BSD-2-Clause"
|
17
|
-
spec.required_ruby_version = ">= 2.
|
17
|
+
spec.required_ruby_version = ">= 2.7.0"
|
18
18
|
|
19
19
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
|
20
20
|
|
@@ -33,21 +33,14 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
# Uncomment to register a new dependency of your gem
|
35
35
|
# spec.add_dependency "example-gem", "~> 1.0"
|
36
|
-
|
37
|
-
|
38
|
-
spec.
|
39
|
-
spec.
|
40
|
-
spec.
|
41
|
-
spec.
|
42
|
-
spec.add_development_dependency "webmock"
|
43
|
-
|
44
|
-
spec.add_dependency "relaton-bib", "~> 1.14.3"
|
45
|
-
spec.add_dependency "relaton-bipm", "~> 1.14.0"
|
46
|
-
spec.add_dependency "relaton-ieee", "~> 1.14.0"
|
47
|
-
spec.add_dependency "relaton-ietf", "~> 1.14.0"
|
48
|
-
spec.add_dependency "relaton-nist", "~> 1.14.0"
|
36
|
+
|
37
|
+
spec.add_dependency "relaton-bib", "~> 1.16.0"
|
38
|
+
spec.add_dependency "relaton-bipm", "~> 1.16.0"
|
39
|
+
spec.add_dependency "relaton-ieee", "~> 1.16.0"
|
40
|
+
spec.add_dependency "relaton-ietf", "~> 1.16.0"
|
41
|
+
spec.add_dependency "relaton-nist", "~> 1.16.0"
|
49
42
|
# spec.add_dependency "relaton-w3c", "~> 1.10.0"
|
50
|
-
spec.add_dependency "serrano", "~> 1.
|
43
|
+
spec.add_dependency "serrano", "~> 1.4.0"
|
51
44
|
|
52
45
|
# For more information and examples about making a new gem, checkout our
|
53
46
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,183 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-doi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.16.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: 2023-
|
11
|
+
date: 2023-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: equivalent-xml
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.6'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0.6'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rubocop-performance
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
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: rubocop-rails
|
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: simplecov
|
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: vcr
|
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: webmock
|
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
13
|
- !ruby/object:Gem::Dependency
|
98
14
|
name: relaton-bib
|
99
15
|
requirement: !ruby/object:Gem::Requirement
|
100
16
|
requirements:
|
101
17
|
- - "~>"
|
102
18
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
19
|
+
version: 1.16.0
|
104
20
|
type: :runtime
|
105
21
|
prerelease: false
|
106
22
|
version_requirements: !ruby/object:Gem::Requirement
|
107
23
|
requirements:
|
108
24
|
- - "~>"
|
109
25
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
26
|
+
version: 1.16.0
|
111
27
|
- !ruby/object:Gem::Dependency
|
112
28
|
name: relaton-bipm
|
113
29
|
requirement: !ruby/object:Gem::Requirement
|
114
30
|
requirements:
|
115
31
|
- - "~>"
|
116
32
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
33
|
+
version: 1.16.0
|
118
34
|
type: :runtime
|
119
35
|
prerelease: false
|
120
36
|
version_requirements: !ruby/object:Gem::Requirement
|
121
37
|
requirements:
|
122
38
|
- - "~>"
|
123
39
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
40
|
+
version: 1.16.0
|
125
41
|
- !ruby/object:Gem::Dependency
|
126
42
|
name: relaton-ieee
|
127
43
|
requirement: !ruby/object:Gem::Requirement
|
128
44
|
requirements:
|
129
45
|
- - "~>"
|
130
46
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
47
|
+
version: 1.16.0
|
132
48
|
type: :runtime
|
133
49
|
prerelease: false
|
134
50
|
version_requirements: !ruby/object:Gem::Requirement
|
135
51
|
requirements:
|
136
52
|
- - "~>"
|
137
53
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
54
|
+
version: 1.16.0
|
139
55
|
- !ruby/object:Gem::Dependency
|
140
56
|
name: relaton-ietf
|
141
57
|
requirement: !ruby/object:Gem::Requirement
|
142
58
|
requirements:
|
143
59
|
- - "~>"
|
144
60
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
61
|
+
version: 1.16.0
|
146
62
|
type: :runtime
|
147
63
|
prerelease: false
|
148
64
|
version_requirements: !ruby/object:Gem::Requirement
|
149
65
|
requirements:
|
150
66
|
- - "~>"
|
151
67
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.
|
68
|
+
version: 1.16.0
|
153
69
|
- !ruby/object:Gem::Dependency
|
154
70
|
name: relaton-nist
|
155
71
|
requirement: !ruby/object:Gem::Requirement
|
156
72
|
requirements:
|
157
73
|
- - "~>"
|
158
74
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
75
|
+
version: 1.16.0
|
160
76
|
type: :runtime
|
161
77
|
prerelease: false
|
162
78
|
version_requirements: !ruby/object:Gem::Requirement
|
163
79
|
requirements:
|
164
80
|
- - "~>"
|
165
81
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
82
|
+
version: 1.16.0
|
167
83
|
- !ruby/object:Gem::Dependency
|
168
84
|
name: serrano
|
169
85
|
requirement: !ruby/object:Gem::Requirement
|
170
86
|
requirements:
|
171
87
|
- - "~>"
|
172
88
|
- !ruby/object:Gem::Version
|
173
|
-
version: 1.
|
89
|
+
version: 1.4.0
|
174
90
|
type: :runtime
|
175
91
|
prerelease: false
|
176
92
|
version_requirements: !ruby/object:Gem::Requirement
|
177
93
|
requirements:
|
178
94
|
- - "~>"
|
179
95
|
- !ruby/object:Gem::Version
|
180
|
-
version: 1.
|
96
|
+
version: 1.4.0
|
181
97
|
description: 'RelatonDOI: retrieve Standards for bibliographic using DOI through Crossrefand
|
182
98
|
provide Relaton object.'
|
183
99
|
email:
|
@@ -217,14 +133,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
217
133
|
requirements:
|
218
134
|
- - ">="
|
219
135
|
- !ruby/object:Gem::Version
|
220
|
-
version: 2.
|
136
|
+
version: 2.7.0
|
221
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
222
138
|
requirements:
|
223
139
|
- - ">="
|
224
140
|
- !ruby/object:Gem::Version
|
225
141
|
version: '0'
|
226
142
|
requirements: []
|
227
|
-
rubygems_version: 3.
|
143
|
+
rubygems_version: 3.3.26
|
228
144
|
signing_key:
|
229
145
|
specification_version: 4
|
230
146
|
summary: 'RelatonDOI: retrieve Standards for bibliographic using DOI through Crossrefand
|