relaton-itu 0.8.1 → 0.9.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: 4d41566d2edd5f2e8c2757b8c74fb68c26c4b56943f84dcad3cb98d129023db1
4
- data.tar.gz: ad70f1d469d40195f950201d3e15db288764469f6d940d8abe8bdafdec450222
3
+ metadata.gz: 1f50d54c2e89599301de03650f1bd7f6b9ea410cbcd85f4753ac9f441a940bfb
4
+ data.tar.gz: 7485282974b8374f8791229381993e1e90de289af569733d5cb1c84562373331
5
5
  SHA512:
6
- metadata.gz: 992227b0d7c971aa6908aa68e4b274033232067af58c534a53ec7e4faab024faeb79ae9cbda91f7251d6f3ccb895e484bb5f5821500d8c2e946e0d30205af7f2
7
- data.tar.gz: 3f6cff1e0c18a5e94c8f1f5c9beac1c24b346b7b462060f133c7da634b33f497d5d65a0bf807d5e0a43e57e96d8dcdfd259cfb6bf97e7233975870f6b9f76efe
6
+ metadata.gz: e43eeefa738288462921e1af23add87ddd011f93eee783a83353318e9afa875cf46ba0affc6a26ece803c2568b7f7e20bbe2fe0c4c618d0ef0fc943ad416727c
7
+ data.tar.gz: 4ea0111e1967df492955e8a654e760e0f5115fd4497a4a0acc137fb28aa1c8e13c175e40dc61ab8b9097401df2c85a8d35803585f6830d5b76a5c34bf5616203
@@ -42,8 +42,8 @@ module RelatonItu
42
42
  ret = itubib_get1(code, year, opts)
43
43
  return nil if ret.nil?
44
44
 
45
- ret.to_most_recent_reference unless year || opts[:keep_year]
46
- ret.to_all_parts if opts[:all_parts]
45
+ ret = ret.to_most_recent_reference unless year || opts[:keep_year]
46
+ ret = ret.to_all_parts if opts[:all_parts]
47
47
  ret
48
48
  end
49
49
 
@@ -51,15 +51,15 @@ module RelatonItu
51
51
 
52
52
  def fetch_ref_err(code, year, missed_years)
53
53
  id = year ? "#{code}:#{year}" : code
54
- warn "WARNING: no match found online for #{id}. "\
54
+ warn "[relaton-itu] WARNING: no match found online for #{id}. "\
55
55
  "The code must be exactly like it is on the standards website."
56
- warn "(There was no match for #{year}, though there were matches "\
56
+ warn "[relaton-itu] (There was no match for #{year}, though there were matches "\
57
57
  "found for #{missed_years.join(', ')}.)" unless missed_years.empty?
58
58
  if /\d-\d/ =~ code
59
- warn "The provided document part may not exist, or the document "\
59
+ warn "[relaton-itu] The provided document part may not exist, or the document "\
60
60
  "may no longer be published in parts."
61
61
  else
62
- warn "If you wanted to cite all document parts for the reference, "\
62
+ warn "[relaton-itu] If you wanted to cite all document parts for the reference, "\
63
63
  "use \"#{code} (all parts)\".\nIf the document is not a standard, "\
64
64
  "use its document type abbreviation (TS, TR, PAS, Guide)."
65
65
  end
@@ -77,7 +77,7 @@ module RelatonItu
77
77
  def search_filter(code)
78
78
  docidrx = %r{\w+.\d+|\w\sSuppl\.\s\d+} # %r{^ITU-T\s[^\s]+}
79
79
  c = code.match(docidrx).to_s
80
- warn "fetching #{code}..."
80
+ warn "[relaton-itu] (\"#{code}\") fetching..."
81
81
  result = search(code)
82
82
  result.select do |i|
83
83
  i.hit[:code] &&
@@ -94,7 +94,7 @@ module RelatonItu
94
94
  def isobib_results_filter(result, year)
95
95
  missed_years = []
96
96
  result.each_slice(3) do |s| # ISO website only allows 3 connections
97
- fetch_pages(s, 3).each_with_index do |r, i|
97
+ fetch_pages(s, 3).each do |r|
98
98
  return { ret: r } if !year
99
99
 
100
100
  r.date.select { |d| d.type == "published" }.each do |d|
@@ -107,12 +107,15 @@ module RelatonItu
107
107
  { years: missed_years }
108
108
  end
109
109
 
110
- def itubib_get1(code, year, opts)
111
- result = search_filter(code) or return nil
110
+ def itubib_get1(code, year, _opts)
111
+ result = search_filter(code) || return
112
112
  ret = isobib_results_filter(result, year)
113
- return ret[:ret] if ret[:ret]
114
-
115
- fetch_ref_err(code, year, ret[:years])
113
+ if ret[:ret]
114
+ warn "[relaton-itu] (\"#{code}\") found #{ret[:ret].docidentifier.first&.id}"
115
+ ret[:ret]
116
+ else
117
+ fetch_ref_err(code, year, ret[:years])
118
+ end
116
119
  end
117
120
  end
118
121
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonItu
2
- VERSION = "0.8.1".freeze
2
+ VERSION = "0.9.0".freeze
3
3
  end
@@ -12,7 +12,7 @@ module RelatonItu
12
12
  if ituitem
13
13
  ItuBibliographicItem.new item_data(ituitem)
14
14
  elsif
15
- warn "[relato-itu] can't find bibitem or bibdata element in the XML"
15
+ warn "[relaton-itu] can't find bibitem or bibdata element in the XML"
16
16
  end
17
17
  end
18
18
 
@@ -32,10 +32,10 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency "rake", "~> 10.0"
33
33
  spec.add_development_dependency "rspec", "~> 3.0"
34
34
  spec.add_development_dependency "ruby-debug-ide"
35
+ spec.add_development_dependency "ruby-jing"
35
36
  spec.add_development_dependency "simplecov"
36
37
  spec.add_development_dependency "vcr", "~> 5.0.0"
37
38
  spec.add_development_dependency "webmock"
38
- spec.add_development_dependency "ruby-jing"
39
39
 
40
- spec.add_dependency "relaton-iso-bib", "~> 0.8.0"
40
+ spec.add_dependency "relaton-iso-bib", "~> 0.9.0"
41
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.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: 2020-02-26 00:00:00.000000000 Z
11
+ date: 2020-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: simplecov
98
+ name: ruby-jing
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,35 +109,35 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: vcr
112
+ name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 5.0.0
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 5.0.0
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: webmock
126
+ name: vcr
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: 5.0.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: 5.0.0
139
139
  - !ruby/object:Gem::Dependency
140
- name: ruby-jing
140
+ name: webmock
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - ">="
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.8.0
159
+ version: 0.9.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.8.0
166
+ version: 0.9.0
167
167
  description: 'RelatonItu: retrieve ITU Standards for bibliographic use using the BibliographicItem
168
168
  model'
169
169
  email: