relaton-un 1.16.1 → 1.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +14 -3
- data/lib/relaton_un/hit_collection.rb +3 -3
- data/lib/relaton_un/un_bibliographic_item.rb +1 -1
- data/lib/relaton_un/un_bibliography.rb +3 -3
- data/lib/relaton_un/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be81c113682d65c26375bc01785feb1081d04f0b127046c6e58faa24dfe7754b
|
4
|
+
data.tar.gz: 0b5e84ea07955fee78f7b8ac57c95551940b0cceb41103b2891c6fdf7129dc5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75b2052a163ec18d01a2ed7747846d20346a066c69e4aa57d07be3fb4134b2ccbdf7fa483551ea4514fe95e50ad32615f66d1557a4e909da66157bc1c5f5cff0
|
7
|
+
data.tar.gz: 11ec5a1d7a1a4bb4759edbbee5005b9c187b06417507a652dfb61d89ae66cf18e32e095eb35425d23a05cfc9bb828196abb4c72c0aeee73dce279e31b964bc95
|
data/README.adoc
CHANGED
@@ -23,13 +23,24 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
== Usage
|
25
25
|
|
26
|
-
===
|
26
|
+
=== Configuration
|
27
|
+
|
28
|
+
Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonUn.configure` block.
|
27
29
|
|
28
30
|
[source,ruby]
|
29
31
|
----
|
30
32
|
require 'relaton_un'
|
31
33
|
=> true
|
32
34
|
|
35
|
+
RelatonUn.configure do |config|
|
36
|
+
config.logger.level = Logger::DEBUG
|
37
|
+
end
|
38
|
+
----
|
39
|
+
|
40
|
+
=== Search for a standard using keywords
|
41
|
+
|
42
|
+
[source,ruby]
|
43
|
+
----
|
33
44
|
hits = RelatonUn::UnBibliography.search("TRADE/CEFACT/2004/32")
|
34
45
|
=> <RelatonUn::HitCollection:0x007fc4e6ec2018 @ref=TRADE/CEFACT/2004/32 @fetched=false>
|
35
46
|
|
@@ -69,8 +80,8 @@ item.to_xml bibdata: true
|
|
69
80
|
[source,ruby]
|
70
81
|
----
|
71
82
|
RelatonUn::UnBibliography.get "UN TRADE/CEFACT/2004/32"
|
72
|
-
[relaton-un] (
|
73
|
-
[relaton-un] (
|
83
|
+
[relaton-un] (UN TRADE/CEFACT/2004/32) Fetching from documents.un.org ...
|
84
|
+
[relaton-un] (UN TRADE/CEFACT/2004/32) Found: `TRADE/CEFACT/2004/32`
|
74
85
|
=> #<RelatonUn::UnBibliographicItem:0x007fdc5f1c3a20
|
75
86
|
...
|
76
87
|
----
|
@@ -6,13 +6,13 @@ require "http-cookie"
|
|
6
6
|
module RelatonUn
|
7
7
|
# Page of hit collection.
|
8
8
|
class HitCollection < RelatonBib::HitCollection
|
9
|
-
AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) "\
|
10
|
-
|
9
|
+
AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 " \
|
10
|
+
"(KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"
|
11
11
|
DOMAIN = "https://documents.un.org"
|
12
12
|
BOUNDARY = "----WebKitFormBoundaryVarT9Z7AFUzw2lma"
|
13
13
|
|
14
14
|
# @param text [String] reference to search
|
15
|
-
def initialize(text) # rubocop:disable Metrics/AbcSize
|
15
|
+
def initialize(text) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
16
16
|
super
|
17
17
|
@uri = URI.parse DOMAIN
|
18
18
|
@jar = HTTP::CookieJar.new
|
@@ -24,7 +24,7 @@ module RelatonUn
|
|
24
24
|
# @param job_number [String, nil]
|
25
25
|
def initialize(**args)
|
26
26
|
if args[:distribution] && !DISTRIBUTIONS.has_value?(args[:distribution])
|
27
|
-
Util.warn "WARNING:
|
27
|
+
Util.warn "WARNING: Invalid distribution: `#{args[:distribution]}`"
|
28
28
|
end
|
29
29
|
@submissionlanguage = args.delete :submissionlanguage
|
30
30
|
@distribution = args.delete :distribution
|
@@ -21,14 +21,14 @@ module RelatonUn
|
|
21
21
|
# @param opts [Hash] options
|
22
22
|
# @return [RelatonUn::UnBibliographicItem]
|
23
23
|
def get(ref, _year = nil, _opts = {})
|
24
|
-
Util.warn "(#{ref})
|
24
|
+
Util.warn "(#{ref}) Fetching from documents.un.org ..."
|
25
25
|
/^(?:UN\s)?(?<code>.*)/ =~ ref
|
26
26
|
result = isobib_search_filter(code)
|
27
27
|
if result
|
28
|
-
Util.warn "(#{ref})
|
28
|
+
Util.warn "(#{ref}) Found: `#{result.fetch.docidentifier[0].id}`"
|
29
29
|
result.fetch
|
30
30
|
else
|
31
|
-
Util.warn "(#{ref})
|
31
|
+
Util.warn "(#{ref}) Not found."
|
32
32
|
nil
|
33
33
|
end
|
34
34
|
end
|
data/lib/relaton_un/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-un
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
4
|
+
version: 1.16.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: 2023-
|
11
|
+
date: 2023-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|