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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c74297f60135d99153e2e5f7f3c4a1acb3945b43fbcc26868bf900b2e9ec3c0
4
- data.tar.gz: 6c241a6fc93c87a1751bde8772752c859ee9a000c04729ddc3910386c4827d66
3
+ metadata.gz: 4184d182bd51c7b61a50ae43d52bd95ddd73024defb5ca8ee96641ca7ae4b13b
4
+ data.tar.gz: 519e7864a1ddea5cc3a74569848e08ba0951d61877b0e9c9262c76b69afb46c5
5
5
  SHA512:
6
- metadata.gz: 74ef5db4deb7ff21ba09e5caa2e98c051549e81fa6d0ea1249787767d19d3cb10af911e1c51a11d6cf965fc856e2cdd7d6538b0eea19200bc43782f707550521
7
- data.tar.gz: 7b13cd9e6f765f3f0e2fff5c703ae24c9b4c3b98c96a2138b46cb0a969ee64431390a5551696c2a5a2b00b1581b3910988ef3ee40da3a7ad6527174e1660bfc0
6
+ metadata.gz: b544c06393cd74c073cc1c815e12646ef8d06b3f6fcbee464547d21416617d707ea33ffd370bb69c0aba94d6feda816bc78fa0cb36bc7ac5960ed90e5bc4304f
7
+ data.tar.gz: bd11ec0a75b525c6d34a0b922a1a2b64784a2944f3fd8e49f5756493160b25a7da7078c70ac2b853f7bf8a19ec3e941eb3597327293ccdca6a74429140bb2f55
@@ -5,6 +5,7 @@ name: rake
5
5
  on:
6
6
  push:
7
7
  branches: [ master, main ]
8
+ tags: [ v* ]
8
9
  pull_request:
9
10
 
10
11
  jobs:
@@ -10,8 +10,9 @@ on:
10
10
  Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
11
11
  required: true
12
12
  default: 'skip'
13
- push:
14
- tags: [ v* ]
13
+ repository_dispatch:
14
+ types: [ do-release ]
15
+
15
16
 
16
17
  jobs:
17
18
  release:
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /vendor/
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
data/.rubocop.yml CHANGED
@@ -7,6 +7,6 @@ require: rubocop-rails
7
7
  inherit_from:
8
8
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
9
9
  AllCops:
10
- TargetRubyVersion: 2.5
10
+ TargetRubyVersion: 2.7
11
11
  Rails:
12
12
  Enabled: false
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 "debug"
13
+ gem "rubocop-performance"
14
+ gem "rubocop-rails"
15
+ gem "simplecov"
16
+ gem "vcr"
17
+ gem "webmock"
@@ -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
- item = fetch_parent
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 fetch_parent # rubocop:disable Metrics/AbcSize
391
- query = [@src["container-title"][0], fetch_year].compact.join "+"
392
- filter = "type:#{%w[book book-set edited-book monograph reference-book].join ',type:'}"
393
- resp = Faraday.get "https://api.crossref.org/works?query=#{query}&filter=#{filter}"
394
- json = JSON.parse resp.body
395
- json["message"]["items"].detect { |i| i["title"].include? @src["container-title"][0] }
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, item)
408
- return [] if has || !item
405
+ def create_authors_editors(has, type)
406
+ return [] if has || !parent_item
409
407
 
410
- RelatonBib.array(item[type]).map { |a| contributor(create_person(a), type) }
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 = included_in_editors(ct)
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
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonDoi
4
- VERSION = "1.14.3"
4
+ VERSION = "1.14.4"
5
5
  end
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.5.0"
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.0.0"
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.3
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-01-17 00:00:00.000000000 Z
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.0.0
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.0.0
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.5.0
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.1.6
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