relaton-un 1.2.0 → 1.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bd7b73723491abfe38ea7c1018dbb1844114f5c22160dd11af15cd6a858e899
|
4
|
+
data.tar.gz: ef0e87e1c151a3affb21b16d3257b7d5a025fbbe81354749f1b21897532b4b9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8347b35ddab7041cf6c7478457731d9e76ae8e84acfb9bbe9d10e17fcec7cbe71aeb3f7ef2e35b979ceb544066c7c7a2ea302dde95796a092f1115391b97587c
|
7
|
+
data.tar.gz: 7b003c2eb2f8c3baa4110c01292d68d044a19359a30b297ee885080db0e979f587e59f7478733c15376de4dc4dad92a7c16d7292ef3fb92a76019808341210d9
|
data/lib/relaton_un/hit.rb
CHANGED
@@ -75,6 +75,7 @@ module RelatonUn
|
|
75
75
|
distribution: fetch_distribution,
|
76
76
|
editorialgroup: fetch_editorialgroup,
|
77
77
|
classification: fetch_classification,
|
78
|
+
job_number: hit[:job_number],
|
78
79
|
)
|
79
80
|
end
|
80
81
|
# rubocop:enable Metrics/MethodLength
|
@@ -88,11 +89,6 @@ module RelatonUn
|
|
88
89
|
|
89
90
|
# @return [Array<RelatonBib::TypedTitleString>]
|
90
91
|
def fetch_title
|
91
|
-
# fs = RelatonBib::FormattedString.new(
|
92
|
-
# content: hit[:title], language: "en", script: "Latn",
|
93
|
-
# )
|
94
|
-
# [RelatonBib::TypedTitleString.new(type: "main", title: fs)]
|
95
|
-
# [{ title_main: hit[:title], language: "en", script: "Latn" }]
|
96
92
|
RelatonBib::TypedTitleString.from_string hit[:title], "en", "Latn"
|
97
93
|
end
|
98
94
|
|
@@ -103,7 +103,8 @@ module RelatonUn
|
|
103
103
|
link: link(en),
|
104
104
|
session: session(item),
|
105
105
|
agenda: agenda(item),
|
106
|
-
distribution: distribution(item)
|
106
|
+
distribution: distribution(item),
|
107
|
+
job_number: job_number(item),
|
107
108
|
}
|
108
109
|
end
|
109
110
|
|
@@ -155,6 +156,10 @@ module RelatonUn
|
|
155
156
|
item.at("//label[.='Distribution:']/following-sibling::span")&.text
|
156
157
|
end
|
157
158
|
|
159
|
+
def job_number(item)
|
160
|
+
item.at("//span[contains(@id, 'cfJobNumE')]")&.text
|
161
|
+
end
|
162
|
+
|
158
163
|
# rubocop:disable Metrics/MethodLength
|
159
164
|
|
160
165
|
# @param req [Net::HTTP::Get, Net::HTTP::Post]
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module RelatonUn
|
2
2
|
class UnBibliographicItem < RelatonBib::BibliographicItem
|
3
|
+
include RelatonBib
|
4
|
+
|
3
5
|
TYPES = %w[
|
4
6
|
recommendation plenary addendum communication corrigendum reissue agenda
|
5
7
|
budgetary sec-gen-notes expert-report resolution
|
@@ -12,18 +14,23 @@ module RelatonUn
|
|
12
14
|
attr_reader :session
|
13
15
|
|
14
16
|
# @return [String, NilClass]
|
15
|
-
attr_reader :distribution
|
17
|
+
attr_reader :distribution, :job_number
|
18
|
+
|
19
|
+
# @return [Array<String>]
|
20
|
+
attr_reader :submissionlanguage
|
16
21
|
|
17
22
|
# @param session [RelatonUn::Session, NilClass]
|
18
|
-
# @param distribution [String]
|
23
|
+
# @param distribution [String, nil]
|
24
|
+
# @param job_number [String, nil]
|
19
25
|
def initialize(**args)
|
20
26
|
if args[:distribution] && !DISTRIBUTIONS.has_value?(args[:distribution])
|
21
27
|
warn "[relaton-un] WARNING: invalid distribution: #{args[:distribution]}"
|
22
28
|
end
|
29
|
+
@submissionlanguage = args.delete :submissionlanguage
|
23
30
|
@distribution = args.delete :distribution
|
24
31
|
@session = args.delete :session
|
32
|
+
@job_number = args.delete :job_number
|
25
33
|
super **args
|
26
|
-
# @doctype = args[:doctype]
|
27
34
|
end
|
28
35
|
|
29
36
|
# @param builder [Nokogiri::XML::Builder]
|
@@ -31,9 +38,13 @@ module RelatonUn
|
|
31
38
|
def to_xml(builder = nil, **opts)
|
32
39
|
super(builder, **opts) do |b|
|
33
40
|
b.ext do
|
41
|
+
b.doctype doctype if doctype
|
42
|
+
submissionlanguage&.each { |sl| b.submissionlanguage sl }
|
34
43
|
editorialgroup&.to_xml b
|
44
|
+
ics&.each { |i| i.to_xml b }
|
35
45
|
b.distribution distribution if distribution
|
36
46
|
session&.to_xml b if session
|
47
|
+
b.job_number job_number if job_number
|
37
48
|
end
|
38
49
|
end
|
39
50
|
end
|
@@ -41,7 +52,12 @@ module RelatonUn
|
|
41
52
|
# @return [Hash]
|
42
53
|
def to_hash
|
43
54
|
hash = super
|
55
|
+
if submissionlanguage&.any?
|
56
|
+
hash["submissionlanguage"] = single_element_array submissionlanguage
|
57
|
+
end
|
58
|
+
hash["distribution"] = distribution if distribution
|
44
59
|
hash["session"] = session.to_hash if session
|
60
|
+
hash["job_number"] = job_number if job_number
|
45
61
|
hash
|
46
62
|
end
|
47
63
|
end
|
data/lib/relaton_un/version.rb
CHANGED
@@ -13,19 +13,22 @@ module RelatonUn
|
|
13
13
|
# @return [Hash]
|
14
14
|
def item_data(item)
|
15
15
|
data = super
|
16
|
-
|
17
|
-
data
|
16
|
+
ext = item.at "./ext"
|
17
|
+
return data unless ext
|
18
|
+
|
19
|
+
data[:submissionlanguage] = fetch_submissionlanguage ext
|
20
|
+
data[:session] = fetch_session ext
|
21
|
+
data[:distribution] = ext.at("distribution")&.text
|
22
|
+
data[:job_number] = ext.at("job_number")&.text
|
18
23
|
data
|
19
24
|
end
|
20
25
|
|
21
26
|
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
22
27
|
|
23
|
-
# @param
|
28
|
+
# @param ext [Nokogiri::XML::Element]
|
24
29
|
# @return [RelatonUn::Session]
|
25
|
-
def fetch_session(
|
26
|
-
session =
|
27
|
-
return unless session
|
28
|
-
|
30
|
+
def fetch_session(ext)
|
31
|
+
session = ext.at "./session"
|
29
32
|
RelatonUn::Session.new(
|
30
33
|
session_number: session.at("number")&.text,
|
31
34
|
session_date: session.at("session-date")&.text,
|
@@ -45,9 +48,15 @@ module RelatonUn
|
|
45
48
|
eg = ext.at("./editorialgroup")
|
46
49
|
return unless eg
|
47
50
|
|
48
|
-
committee = eg
|
51
|
+
committee = eg.xpath("committee").map &:text
|
49
52
|
EditorialGroup.new committee
|
50
53
|
end
|
54
|
+
|
55
|
+
# @param ext [Nokogiri::XML::Element]
|
56
|
+
# @return [Array<String>]
|
57
|
+
def fetch_submissionlanguage(ext)
|
58
|
+
ext.xpath("./submissionlanguage").map(&:text)
|
59
|
+
end
|
51
60
|
end
|
52
61
|
end
|
53
62
|
end
|
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.2.
|
4
|
+
version: 1.2.1
|
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-06-
|
11
|
+
date: 2020-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debase
|