antbird 0.5.1 → 0.6.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 +4 -4
- data/.github/workflows/build-os.yml +4 -1
- data/lib/antbird/client.rb +21 -5
- data/lib/antbird/rest_api/rest_api_opensearch_v1_0.rb +1 -1
- data/lib/antbird/rest_api/rest_api_opensearch_v1_1.rb +1 -1
- data/lib/antbird/rest_api/rest_api_opensearch_v1_2.rb +2 -2
- data/lib/antbird/rest_api/rest_api_opensearch_v1_3.rb +1222 -0
- data/lib/antbird/rest_api/rest_api_opensearch_v2_0.rb +1205 -0
- data/lib/antbird/rest_api/rest_api_opensearch_v2_1.rb +1205 -0
- data/lib/antbird/rest_api/rest_api_v6_8.rb +2 -2
- data/lib/antbird/rest_api/rest_api_v7_10.rb +2 -2
- data/lib/antbird/rest_api/rest_api_v7_11.rb +2 -2
- data/lib/antbird/rest_api/rest_api_v7_12.rb +2 -2
- data/lib/antbird/rest_api/rest_api_v7_13.rb +2 -2
- data/lib/antbird/rest_api/rest_api_v7_14.rb +2 -2
- data/lib/antbird/rest_api/rest_api_v7_15.rb +2 -2
- data/lib/antbird/rest_api/rest_api_v7_8.rb +2 -2
- data/lib/antbird/rest_api/rest_api_v7_9.rb +2 -2
- data/lib/antbird/version.rb +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d53195db71bc7c37233efa6c6cc8f5d872a3594cb7852149d3106368e856a6d1
|
4
|
+
data.tar.gz: 7916414d2f84758acf002970839a0d155fcc61f25601afa35911b8e32eb59743
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c940f6274d902d97372194485c09b5635eecf7f5e5085ce9004b9768ef5e6d7b47a6b515a961f9487f25d189de845f11f48b583d7b37a7936cc841360c311af8
|
7
|
+
data.tar.gz: 2d658590a30d04d0e30d8b26a8f4fa04b38f85f90d49b5f2b18bc37d7910e2854c7671ad35242ebc2c9fe5965542eeab694559b7dfa75e3735c1e2f46c84a465
|
data/lib/antbird/client.rb
CHANGED
@@ -25,13 +25,11 @@ module Antbird
|
|
25
25
|
if version
|
26
26
|
@version = version
|
27
27
|
@distribution = distribution
|
28
|
-
else
|
29
|
-
fetch_version_and_distribution
|
30
28
|
end
|
31
29
|
|
32
30
|
@api_specs = {}
|
33
31
|
end
|
34
|
-
attr_reader :scope, :url, :
|
32
|
+
attr_reader :scope, :url, :distribution
|
35
33
|
attr_reader :read_timeout, :open_timeout, :adapter
|
36
34
|
attr_reader :api_specs, :last_request
|
37
35
|
|
@@ -203,6 +201,8 @@ module Antbird
|
|
203
201
|
end
|
204
202
|
|
205
203
|
def opensearch?
|
204
|
+
ensure_version_and_distribution
|
205
|
+
|
206
206
|
distribution == 'opensearch'
|
207
207
|
end
|
208
208
|
|
@@ -218,6 +218,13 @@ module Antbird
|
|
218
218
|
elasticsearch? && Gem::Version.new(version) >= Gem::Version.new('7.6.0')
|
219
219
|
end
|
220
220
|
|
221
|
+
def version
|
222
|
+
return @version if @version
|
223
|
+
|
224
|
+
ensure_version_and_distribution
|
225
|
+
@version
|
226
|
+
end
|
227
|
+
|
221
228
|
private
|
222
229
|
|
223
230
|
# NOTE: stable sort
|
@@ -249,8 +256,15 @@ module Antbird
|
|
249
256
|
end
|
250
257
|
end
|
251
258
|
|
252
|
-
def
|
253
|
-
|
259
|
+
def ensure_version_and_distribution
|
260
|
+
return if @version
|
261
|
+
|
262
|
+
response = connection.get('/')
|
263
|
+
if response.status == 401
|
264
|
+
raise Antbird::Client::RequestError.new(response)
|
265
|
+
end
|
266
|
+
|
267
|
+
version_hash = response.body.dig('version')
|
254
268
|
@version = version_hash['number']
|
255
269
|
@distribution = version_hash['distribution']
|
256
270
|
end
|
@@ -262,6 +276,8 @@ module Antbird
|
|
262
276
|
def ensure_api_spec_loaded
|
263
277
|
return if api_specs_loaded?
|
264
278
|
|
279
|
+
ensure_version_and_distribution
|
280
|
+
|
265
281
|
if opensearch?
|
266
282
|
require "antbird/rest_api/rest_api_opensearch_v#{class_version}"
|
267
283
|
extend Antbird::RestApi.const_get "RestApiOpensearchV#{class_version}"
|