relaton-omg 1.16.0 → 1.16.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/lib/relaton_omg/config.rb +10 -0
- data/lib/relaton_omg/omg_bibliography.rb +8 -1
- data/lib/relaton_omg/scrapper.rb +3 -6
- data/lib/relaton_omg/util.rb +9 -0
- data/lib/relaton_omg/version.rb +1 -1
- data/lib/relaton_omg.rb +7 -5
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68a04e76b6f9b7e0262d94edad9b9f419940e78e6dd983cfa6707f8142cfec90
|
|
4
|
+
data.tar.gz: 6e8d87f0e245b545f55dc2c329cbc8801e29555317630134446f49f0532a4fc1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 73fe10dc67e851fb68219c56c8254a82b56b080e1b1608bb9ad4e396a6dcbfc2cf31ba4db40247fd80f4a3d5a6a13bd4ec6fa4cc3f7a270b7a93fbd61783eee4
|
|
7
|
+
data.tar.gz: c5d8eada8199773bd6711094e11a70ea8fb42c13f0531c6b75064a80f5f6f106f02b0446d8eb1f42213664962891ec2f10e045d35158afa9eff293e2e19adb2d
|
|
@@ -15,7 +15,14 @@ module RelatonOmg
|
|
|
15
15
|
# @param opts [Hash] options
|
|
16
16
|
# @return [RelatonOmg::OmgBibliographicItem]
|
|
17
17
|
def get(code, _year = nil, _opts = {})
|
|
18
|
-
|
|
18
|
+
Util.warn "(#{code}) fetching from OMG website..."
|
|
19
|
+
result = search code
|
|
20
|
+
if result
|
|
21
|
+
Util.warn "(#{code}) found `#{result.docidentifier.first.id}`"
|
|
22
|
+
else
|
|
23
|
+
Util.warn "(#{code}) no document found"
|
|
24
|
+
end
|
|
25
|
+
result
|
|
19
26
|
end
|
|
20
27
|
end
|
|
21
28
|
end
|
data/lib/relaton_omg/scrapper.rb
CHANGED
|
@@ -14,12 +14,9 @@ module RelatonOmg
|
|
|
14
14
|
doc = Nokogiri::HTML OpenURI.open_uri(url, open_timeout: 10)
|
|
15
15
|
OmgBibliographicItem.new(**item(doc, acronym))
|
|
16
16
|
rescue OpenURI::HTTPError, URI::InvalidURIError, Net::OpenTimeout => e
|
|
17
|
-
if e.is_a?(URI::InvalidURIError) || e.io.status[0] == "404"
|
|
18
|
-
warn %{[relaton-omg] no document found for "#{ref}" reference.}
|
|
19
|
-
return
|
|
20
|
-
end
|
|
17
|
+
return if e.is_a?(URI::InvalidURIError) || e.io.status[0] == "404"
|
|
21
18
|
|
|
22
|
-
raise RelatonBib::RequestError, "Unable acces #{url} (#{e.io.status.join(
|
|
19
|
+
raise RelatonBib::RequestError, "Unable acces #{url} (#{e.io.status.join(' ')}"
|
|
23
20
|
end
|
|
24
21
|
|
|
25
22
|
private
|
|
@@ -121,4 +118,4 @@ module RelatonOmg
|
|
|
121
118
|
end
|
|
122
119
|
end
|
|
123
120
|
end
|
|
124
|
-
end
|
|
121
|
+
end
|
data/lib/relaton_omg/version.rb
CHANGED
data/lib/relaton_omg.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
require "nokogiri"
|
|
2
2
|
require "relaton_bib"
|
|
3
3
|
require "relaton_omg/version"
|
|
4
|
+
require "relaton_omg/config"
|
|
5
|
+
require "relaton_omg/util"
|
|
4
6
|
require "relaton_omg/scrapper"
|
|
5
7
|
require "relaton_omg/omg_bibliography"
|
|
6
8
|
require "relaton_omg/omg_bibliographic_item"
|
|
@@ -11,9 +13,9 @@ module RelatonOmg
|
|
|
11
13
|
# Returns hash of XML reammar
|
|
12
14
|
# @return [String]
|
|
13
15
|
def self.grammar_hash
|
|
14
|
-
gem_path = File.expand_path "..", __dir__
|
|
15
|
-
grammars_path = File.join gem_path, "grammars", "*"
|
|
16
|
-
grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
|
17
|
-
Digest::MD5.hexdigest grammars
|
|
16
|
+
# gem_path = File.expand_path "..", __dir__
|
|
17
|
+
# grammars_path = File.join gem_path, "grammars", "*"
|
|
18
|
+
# grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
|
19
|
+
Digest::MD5.hexdigest RelatonOmg::VERSION + RelatonBib::VERSION # grammars
|
|
18
20
|
end
|
|
19
|
-
end
|
|
21
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-omg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.16.
|
|
4
|
+
version: 1.16.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: 2023-09-
|
|
11
|
+
date: 2023-09-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: relaton-bib
|
|
@@ -51,11 +51,13 @@ files:
|
|
|
51
51
|
- grammars/relaton-omg-compile.rng
|
|
52
52
|
- grammars/relaton-omg.rng
|
|
53
53
|
- lib/relaton_omg.rb
|
|
54
|
+
- lib/relaton_omg/config.rb
|
|
54
55
|
- lib/relaton_omg/hash_converter.rb
|
|
55
56
|
- lib/relaton_omg/omg_bibliographic_item.rb
|
|
56
57
|
- lib/relaton_omg/omg_bibliography.rb
|
|
57
58
|
- lib/relaton_omg/processor.rb
|
|
58
59
|
- lib/relaton_omg/scrapper.rb
|
|
60
|
+
- lib/relaton_omg/util.rb
|
|
59
61
|
- lib/relaton_omg/version.rb
|
|
60
62
|
- lib/relaton_omg/xml_parser.rb
|
|
61
63
|
- relaton_omg.gemspec
|