relaton-gb 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaton_gb/scrapper.rb +16 -6
- data/lib/relaton_gb/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: 8675991461b657f6d624391f50115245029e999fc9ea076bef99e7f8bdeb3ece
|
4
|
+
data.tar.gz: d3eb20d7a6302ea10ada5732370972e631db752eb8febb592f75c96d5f030e67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa28fc07245bbc86dd03ce11c284ea30becb75287efd48a1621890d4180dc4338d28bbae928d49529acc6d834b169fd3c5a54292c7c5996cb89c7e5773d9c5aa
|
7
|
+
data.tar.gz: 60b54b035542086d2849f7781837c4a72530ac4f42fc55f451961497a71478853bead48ff7e1c04ee57ad8d34b54b4169c5ee145d0cb43042933ad6506c4d9a2
|
data/lib/relaton_gb/scrapper.rb
CHANGED
@@ -55,18 +55,28 @@ module RelatonGb
|
|
55
55
|
# @param docref [Strings]
|
56
56
|
# @return [Array<Hash>]
|
57
57
|
def get_contributors(doc, docref)
|
58
|
-
gb_en = GbAgencies::Agencies.new("en", {}, "")
|
59
|
-
gb_zh = GbAgencies::Agencies.new("zh", {}, "")
|
60
58
|
name = docref.match(/^[^\s]+/).to_s
|
61
59
|
name.sub!(%r{/[TZ]$}, "") unless name =~ /^GB/
|
62
60
|
gbtype = get_gbtype(doc, docref)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
61
|
+
orgs = %w[en zh].map { |l| org(l, name, gbtype) }.compact
|
62
|
+
return [] unless orgs.any?
|
63
|
+
|
64
|
+
entity = RelatonBib::Organization.new name: orgs
|
67
65
|
[{ entity: entity, role: [type: "publisher"] }]
|
68
66
|
end
|
69
67
|
|
68
|
+
# @param lang [String]
|
69
|
+
# @param name [String]
|
70
|
+
# @param gbtype [Hash]
|
71
|
+
# @return [Hash]
|
72
|
+
def org(lang, name, gbtype)
|
73
|
+
ag = GbAgencies::Agencies.new(lang, {}, "")
|
74
|
+
content = ag.standard_agency1(gbtype[:scope], name, gbtype[:mandate])
|
75
|
+
return unless content
|
76
|
+
|
77
|
+
{ language: lang, content: content }
|
78
|
+
end
|
79
|
+
|
70
80
|
# @param doc [Nokogiri::HTML::Document]
|
71
81
|
# @return [Array<Hash>]
|
72
82
|
# * :title_intro [String]
|
data/lib/relaton_gb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-gb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.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: 2020-05-
|
11
|
+
date: 2020-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debase
|