relaton-cen 1.20.1 → 1.20.2

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: 6b5494001b882408a35049aed09cac4cc3b865e6bb516066635670968b12db88
4
- data.tar.gz: 7c7ba2d4beb850f50311b3875f59913eae6b6ad54208c0832e38c97457bcd3f5
3
+ metadata.gz: 138f97cf5a761e41c5d9e38173a2930038fefa61950b220c9e5967c01f6cb89d
4
+ data.tar.gz: 45516da4516514dcaefb3714bbdefcf8bc779249fa675bb8ef51dcfa08088e08
5
5
  SHA512:
6
- metadata.gz: f892adf5399eb8ef93c51d0d56d04272b71674587ed873c0b4316151995faaf60cca7ccc349c4ce7703577887a68f382a1c8f37810f9b587b1e2cb6709771dc6
7
- data.tar.gz: f529f06753eb83fe79c22d2cf7fa7bdfaba94f678c69ff60e7ee6400da13077ab7e068385beb126ec0aaea72958379651edec4ee4bc1fcd8533fb185ecb7df63
6
+ metadata.gz: 0fc4b5e4e9ed4d13103b34e7208c9c15cdbbef82a54274ff7d6ef0b8cbe8a8a97773eb9d477d01f5109784af0d2bbc5bbe54c67f32eb870295f3b544c383e8e0
7
+ data.tar.gz: 70839a7adfc5ac3723b65f8142d84c6766bebfe84c07c74a30cddbdfb096ec138cb6dd7d8256cce43eb31e27d1e960844ac4917acb256e0bb8bb0bb0ba8f0213
@@ -9,7 +9,7 @@ module RelatonCen
9
9
  def search(text, year = nil)
10
10
  # /^C?EN\s(?<code>.+)/ =~ text
11
11
  HitCollection.new text, year
12
- rescue Mechanize::ResponseCodeError => e
12
+ rescue Mechanize::ResponseCodeError, Net::ReadTimeout => e
13
13
  raise RelatonBib::RequestError, e.message
14
14
  end
15
15
 
@@ -110,7 +110,7 @@ module RelatonCen
110
110
  Util.info "Found: `#{bib.docidentifier.first&.id}`", key: ref
111
111
  bib
112
112
  else
113
- Util.info "No found.", key: ref
113
+ Util.info "Not found.", key: ref
114
114
  fetch_ref_err(code, year, ret[:years])
115
115
  end
116
116
  end
@@ -3,7 +3,7 @@
3
3
  module RelatonCen
4
4
  # Page of hit collection.
5
5
  class HitCollection < RelatonBib::HitCollection
6
- DOMAIN = "https://standards.cencenelec.eu/dyn/www/"
6
+ DOMAIN = "https://standards.cencenelec.eu"
7
7
 
8
8
  # @return [Mechanize]
9
9
  attr_reader :agent
@@ -19,28 +19,35 @@ module RelatonCen
19
19
  return
20
20
  end
21
21
 
22
- search_page = agent.get "#{DOMAIN}f?p=205:105:0:::::"
23
- form = search_page.at "//form[@id='wwvFlowForm']"
24
- skip_inputs = %w[f11 essentialCookies]
25
- req_body = form.xpath(".//input").filter_map do |f|
26
- next if f[:name].empty? || skip_inputs.include?(f[:name])
22
+ redirect_page = agent.get DOMAIN
23
+ redirect_url = redirect_page.body.slice(/(?<=follow the <a href=')#{DOMAIN}[^']+/)
24
+ search_page = agent.get redirect_url
25
+ form = search_page.form_with(id: "wwvFlowForm")
26
+ ref_field = form.field_with(id: "STAND_REF")
27
+ ref_field.value = ref
28
+ resp = agent.submit form
27
29
 
28
- val = case f[:value]
29
- when "LANGUAGE_LIST" then 0
30
- when "STAND_REF" then CGI.escape(ref)
31
- else
32
- case f[:name]
33
- when "p_request" then "S1-S2-S3-S4-S5-S6-S7-CEN-CLC-"
34
- when "f10" then ""
35
- else f[:value]
36
- end
37
- end
38
- if f[:name] == "f10" then "f10=#{f[:value]}&f11=#{val}"
39
- else
40
- "#{f[:name]}=#{val}"
41
- end
42
- end.join("&")
43
- resp = agent.post form[:action], req_body
30
+ # form = search_page.at "//form[@id='wwvFlowForm']"
31
+ # skip_inputs = %w[f11 essentialCookies]
32
+ # req_body = form.xpath(".//input").filter_map do |f|
33
+ # next if f[:name].empty? || skip_inputs.include?(f[:name])
34
+
35
+ # val = case f[:value]
36
+ # when "LANGUAGE_LIST" then 0
37
+ # when "STAND_REF" then CGI.escape(ref)
38
+ # else
39
+ # case f[:name]
40
+ # when "p_request" then "S1-S2-S3-S4-S5-S6-S7-CEN-CLC-"
41
+ # when "f10" then ""
42
+ # else f[:value]
43
+ # end
44
+ # end
45
+ # if f[:name] == "f10" then "f10=#{f[:value]}&f11=#{val}"
46
+ # else
47
+ # "#{f[:name]}=#{val}"
48
+ # end
49
+ # end.join("&")
50
+ # resp = agent.post form[:action], req_body
44
51
  @array = hits resp
45
52
  sort
46
53
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonCen
4
- VERSION = "1.20.1"
4
+ VERSION = "1.20.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-cen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.1
4
+ version: 1.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-06 00:00:00.000000000 Z
11
+ date: 2026-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize