relaton-itu 0.3.0 → 0.3.1
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 +4 -4
- data/Gemfile.lock +3 -3
- data/README.adoc +16 -0
- data/lib/relaton_itu/editorial_group.rb +6 -6
- data/lib/relaton_itu/hash_converter.rb +26 -0
- data/lib/relaton_itu/itu_bibliography.rb +1 -0
- data/lib/relaton_itu/itu_group.rb +2 -2
- data/lib/relaton_itu/scrapper.rb +1 -1
- data/lib/relaton_itu/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa06401d8a01fbeec3a0debc94dd6adf35c41dc9
|
4
|
+
data.tar.gz: 8fb8d5554c349fe7dcbc0f1e8e3d4b0f91b0ec2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83d8e30cc9b7cdaca1eb04fb85d2d4634a807525fd1d5e8866fb5a492ad11b443b04ffa3eaf7380591097e34cef2a75274dd6b59a5b42584569beac6cf4d7b81
|
7
|
+
data.tar.gz: dabf910e6a85a08362dd796f640ccbe75027aa977d3dacb5ccb70705a4d15b32a95fc5f705b1d0280cb36320f12af5403b291b62388948314369e3c2ee99f991
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
relaton-itu (0.3.
|
4
|
+
relaton-itu (0.3.1)
|
5
5
|
relaton-iso-bib (~> 0.3.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -35,10 +35,10 @@ GEM
|
|
35
35
|
pry (~> 0.10)
|
36
36
|
public_suffix (3.1.1)
|
37
37
|
rake (10.5.0)
|
38
|
-
relaton-bib (0.3.
|
38
|
+
relaton-bib (0.3.2)
|
39
39
|
addressable
|
40
40
|
nokogiri (~> 1.10)
|
41
|
-
relaton-iso-bib (0.3.
|
41
|
+
relaton-iso-bib (0.3.2)
|
42
42
|
isoics (~> 0.1.6)
|
43
43
|
relaton-bib (~> 0.3.0)
|
44
44
|
ruby_deep_clone (~> 0.8.0)
|
data/README.adoc
CHANGED
@@ -143,6 +143,22 @@ fetching ITU-T L.163...
|
|
143
143
|
...
|
144
144
|
----
|
145
145
|
|
146
|
+
=== Create bibliographic item form YAML
|
147
|
+
[source,ruby]
|
148
|
+
----
|
149
|
+
hash = YAML.load_file 'spec/examples/itu_bib_item.yml'
|
150
|
+
=> {"id"=>"ITU-T L.163 (11/2018)",
|
151
|
+
...
|
152
|
+
|
153
|
+
bib_hash = RelatonItu::HashConverter.hash_to_bib hash
|
154
|
+
=> {:id=>"ITU-T L.163 (11/2018)",
|
155
|
+
...
|
156
|
+
|
157
|
+
RelatonItu::ItuBibliographicItem.new bib_hash
|
158
|
+
=> #<RelatonItu::ItuBibliographicItem:0x007fd88ac02aa0
|
159
|
+
...
|
160
|
+
----
|
161
|
+
|
146
162
|
== Development
|
147
163
|
|
148
164
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -12,16 +12,16 @@ module RelatonItu
|
|
12
12
|
attr_reader :subgroup, :workgroup
|
13
13
|
|
14
14
|
# @param bureau [String]
|
15
|
-
# @param group [RelatonItu::ItuGroup]
|
16
|
-
# @param subgroup [RelatonItu::ItuGroup, NilClass]
|
17
|
-
# @param workgroup [RelatonItu::ItuGroup, NilClass]
|
15
|
+
# @param group [Hash, RelatonItu::ItuGroup]
|
16
|
+
# @param subgroup [Hash, RelatonItu::ItuGroup, NilClass]
|
17
|
+
# @param workgroup [Hash, RelatonItu::ItuGroup, NilClass]
|
18
18
|
def initialize(bureau:, group:, subgroup: nil, workgroup: nil)
|
19
19
|
raise ArgumentError, "invalid bureau: #{bureau}" unless BUREAUS.include? bureau
|
20
20
|
|
21
21
|
@bureau = bureau
|
22
|
-
@group = group
|
23
|
-
@subgroup = subgroup
|
24
|
-
@workgroup = workgroup
|
22
|
+
@group = group.is_a?(Hash) ? ItuGroup.new(group) : group
|
23
|
+
@subgroup = subgroup.is_a?(Hash) ? ItuGroup.new(subgroup) : subgroup
|
24
|
+
@workgroup = workgroup.is_a?(Hash) ? ItuGroup.new(workgroup) : workgroup
|
25
25
|
end
|
26
26
|
|
27
27
|
# @param builder [Nokogiri::XML::Builder]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module RelatonItu
|
2
|
+
class HashConverter < RelatonIsoBib::HashConverter
|
3
|
+
class << self
|
4
|
+
# @override RelatonBib::HashConverter.hash_to_bib
|
5
|
+
# @param args [Hash]
|
6
|
+
# @param nested [TrueClass, FalseClass]
|
7
|
+
# @return [Hash]
|
8
|
+
# def hash_to_bib(args, nested = false)
|
9
|
+
# ret = super
|
10
|
+
# return if ret.nil?
|
11
|
+
|
12
|
+
# doctype_hash_to_bib(ret)
|
13
|
+
# ret
|
14
|
+
# end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def editorialgroup_hash_to_bib(ret)
|
19
|
+
eg = ret[:editorialgroup]
|
20
|
+
return unless eg
|
21
|
+
|
22
|
+
ret[:editorialgroup] = EditorialGroup.new eg
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -37,7 +37,7 @@ module RelatonItu
|
|
37
37
|
# @param type [String, NilClass]
|
38
38
|
# @param name [String]
|
39
39
|
# @param acronym [String, NilClass]
|
40
|
-
# @param period [RelatonItu::ItuGroup::Period, NilClass]
|
40
|
+
# @param period [Hash, RelatonItu::ItuGroup::Period, NilClass]
|
41
41
|
def initialize(type: nil, name:, acronym: nil, period: nil)
|
42
42
|
if type && !TYPES.include?(type)
|
43
43
|
raise ArgumentError, "invalid type: #{type}"
|
@@ -46,7 +46,7 @@ module RelatonItu
|
|
46
46
|
@type = type
|
47
47
|
@name = name
|
48
48
|
@acronym = acronym
|
49
|
-
@period = period
|
49
|
+
@period = period.is_a?(Hash) ? Period.new(period) : period
|
50
50
|
end
|
51
51
|
|
52
52
|
# @param builder [Nokogiri::XML::Builder]
|
data/lib/relaton_itu/scrapper.rb
CHANGED
@@ -278,7 +278,7 @@ module RelatonItu
|
|
278
278
|
name = "International Telecommunication Union"
|
279
279
|
url = "www.itu.int"
|
280
280
|
end
|
281
|
-
[{ entity: { name: name, url: url, abbreviation: abbrev }, role: ["publisher"] }]
|
281
|
+
[{ entity: { name: name, url: url, abbreviation: abbrev }, role: [type: "publisher"] }]
|
282
282
|
end
|
283
283
|
|
284
284
|
# Fetch ICS.
|
data/lib/relaton_itu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-itu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.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: 2019-
|
11
|
+
date: 2019-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -188,6 +188,7 @@ files:
|
|
188
188
|
- lib/relaton/processor.rb
|
189
189
|
- lib/relaton_itu.rb
|
190
190
|
- lib/relaton_itu/editorial_group.rb
|
191
|
+
- lib/relaton_itu/hash_converter.rb
|
191
192
|
- lib/relaton_itu/hit.rb
|
192
193
|
- lib/relaton_itu/hit_collection.rb
|
193
194
|
- lib/relaton_itu/itu_bibliographic_item.rb
|