relaton-iso 1.13.5 → 1.13.7

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: 545043eab945ec715dbf08c77dbd3c07379b87d0c06c317431223a97cb0b7816
4
- data.tar.gz: 8f7594c2399682c780e47eb4e770deb19d48a17ffd5c21efc1938a463768eb25
3
+ metadata.gz: 64446d11a9b8ff146087a41ea017e7df943c1d4453ce213aa0ce9a15afd9fa12
4
+ data.tar.gz: 557da1af0ed0723f8e48bf21e447937b70888294c514a2e6df970a99d662dfaf
5
5
  SHA512:
6
- metadata.gz: 15b2628861c98f99a4879ec5d4c94f52d6551cdd20b322127d9ec4f42e2370e6f85350b95a257ecaaa49843bd29975a74e33fadff12bcbacc594d5ab3dd00d75
7
- data.tar.gz: d5491c7ac248b6e3ba7bee7dbd2c32527103a3ede84dc14bfc67d29597c35e735ea47b5beed488f104ae3e9a46e28201aad0bc2667a85203a95d9bb9c9486c6e
6
+ metadata.gz: 831fad8c654c5342b588f7fc6d4c504ce1459b68fe050d3a3d1508288f540d6c9979c09b2c5dd1fbdd472cbe632d8a639942b17854a808ed9a7e13a60d50d733
7
+ data.tar.gz: 9452ff39391c29dae9daf6a4efe25a7afbd9a65b17ebef8174ab6544cb67667b593646ef2dfdf393dfff42336f3d1ccb07fa909a1b05a71f1f10cfd367ecfc08
@@ -1,7 +1,7 @@
1
1
  module RelatonIso
2
2
  class DocumentIdentifier < RelatonBib::DocumentIdentifier
3
3
  def id
4
- id_str = @id.to_s.sub(/\sED\d+/, "")
4
+ id_str = @id.to_s.sub(/\sED\d+/, "").squeeze(" ").sub(/^ISO\/\s/, "ISO ") # workarounds for pubid gem bugs
5
5
  if @all_parts
6
6
  if type == "URN"
7
7
  return "#{@id.urn}:ser"
@@ -6,11 +6,26 @@ module RelatonIso
6
6
  # @return [RelatonIsoBib::IsoBibliographicItem]
7
7
  attr_writer :fetch, :pubid
8
8
 
9
+ # Update edition for pubid when provided in Bibliographic Item
10
+ def update_edition(bibliographic_item)
11
+ if bibliographic_item.edition
12
+ # add edition to base document if available
13
+ if pubid.base
14
+ pubid.base.edition = bibliographic_item.edition.content
15
+ else
16
+ pubid.edition = bibliographic_item.edition.content
17
+ end
18
+ end
19
+ end
20
+
9
21
  # Parse page.
10
22
  # @param lang [String, nil]
11
23
  # @return [RelatonIso::IsoBibliographicItem]
12
24
  def fetch(lang = nil)
13
25
  @fetch ||= Scrapper.parse_page self, lang
26
+ # update edition for pubid using fetched data
27
+ update_edition(@fetch)
28
+ @fetch
14
29
  end
15
30
 
16
31
  # @return [Integer]
@@ -117,7 +117,10 @@ module RelatonIso
117
117
 
118
118
  # filter by year
119
119
  hits = hit_collection.select do |hit|
120
- if hit.pubid.year.to_s == year.to_s
120
+ if (hit.pubid.base.nil? && hit.pubid.year.to_s == year.to_s) ||
121
+ (!hit.pubid.base.nil? && hit.pubid.base.year.to_s == year.to_s)
122
+ true
123
+ elsif (!hit.pubid.base.nil? && hit.pubid.year.to_s == year.to_s)
121
124
  true
122
125
  elsif hit.pubid.year.nil? && hit.hit[:year].to_s == year
123
126
  hit.pubid.year = year
@@ -62,7 +62,6 @@ module RelatonIso
62
62
  # Fetch edition.
63
63
  edition = doc.at("//div[div[.='Edition']]/text()[last()]")
64
64
  &.text&.match(/\d+$/)&.to_s
65
- hit.pubid.edition = edition if edition
66
65
 
67
66
  titles, abstract, langs = fetch_titles_abstract(doc, lang)
68
67
 
@@ -98,7 +97,7 @@ module RelatonIso
98
97
  # @return [Array<RelatonBib::DocumentIdentifier>]
99
98
  #
100
99
  def fetch_relaton_docids(doc, pubid)
101
- pubid.urn_stage = stage_code(doc).to_f
100
+ pubid.stage = Pubid::Iso::Stage.new(harmonized_code: stage_code(doc))
102
101
  [
103
102
  RelatonIso::DocumentIdentifier.new(id: pubid, type: "ISO", primary: true),
104
103
  RelatonIso::DocumentIdentifier.new(id: pubid, type: "URN"),
@@ -226,7 +225,7 @@ module RelatonIso
226
225
  end
227
226
 
228
227
  def stage_code(doc)
229
- doc.at("//ul[@class='dropdown-menu']/li[@class='active']"\
228
+ doc.at("//ul[@class='dropdown-menu']/li[@class='active']" \
230
229
  "/a/span[@class='stage-code']").text
231
230
  end
232
231
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonIso
4
- VERSION = "1.13.5"
4
+ VERSION = "1.13.7"
5
5
  end
data/relaton_iso.gemspec CHANGED
@@ -39,7 +39,6 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "webmock"
40
40
 
41
41
  spec.add_dependency "algolia"
42
- spec.add_dependency "pubid-core", "1.2.1"
43
- spec.add_dependency "pubid-iso", "~> 0.2.0"
42
+ spec.add_dependency "pubid-iso", "~> 0.3.0"
44
43
  spec.add_dependency "relaton-iso-bib", "~> 1.13.0"
45
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.5
4
+ version: 1.13.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-22 00:00:00.000000000 Z
11
+ date: 2022-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -178,34 +178,20 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
- - !ruby/object:Gem::Dependency
182
- name: pubid-core
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - '='
186
- - !ruby/object:Gem::Version
187
- version: 1.2.1
188
- type: :runtime
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - '='
193
- - !ruby/object:Gem::Version
194
- version: 1.2.1
195
181
  - !ruby/object:Gem::Dependency
196
182
  name: pubid-iso
197
183
  requirement: !ruby/object:Gem::Requirement
198
184
  requirements:
199
185
  - - "~>"
200
186
  - !ruby/object:Gem::Version
201
- version: 0.2.0
187
+ version: 0.3.0
202
188
  type: :runtime
203
189
  prerelease: false
204
190
  version_requirements: !ruby/object:Gem::Requirement
205
191
  requirements:
206
192
  - - "~>"
207
193
  - !ruby/object:Gem::Version
208
- version: 0.2.0
194
+ version: 0.3.0
209
195
  - !ruby/object:Gem::Dependency
210
196
  name: relaton-iso-bib
211
197
  requirement: !ruby/object:Gem::Requirement