relaton-un 1.2.1 → 1.3.0

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: 4bd7b73723491abfe38ea7c1018dbb1844114f5c22160dd11af15cd6a858e899
4
- data.tar.gz: ef0e87e1c151a3affb21b16d3257b7d5a025fbbe81354749f1b21897532b4b9c
3
+ metadata.gz: 613a9a82547cda0760295b57949e565c868f3fd2b660a7f7d813ba6e224a00b8
4
+ data.tar.gz: 5aa7797780314ab7887b540fb84105a0dccab4a36f1c5fabcf5f814e70d4b2e8
5
5
  SHA512:
6
- metadata.gz: 8347b35ddab7041cf6c7478457731d9e76ae8e84acfb9bbe9d10e17fcec7cbe71aeb3f7ef2e35b979ceb544066c7c7a2ea302dde95796a092f1115391b97587c
7
- data.tar.gz: 7b003c2eb2f8c3baa4110c01292d68d044a19359a30b297ee885080db0e979f587e59f7478733c15376de4dc4dad92a7c16d7292ef3fb92a76019808341210d9
6
+ metadata.gz: 4bf072e67d014ac53bc8a95650a87fcd079420cf93fe2b47ab051a6c41b406b5e75d45127b5d6ba8bab3a6c9279604aee9a059b620c4bc167659f19eb502fcbf
7
+ data.tar.gz: 8d17af6fa62c494921521a3a4ce417f0fd604ce560949a587d1b37db1230d8a889cfdb831fcd0cef78bdbc676b594680abc51a75e06f67befb464b81756c1d8e
@@ -29,4 +29,5 @@ jobs:
29
29
  bundle install --jobs 4 --retry 3
30
30
  - name: Run specs
31
31
  run: |
32
+ unset JAVA_TOOL_OPTIONS
32
33
  bundle exec rake
@@ -5,6 +5,6 @@
5
5
  inherit_from:
6
6
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
7
  AllCops:
8
- TargetRubyVersion: 2.3
8
+ TargetRubyVersion: 2.4
9
9
  Rails:
10
- Enabled: true
10
+ Enabled: false
@@ -21,5 +21,13 @@ module RelatonUn
21
21
  def to_hash
22
22
  single_element_array(committee.map { |c| { "committee" => c } })
23
23
  end
24
+
25
+ # @param prefix [String]
26
+ # @return [String]
27
+ def to_asciibib(prefix)
28
+ pref = prefix.empty? ? prefix : prefix + "."
29
+ pref += "editorialgroup"
30
+ committee.map { |c| "#{pref}.committee:: #{c}\n" }.join
31
+ end
24
32
  end
25
33
  end
@@ -59,7 +59,7 @@ module RelatonUn
59
59
  # rubocop:disable Metrics/MethodLength
60
60
 
61
61
  # @return [RelatonUn::UnBibliographicItem]
62
- def un_bib_item
62
+ def un_bib_item # rubocop:disable Metrics/AbcSize
63
63
  UnBibliographicItem.new(
64
64
  type: "standard",
65
65
  fetched: Date.today.to_s,
@@ -75,7 +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
+ job_number: hit[:job_number]
79
79
  )
80
80
  end
81
81
  # rubocop:enable Metrics/MethodLength
@@ -131,7 +131,7 @@ module RelatonUn
131
131
  def fetch_editorialgroup
132
132
  tc = hit[:ref].match(/^[\S]+/).to_s.split(/\/|-/).reduce([]) do |m, v|
133
133
  if BODY[v] then m << BODY[v]
134
- elsif v =~ /(AC|C|CN|CONF|GC|SC|Sub|WG).\d+|PC/ then m << v
134
+ elsif v.match? /(AC|C|CN|CONF|GC|SC|Sub|WG).\d+|PC/ then m << v
135
135
  else m
136
136
  end
137
137
  end.uniq
@@ -48,12 +48,12 @@ module RelatonUn
48
48
  # @param form [Nokogiri::HTML::Document]
49
49
  # @param text [String]
50
50
  # @return [Array<String>]
51
- def form_data(form, text)
51
+ def form_data(form, text) # rubocop:disable Metrics/CyclomaticComplexity
52
52
  fd = form.xpath(
53
53
  "//input[@type!='radio']",
54
54
  "//input[@type='radio'][@checked]",
55
55
  "//select[@name!='view:_id1:_id2:cbLang']",
56
- "//textarea",
56
+ "//textarea"
57
57
  ).reduce([]) do |m, i|
58
58
  v = case i[:name]
59
59
  when "view:_id1:_id2:txtSymbol" then text
@@ -91,7 +91,7 @@ module RelatonUn
91
91
 
92
92
  # @param item [Nokogiri::XML::Element]
93
93
  # @return [Hash]
94
- def hit_data(item)
94
+ def hit_data(item) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
95
95
  en = item.at("//span[.='ENGLISH']/../..")
96
96
  {
97
97
  ref: item.at("div/div/a")&.text&.sub("\u00A0", ""),
@@ -3,7 +3,7 @@ module RelatonUn
3
3
  include RelatonBib
4
4
 
5
5
  # @return [String, NilClass]
6
- attr_reader :session_number, :collaboration, :agenda_id, :item_footnote
6
+ attr_reader :session_number, :collaborator, :agenda_id, :item_footnote
7
7
 
8
8
  # @return [Date, NilClass]
9
9
  attr_reader :session_date
@@ -16,7 +16,7 @@ module RelatonUn
16
16
  # @param item_number [Array<String>]
17
17
  # @pqrqm item_name [Array<String>]
18
18
  # @pqrqm subitem_name [Array<String>]
19
- # @param collaboration [String]
19
+ # @param collaborator [String]
20
20
  # @param agenda_id [String]
21
21
  # @param item_footnote [String]
22
22
  def initialize(**args)
@@ -25,12 +25,12 @@ module RelatonUn
25
25
  @item_number = args.fetch(:item_number, [])
26
26
  @item_name = args.fetch(:item_name, [])
27
27
  @subitem_name = args.fetch(:subitem_name, [])
28
- @collaboration = args[:collaboration]
28
+ @collaborator = args[:collaborator]
29
29
  @agenda_id = args[:agenda_id]
30
30
  @item_footnote = args[:item_footnote]
31
31
  end
32
32
 
33
- # rubocop:disable Metrics/AbcSize
33
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize
34
34
 
35
35
  # @param [Nokogiri::XML::Builder]
36
36
  def to_xml(builder)
@@ -40,26 +40,48 @@ module RelatonUn
40
40
  item_number.each { |n| b.send "item-number", n }
41
41
  item_name.each { |n| b.send "item-name", n }
42
42
  subitem_name.each { |n| b.send "subitem-name", n }
43
- b.collaboration collaboration if collaboration
43
+ b.collaborator collaborator if collaborator
44
44
  b.send "agenda-id", agenda_id if agenda_id
45
45
  b.send "item-footnote", item_footnote if item_footnote
46
46
  end
47
47
  end
48
48
 
49
- # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
49
+ # rubocop:disable Metrics/PerceivedComplexity, Metrics/MethodLength
50
50
  # @return [Hash]
51
51
  def to_hash
52
52
  hash = {}
53
53
  hash["session_number"] = session_number if session_number
54
54
  hash["session_date"] = session_date.to_s if session_date
55
- hash["item_number"] = single_element_array(item_number) if item_number.any?
55
+ if item_number.any?
56
+ hash["item_number"] = single_element_array(item_number)
57
+ end
56
58
  hash["item_name"] = single_element_array(item_name) if item_name.any?
57
- hash["subitem_name"] = single_element_array(subitem_name) if subitem_name.any?
58
- hash["collaboration"] = collaboration if collaboration
59
+ if subitem_name.any?
60
+ hash["subitem_name"] = single_element_array(subitem_name)
61
+ end
62
+ hash["collaborator"] = collaborator if collaborator
59
63
  hash["agenda_id"] = agenda_id if agenda_id
60
64
  hash["item_footnote"] = item_footnote if item_footnote
61
65
  hash
62
66
  end
63
- # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
67
+ # rubocop:enable Metrics/PerceivedComplexity
68
+
69
+ # @param prefix [String]
70
+ # @return [String]
71
+ def to_asciibib(prefix = "")
72
+ pref = prefix.empty? ? prefix : prefix + "."
73
+ pref += "session"
74
+ out = ""
75
+ out += "#{pref}.session_number:: #{session_number}\n" if session_number
76
+ out += "#{pref}.session_date:: #{session_date}\n" if session_date
77
+ item_number.each { |n| out += "#{pref}.item_number:: #{n}\n" }
78
+ item_name.each { |n| out += "#{pref}.item_name:: #{n}\n" }
79
+ subitem_name.each { |n| out += "#{pref}.subitem_name:: #{n}\n" }
80
+ out += "#{pref}.collaborator:: #{collaborator}\n" if collaborator
81
+ out += "#{pref}.agenda_id:: #{agenda_id}\n" if agenda_id
82
+ out += "#{pref}.item_footnote:: #{item_footnote}\n" if item_footnote
83
+ out
84
+ end
85
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength
64
86
  end
65
87
  end
@@ -24,7 +24,8 @@ 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
- warn "[relaton-un] WARNING: invalid distribution: #{args[:distribution]}"
27
+ warn "[relaton-un] WARNING: invalid distribution: "\
28
+ "#{args[:distribution]}"
28
29
  end
29
30
  @submissionlanguage = args.delete :submissionlanguage
30
31
  @distribution = args.delete :distribution
@@ -35,7 +36,7 @@ module RelatonUn
35
36
 
36
37
  # @param builder [Nokogiri::XML::Builder]
37
38
  # @param bibdata [TrueClasss, FalseClass, NilClass]
38
- def to_xml(builder = nil, **opts)
39
+ def to_xml(builder = nil, **opts) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
39
40
  super(builder, **opts) do |b|
40
41
  b.ext do
41
42
  b.doctype doctype if doctype
@@ -60,5 +61,19 @@ module RelatonUn
60
61
  hash["job_number"] = job_number if job_number
61
62
  hash
62
63
  end
64
+
65
+ # @param prefix [String]
66
+ # @return [String]
67
+ def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize
68
+ pref = prefix.empty? ? prefix : prefix + "."
69
+ out = super
70
+ submissionlanguage.each do |sl|
71
+ out += "#{pref}submissionlanguage:: #{sl}\n"
72
+ end
73
+ out += "#{pref}distribution:: #{distribution}\n" if distribution
74
+ out += session.to_asciibib prefix if session
75
+ out += "#{pref}job_number:: #{job_number}\n" if job_number
76
+ out
77
+ end
63
78
  end
64
79
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonUn
2
- VERSION = "1.2.1".freeze
2
+ VERSION = "1.3.0".freeze
3
3
  end
@@ -27,7 +27,7 @@ module RelatonUn
27
27
 
28
28
  # @param ext [Nokogiri::XML::Element]
29
29
  # @return [RelatonUn::Session]
30
- def fetch_session(ext)
30
+ def fetch_session(ext) # rubocop:disable Metrics/CyclomaticComplexity
31
31
  session = ext.at "./session"
32
32
  RelatonUn::Session.new(
33
33
  session_number: session.at("number")&.text,
@@ -35,9 +35,9 @@ module RelatonUn
35
35
  item_number: session.xpath("item-number").map(&:text),
36
36
  item_name: session.xpath("item-name").map(&:text),
37
37
  subitem_name: session.xpath("subitem-name").map(&:text),
38
- collaboration: session.at("collaboration")&.text,
38
+ collaborator: session.at("collaborator")&.text,
39
39
  agenda_id: session.at("agenda-id")&.text,
40
- item_footnote: session.at("item-footnote")&.text,
40
+ item_footnote: session.at("item-footnote")&.text
41
41
  )
42
42
  end
43
43
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
43
43
 
44
44
  spec.add_dependency "faraday"
45
45
  spec.add_dependency "http-cookie"
46
- spec.add_dependency "relaton-bib", "~> 1.2.0"
46
+ spec.add_dependency "relaton-bib", "~> 1.3.0"
47
47
  spec.add_dependency "unf_ext", ">= 0.0.7.7"
48
48
  end
49
49
  # rubocop:enable Metrics/BlockLength
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.1
4
+ version: 1.3.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-06-27 00:00:00.000000000 Z
11
+ date: 2020-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.2.0
159
+ version: 1.3.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: 1.2.0
166
+ version: 1.3.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: unf_ext
169
169
  requirement: !ruby/object:Gem::Requirement