relaton-iso 1.7.5 → 1.8.0

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: f0c5bc4d61a17fbf55ecc1d68d689198c181c5d68924b1d4cf73f4d7e166ff14
4
- data.tar.gz: 1621f2d080eea7e977811a1616e80137317de4339fd9820e69f7245d996b3619
3
+ metadata.gz: 61646e164a8a384cb744e3e50dafdea336f74cbf7418b59d1b5a30e8aabeea62
4
+ data.tar.gz: f3c861c4fd11e792f9bd7d7edd0e83d95a5972c6e1590825ce0562360cc5f0d6
5
5
  SHA512:
6
- metadata.gz: 4842a83c61845dc60985b5c916902d21b423be5c6eeeaf27f0d31e6db7badb63accfb48f67e64287cc77685ab23a373a17015cd15df132d7cd18f711ea30cdc6
7
- data.tar.gz: 3729fbb3e1bdfe2406c1c80e6ad839f9f06b17f9270e5e7c19117ae943e5e750300073c2d701458c472e65a8bd4e56ec086a79b83873ec5c7ac8161cf7f18ca2
6
+ metadata.gz: 073cf929ab4f17e00651c03443b4bc0d21526994ebd5532a5914f841066f4ec6522d58344ddabf09e69f409243c59c6c721db2a3c1c38c9784b6211cd48d9982
7
+ data.tar.gz: 2e710926a48e59aba377f89cea8589f4dbb0abe0ddd53a906d9463faf7adf70681f8ef8d8b68f30d8398c9db4b9859a898b243ec53f5f2010dd7bd5a8e99b086
@@ -41,7 +41,7 @@ module RelatonIso
41
41
  #
42
42
  # @return [Array<RelatonIso::Hit]
43
43
  #
44
- def fetch_github
44
+ def fetch_github # rubocop:disable Metrics/AbcSize
45
45
  ref = text.gsub(/[\s\/]/, "_").upcase
46
46
  url = "https://raw.githubusercontent.com/relaton/relaton-data-iso/main/data/#{ref}.yaml"
47
47
  resp = Net::HTTP.get_response URI(url)
@@ -60,8 +60,8 @@ module RelatonIso
60
60
  #
61
61
  # @return [Array<RelatonIso::Hit>]
62
62
  #
63
- def fetch_iso
64
- %r{\s(?<num>\d+)(-(?<part>[\d-]+))?} =~ text
63
+ def fetch_iso # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
64
+ %r{\s(?<num>\d+)(?:-(?<part>[\d-]+))?} =~ text
65
65
  http = Net::HTTP.new "www.iso.org", 443
66
66
  http.use_ssl = true
67
67
  search = ["status=ENT_ACTIVE,ENT_PROGRESS,ENT_INACTIVE,ENT_DELETED"]
@@ -70,7 +70,7 @@ module RelatonIso
70
70
  q = search.join "&"
71
71
  resp = http.get("/cms/render/live/en/sites/isoorg.advancedSearch.do?#{q}",
72
72
  "Accept" => "application/json, text/plain, */*")
73
- return if resp.body.empty?
73
+ return [] if resp.body.empty?
74
74
 
75
75
  json = JSON.parse resp.body
76
76
  json["standards"].map { |h| Hit.new h, self }.sort! do |a, b|
@@ -3,7 +3,7 @@
3
3
  # require 'relaton_iso/iso_bibliographic_item'
4
4
  require "relaton_iso/scrapper"
5
5
  require "relaton_iso/hit_collection"
6
- require "relaton_iec"
6
+ # require "relaton_iec"
7
7
 
8
8
  module RelatonIso
9
9
  # Class methods for search ISO standards.
@@ -120,7 +120,7 @@ module RelatonIso
120
120
  # @param code [String]
121
121
  # @param opts [Hash]
122
122
  # @return [RelatonIso::HitCollection]
123
- def search_code(result, code, opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
123
+ def search_code(result, code, _opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
124
124
  code1, part1, corr1, coryear1 = ref_components code
125
125
  result.select do |i|
126
126
  code2, part2, corr2, coryear2 = ref_components i.hit["docRef"]
@@ -131,12 +131,12 @@ module RelatonIso
131
131
 
132
132
  def ref_components(ref)
133
133
  %r{
134
- ^(?<code>ISO(?:\s|\/)[^-\/:]+)
135
- (?:-(?<part>[^:\/]+))?
134
+ ^(?<code>ISO(?:\s|/)[^-/:()]+)
135
+ (?:-(?<part>[^:/]+))?
136
136
  (?::\d{4})?
137
- (?:\/(?<corr>\w+(?:\s\w+)?\s\d+)(?:(?<coryear>\d{4}))?)?
137
+ (?:/(?<corr>\w+(?:\s\w+)?\s\d+)(?:(?<coryear>\d{4}))?)?
138
138
  }x =~ ref
139
- [code, part, corr, coryear]
139
+ [code&.strip, part, corr, coryear]
140
140
  end
141
141
 
142
142
  # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonIso
4
- VERSION = "1.7.5"
4
+ VERSION = "1.8.0"
5
5
  end
data/relaton_iso.gemspec CHANGED
@@ -37,6 +37,6 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency "vcr"
38
38
  spec.add_development_dependency "webmock"
39
39
 
40
- spec.add_dependency "relaton-iec", "~> 1.7.0"
41
- spec.add_dependency "relaton-iso-bib", "~> 1.7.0"
40
+ # spec.add_dependency "relaton-iec", "~> 1.8.0"
41
+ spec.add_dependency "relaton-iso-bib", "~> 1.8.0"
42
42
  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.7.5
4
+ version: 1.8.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: 2021-05-05 00:00:00.000000000 Z
11
+ date: 2021-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -122,34 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: relaton-iec
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: 1.7.0
132
- type: :runtime
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: 1.7.0
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: relaton-iso-bib
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
129
  - - "~>"
144
130
  - !ruby/object:Gem::Version
145
- version: 1.7.0
131
+ version: 1.8.0
146
132
  type: :runtime
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - "~>"
151
137
  - !ruby/object:Gem::Version
152
- version: 1.7.0
138
+ version: 1.8.0
153
139
  description: 'RelatonIso: retrieve ISO Standards for bibliographic use using the IsoBibliographicItem
154
140
  model'
155
141
  email: