relaton-doi 1.14.3 → 1.14.4
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 +3 -2
- 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 +4 -11
- metadata +6 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4184d182bd51c7b61a50ae43d52bd95ddd73024defb5ca8ee96641ca7ae4b13b
|
4
|
+
data.tar.gz: 519e7864a1ddea5cc3a74569848e08ba0951d61877b0e9c9262c76b69afb46c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b544c06393cd74c073cc1c815e12646ef8d06b3f6fcbee464547d21416617d707ea33ffd370bb69c0aba94d6feda816bc78fa0cb36bc7ac5960ed90e5bc4304f
|
7
|
+
data.tar.gz: bd11ec0a75b525c6d34a0b922a1a2b64784a2944f3fd8e49f5756493160b25a7da7078c70ac2b853f7bf8a19ec3e941eb3597327293ccdca6a74429140bb2f55
|
data/.github/workflows/rake.yml
CHANGED
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,13 +33,6 @@ 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
|
-
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
37
|
-
# spec.add_development_dependency "ruby-jing"
|
38
|
-
spec.add_development_dependency "rubocop-performance"
|
39
|
-
spec.add_development_dependency "rubocop-rails"
|
40
|
-
spec.add_development_dependency "simplecov"
|
41
|
-
spec.add_development_dependency "vcr"
|
42
|
-
spec.add_development_dependency "webmock"
|
43
36
|
|
44
37
|
spec.add_dependency "relaton-bib", "~> 1.14.3"
|
45
38
|
spec.add_dependency "relaton-bipm", "~> 1.14.0"
|
@@ -47,7 +40,7 @@ Gem::Specification.new do |spec|
|
|
47
40
|
spec.add_dependency "relaton-ietf", "~> 1.14.0"
|
48
41
|
spec.add_dependency "relaton-nist", "~> 1.14.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,99 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-doi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.4
|
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-05-20 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
|
@@ -170,14 +86,14 @@ dependencies:
|
|
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
|