relaton-bipm 1.13.5 → 1.13.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44b5e29b765a1c5abb4e7d1e30f25924a3aba14462c654da9926e91b4c60c040
4
- data.tar.gz: 772df92aa9bfd854f0228bfeaaf0edcda9665a5cf10237ff5bca89a9276f285e
3
+ metadata.gz: aeddd651dcb48a277d10ad9351ba46351b7fe43eb8b136a359148d83a23ca7c0
4
+ data.tar.gz: 5b25f339d03c0278660b58a7b190e88e5a1c05ab0bcbec007fb8fdd6108efa7d
5
5
  SHA512:
6
- metadata.gz: 041beb9bc400b47198472a9ffab00427f3d08bae04121360527d8810354406a67602f68daff60e3ee16e9e195d37d33d0ce968f20b96f4005a5796d1e6caf200
7
- data.tar.gz: e509099ba765739a5792f9f56ba58e6e93beb1e84b7f31e0f9cec09e95d34e70b4bd099a427640d5bab4800f138587930dd11a446f88149cb9f0004d14d2a29a
6
+ metadata.gz: 3b913ce825a85cb4e751bb149422427f6828f009fe6324b08c18c25ab6573c0e365f266d7954940a79e63bacd8fb52ee81d37aa983749d1d0403c3fee0c1dcd1
7
+ data.tar.gz: 202619fe86dde21f5bfe8efb221177ab3cd078c4fcd57078b1584baf6609fed489d1c16e0d84b4fe5aa63bd88f59dd53b8b5d36c4d10931c6f57702c0b909ad0
data/README.adoc CHANGED
@@ -33,6 +33,14 @@ Or install it yourself as:
33
33
 
34
34
  === Search for a standard using keywords
35
35
 
36
+ The Metrologia website employs anti-DDoS protection, which may cause the search to fail. If this happens, open provided link in a browser and solve the captcha.
37
+
38
+ ----
39
+ [relaton-bipm] ("BIPM Metrologia 50 4 385") fetching...
40
+ [relaton-bipm] This source employs anti-DDoS measures that unfortunately affects automated requests.
41
+ [relaton-bipm] Please visit this link in your browser to resolve the CAPTCHA, then retry: https://iopscience.iop.org/article/10.1088/0026-1394/50/4/385
42
+ ----
43
+
36
44
  ==== References for Si-Brochure documents
37
45
 
38
46
  `BIPM {DOCUMENT_NAME}`
@@ -44,6 +44,7 @@ module RelatonBipm
44
44
  "Upgrade-Insecure-Requests" => "1",
45
45
  }
46
46
  a.user_agent_alias = Mechanize::AGENT_ALIASES.map(&:first).shuffle.first
47
+ # a.user_agent_alias = "Mac Safari"
47
48
  a
48
49
  end
49
50
 
@@ -241,6 +242,7 @@ module RelatonBipm
241
242
  # @param agent [Mechanize]
242
243
  # @return [RelatonBipm::BipmBibliographicItem]
243
244
  def get_article(path, vol, ish, agent) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
245
+ agent.agent.allowed_error_codes = [403]
244
246
  rsp = agent.get path
245
247
  check_response rsp
246
248
  url = rsp.uri
@@ -305,15 +307,17 @@ module RelatonBipm
305
307
  # @param bibtex [BibTeX::Entry]
306
308
  # @return [Array<Hash>]
307
309
  def btcontrib(bibtex)
308
- surname, initial = bibtex.author.split ", "
309
- initial = initial.split.map { |i| RelatonBib::LocalizedString.new i, "en", "Latn" }
310
- surname = RelatonBib::LocalizedString.new surname, "en", "Latn"
311
- name = RelatonBib::FullName.new surname: surname, initial: initial
312
- author = RelatonBib::Person.new name: name
313
- [
314
- { entity: { name: bibtex.publisher.to_s }, role: [{ type: "publisher" }] },
315
- { entity: author, role: [{ type: "author" }] },
316
- ]
310
+ contribs = [{
311
+ entity: { name: bibtex.publisher.to_s }, role: [{ type: "publisher" }]
312
+ }]
313
+ return contribs unless bibtex.author
314
+
315
+ bibtex.author.split(" and ").inject(contribs) do |mem, name|
316
+ cname = RelatonBib::LocalizedString.new name, "en", "Latn"
317
+ name = RelatonBib::FullName.new completename: cname
318
+ author = RelatonBib::Person.new name: name
319
+ mem << { entity: author, role: [{ type: "author" }] }
320
+ end
317
321
  end
318
322
 
319
323
  #
@@ -354,7 +358,7 @@ module RelatonBipm
354
358
  warn "[relaton-bipm] Please visit this link in your browser to resolve the CAPTCHA, then retry: #{rsp.uri}"
355
359
  # warn "[relaton-bipm] #{rsp.uri} is redirected to #{rsp.header['location']}"
356
360
  raise RelatonBib::RequestError, "cannot access #{rsp.uri}"
357
- elsif rsp.code != "200"
361
+ elsif rsp.code != "200" && rsp.code != "403"
358
362
  warn "[read_bipm] can't acces #{rsp.uri} #{rsp.code}"
359
363
  raise RelatonBib::RequestError, "cannot acces #{rsp.uri} #{rsp.code}"
360
364
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.13.5".freeze
2
+ VERSION = "1.13.6".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.5
4
+ version: 1.13.6
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-09-10 00:00:00.000000000 Z
11
+ date: 2022-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug