relaton-iec 1.5.0 → 1.6.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +2 -0
- data/README.adoc +2 -2
- data/lib/relaton_iec/hit_collection.rb +29 -9
- data/lib/relaton_iec/iec_bibliography.rb +2 -2
- data/lib/relaton_iec/scrapper.rb +1 -2
- data/lib/relaton_iec/version.rb +1 -1
- data/relaton_iec.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99612dcda07b9d860e087ecc3990a275b165539e2eefc83d4e5486feeb94ca4b
|
4
|
+
data.tar.gz: b15b0d2aa3860580697eb9ec009e68e96715be3e0debd9dc286b5527a250af02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15403a2fac73cfede74532468718a1c3a704d26b14cc54f2eabb7ea9f3451079003f62d4d22498809480c4ff64d84f6ab3e82689617dac3a082f348323abb0b7
|
7
|
+
data.tar.gz: 8ea1575201a593e580b39bcfe6205dd81f832116c967b88ec6608537b18e94410fab417eb9d1d2def971e996e7f35d16c43f53fe4641f7be2b0fb9b722a02fa2
|
data/.github/workflows/macos.yml
CHANGED
@@ -26,6 +26,8 @@ jobs:
|
|
26
26
|
- name: Update gems
|
27
27
|
run: |
|
28
28
|
sudo gem install bundler --force
|
29
|
+
ruby -v | grep 2.5 && bundle config set build.debase --with-cflags="-Wno-error=implicit-function-declaration"
|
30
|
+
ruby -v | grep 2.5 && bundle config set build.ruby-debug-ide --with-cflags="-Wno-error=implicit-function-declaration"
|
29
31
|
bundle install --jobs 4 --retry 3
|
30
32
|
- name: Run specs
|
31
33
|
run: |
|
data/README.adoc
CHANGED
@@ -18,7 +18,7 @@ Add this line to your application's Gemfile:
|
|
18
18
|
|
19
19
|
[source,ruby]
|
20
20
|
----
|
21
|
-
gem '
|
21
|
+
gem 'relaton-iec'
|
22
22
|
----
|
23
23
|
|
24
24
|
And then execute:
|
@@ -27,7 +27,7 @@ And then execute:
|
|
27
27
|
|
28
28
|
Or install it yourself as:
|
29
29
|
|
30
|
-
$ gem install
|
30
|
+
$ gem install relaton-iec
|
31
31
|
|
32
32
|
== Usage
|
33
33
|
|
@@ -10,22 +10,42 @@ module RelatonIec
|
|
10
10
|
|
11
11
|
# @param ref_nbr [String]
|
12
12
|
# @param year [String]
|
13
|
-
def initialize(ref_nbr, year = nil)
|
13
|
+
def initialize(ref_nbr, year = nil)
|
14
14
|
super
|
15
|
+
@array = hits ref_nbr, year
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def hits(ref, year)
|
15
21
|
from, to = nil
|
16
22
|
if year
|
17
23
|
from = Date.strptime year, "%Y"
|
18
24
|
to = from.next_year.prev_day
|
19
25
|
end
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
url
|
27
|
-
|
26
|
+
get_results ref, from, to
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_results(ref, from,to)
|
30
|
+
[nil, "trf", "wr"].reduce([]) do |m, t|
|
31
|
+
url = "#{DOMAIN}/searchkey"
|
32
|
+
url += "&type=#{t}" if t
|
33
|
+
url += "&RefNbr=#{ref}&From=#{from}&To=#{to}&start=1"
|
34
|
+
m + results(Addressable::URI.parse(url).normalize)
|
28
35
|
end
|
29
36
|
end
|
37
|
+
|
38
|
+
def results(uri)
|
39
|
+
Nokogiri::HTML(OpenURI.open_uri(uri)).css(
|
40
|
+
"//body/li", "ul.search-results > li", "ul.morethesame > li"
|
41
|
+
).map { |h| make_hit h }
|
42
|
+
end
|
43
|
+
|
44
|
+
def make_hit(hit)
|
45
|
+
link = hit.at('a[@href!="#"]')
|
46
|
+
code = link.text.tr [194, 160].pack("c*").force_encoding("UTF-8"), ""
|
47
|
+
title = hit.xpath("text()").text.gsub(/[\r\n]/, "")
|
48
|
+
Hit.new({ code: code, title: title, url: DOMAIN + link[:href] }, self)
|
49
|
+
end
|
30
50
|
end
|
31
51
|
end
|
@@ -136,9 +136,9 @@ module RelatonIec
|
|
136
136
|
return { ret: r } if !year
|
137
137
|
|
138
138
|
r.date.select { |d| d.type == "published" }.each do |d|
|
139
|
-
return { ret: r } if year.to_i == d.on
|
139
|
+
return { ret: r } if year.to_i == d.on(:year)
|
140
140
|
|
141
|
-
missed_years << d.on
|
141
|
+
missed_years << d.on(:year)
|
142
142
|
end
|
143
143
|
end
|
144
144
|
end
|
data/lib/relaton_iec/scrapper.rb
CHANGED
@@ -223,8 +223,7 @@ module RelatonIec
|
|
223
223
|
def fetch_status_relations(url)
|
224
224
|
pubid = url.match(/\d+$/).to_s
|
225
225
|
uri = URI DOMAIN + "/webstore/webstore.nsf/AjaxRequestXML?"\
|
226
|
-
"Openagent&url=
|
227
|
-
"p=103:390:::::P390_PUBLICATION_ID:" + pubid
|
226
|
+
"Openagent&url=" + pubid
|
228
227
|
resp = Net::HTTP.get_response uri
|
229
228
|
doc = Nokogiri::XML resp.body
|
230
229
|
status = fetch_status doc
|
data/lib/relaton_iec/version.rb
CHANGED
data/relaton_iec.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.pre1
|
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-
|
11
|
+
date: 2020-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debase
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 1.
|
173
|
+
version: 1.6.pre
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 1.
|
180
|
+
version: 1.6.pre
|
181
181
|
description: 'RelatonIec: retrieve IEC Standards for bibliographic use using the IecBibliographicItem
|
182
182
|
model'
|
183
183
|
email:
|
@@ -231,9 +231,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
231
|
version: 2.4.0
|
232
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- - "
|
234
|
+
- - ">"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
236
|
+
version: 1.3.1
|
237
237
|
requirements: []
|
238
238
|
rubygems_version: 3.0.6
|
239
239
|
signing_key:
|