relaton-iho 1.14.0 → 1.14.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: 4d01d422a7d0b04520ca42375a62fbd2e1dfdedaf6ce67c1f10fab2750607b2a
4
- data.tar.gz: 41ba50e867c5655ed1094f22b5b47a4ac4a47b4c5ce7a1012290cc556968ca14
3
+ metadata.gz: 940290660744c08549c90e2f28aa593c809ac0621d312a89047c249630b92da3
4
+ data.tar.gz: e22ece93142456284a0419b0ecb9d88fc8b3da64b449a2a8b4b535b407bddb1c
5
5
  SHA512:
6
- metadata.gz: 30427e3902880f4dfc2973cfebe63285606e89daa0a0515cf8c4a5ceb299112bca795cba6d8a4143b4a6573574aec8625395b9552702985187e41be3a0491d01
7
- data.tar.gz: 9218aea85733e22afbb9f9ea537d63ccb60f3a95d5c7aba880cfcd9273bdfaabb74e3b5038c93d4e0c2b56b9d7082b931bb91b5fe95866ff113c29c3eecbe751
6
+ metadata.gz: 5be56d9a8af28df3f02489c954c40005beb54424d1410250f23d989ae9b6ef9e64ee8acd33a60e898416407bf9c52f4be108bfa0e9c8a18c04ec5e5360097a34
7
+ data.tar.gz: 4940eec0bb2191fcd3de1300b4af177c9d877f1b907897cc106c6d8c83af3d6aa04cdb3cfc22118b21dc2f041695866d96fc483016d8154a18f5207040c2af4a
data/Gemfile CHANGED
@@ -4,3 +4,9 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in relaton_iho.gemspec
6
6
  gemspec
7
+
8
+ gem "byebug"
9
+ gem "ruby-jing"
10
+ gem "simplecov"
11
+ gem "vcr"
12
+ gem "webmock"
@@ -2,16 +2,25 @@ require "net/http"
2
2
 
3
3
  module RelatonIho
4
4
  class IhoBibliography
5
- ENDPOINT = "https://raw.githubusercontent.com/relaton/relaton-data-iho/"\
6
- "master/data/".freeze
5
+ ENDPOINT = "https://raw.githubusercontent.com/relaton/relaton-data-iho/" \
6
+ "master/".freeze
7
7
 
8
8
  class << self
9
- # @param text [String]
10
- # @return [RelatonIho::IhoBibliographicItem]
9
+ #
10
+ # Search for IHO standard by IHO standard Code
11
+ #
12
+ # @param text [String] the IHO standard Code to look up (e..g "IHO B-11")
13
+ #
14
+ # @return [RelatonIho::IhoBibliographicItem, nil] the IHO standard or nil if not found
15
+ #
11
16
  def search(text, _year = nil, _opts = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
12
17
  warn "[relaton-iho] (\"#{text}\") fetching..."
13
- ref = text.sub(/^IHO\s/, "").downcase.sub(/^([[:alpha:]]+)(\d+)/, '\1-\2')
14
- uri = URI("#{ENDPOINT}#{ref}.yaml")
18
+ ref = text.sub(/^IHO\s/, "").sub(/^([[:alpha:]]+)(\d+)/, '\1-\2')
19
+ index = Relaton::Index.find_or_create :IHO, url: "#{ENDPOINT}index.zip"
20
+ row = index.search(ref).first
21
+ return unless row
22
+
23
+ uri = URI("#{ENDPOINT}#{row[:file]}")
15
24
  resp = Net::HTTP.get_response uri
16
25
  return unless resp.code == "200"
17
26
 
@@ -1,3 +1,3 @@
1
1
  module RelatonIho
2
- VERSION = "1.14.0".freeze
2
+ VERSION = "1.14.1".freeze
3
3
  end
data/lib/relaton_iho.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "digest/md5"
2
2
  require "yaml"
3
3
  require "relaton_bib"
4
+ require "relaton/index"
4
5
  require "relaton_iho/version"
5
6
  require "relaton_iho/iho_bibliography"
6
7
  require "relaton_iho/hash_converter"
data/relaton_iho.gemspec CHANGED
@@ -9,9 +9,9 @@ Gem::Specification.new do |s|
9
9
  s.email = ["open.source@ribose.com"]
10
10
  s.homepage = "https://github.com/relaton/relaton-iho"
11
11
  s.licenses = "BSD-2-Clause"
12
- s.summary = "RelatonIho: retrieve IHO Standards for bibliographic "\
12
+ s.summary = "RelatonIho: retrieve IHO Standards for bibliographic " \
13
13
  "using the BibliographicItem model"
14
- s.description = "RelatonIho: retrieve IHO Standards for bibliographic "\
14
+ s.description = "RelatonIho: retrieve IHO Standards for bibliographic " \
15
15
  "using the BibliographicItem model"
16
16
 
17
17
  s.files = Dir.chdir(File.expand_path(__dir__)) do
@@ -21,14 +21,10 @@ Gem::Specification.new do |s|
21
21
  s.require_paths = ["lib"]
22
22
  s.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
23
23
 
24
- s.add_development_dependency "byebug"
25
24
  s.add_development_dependency "equivalent-xml", "~> 0.6"
26
25
  s.add_development_dependency "rake", "~> 13.0"
27
26
  s.add_development_dependency "rspec", "~> 3.0"
28
- s.add_development_dependency "ruby-jing"
29
- s.add_development_dependency "simplecov"
30
- s.add_development_dependency "vcr"
31
- s.add_development_dependency "webmock"
32
27
 
33
28
  s.add_dependency "relaton-bib", "~> 1.14.0"
29
+ s.add_dependency "relaton-index", "~> 0.1.0"
34
30
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-05 00:00:00.000000000 Z
11
+ date: 2023-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: byebug
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: equivalent-xml
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -67,75 +53,33 @@ dependencies:
67
53
  - !ruby/object:Gem::Version
68
54
  version: '3.0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: ruby-jing
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: simplecov
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: vcr
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: webmock
56
+ name: relaton-bib
113
57
  requirement: !ruby/object:Gem::Requirement
114
58
  requirements:
115
- - - ">="
59
+ - - "~>"
116
60
  - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
61
+ version: 1.14.0
62
+ type: :runtime
119
63
  prerelease: false
120
64
  version_requirements: !ruby/object:Gem::Requirement
121
65
  requirements:
122
- - - ">="
66
+ - - "~>"
123
67
  - !ruby/object:Gem::Version
124
- version: '0'
68
+ version: 1.14.0
125
69
  - !ruby/object:Gem::Dependency
126
- name: relaton-bib
70
+ name: relaton-index
127
71
  requirement: !ruby/object:Gem::Requirement
128
72
  requirements:
129
73
  - - "~>"
130
74
  - !ruby/object:Gem::Version
131
- version: 1.14.0
75
+ version: 0.1.0
132
76
  type: :runtime
133
77
  prerelease: false
134
78
  version_requirements: !ruby/object:Gem::Requirement
135
79
  requirements:
136
80
  - - "~>"
137
81
  - !ruby/object:Gem::Version
138
- version: 1.14.0
82
+ version: 0.1.0
139
83
  description: 'RelatonIho: retrieve IHO Standards for bibliographic using the BibliographicItem
140
84
  model'
141
85
  email: