antbird 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c8c8fecccb123dbea652666e8c3afe9c0bb82b05addd4c16184285fc8d883fa
4
- data.tar.gz: 300f03046a12082dc0f7ee92dc0283f1228cdc6dc1975cfa965e56d7baf065db
3
+ metadata.gz: 7f6be201e13340d8e4f7cf122049f745af8c9af0d4d6390601a3264bef077992
4
+ data.tar.gz: 7f1540e56bdc23db02b1300971550bdce93bb0ac426a0010d2fa4a9fc245e8f4
5
5
  SHA512:
6
- metadata.gz: e5e54fed3437d547f92bfead50aeab29612694a955d6ed3f762962eaa29a7bec0743027557c8f0d15c82f032f5f5f188e138eb1a58a53afdb893b4e9abfa09b6
7
- data.tar.gz: 37595c88f4e1df53b79d3f859c9a551d9ebfd49fd005f6e75136c91b677c84def615f3022bbac99149da8f00ff1991884c9a18a9d43f50e476fbfe2875adec6a
6
+ metadata.gz: 9d135caf322ed4ad9056883283062ffbf5f43073087b29befa60033273f95ac87dae3b0f2b21fac79eb15d1bf21fe23d3cf136acd89e5ac46c4f2add0bee7678
7
+ data.tar.gz: c8df3422cf55ffad4f18e4016e0ec972570c525f53250a48962d482d9ac7d45585cf0f2ad8357eb74e1b73dbf2309f2949bcc4ec8e3b016e7f71f07588295848
@@ -21,8 +21,13 @@ module Antbird
21
21
  @url = url
22
22
 
23
23
  @scope = scope.transform_keys(&:to_sym)
24
- @version = version
25
- @distribution = distribution
24
+
25
+ if version
26
+ @version = version
27
+ @distribution = distribution
28
+ else
29
+ fetch_version_and_distribution
30
+ end
26
31
 
27
32
  @api_specs = {}
28
33
  end
@@ -198,7 +203,6 @@ module Antbird
198
203
  end
199
204
 
200
205
  def opensearch?
201
- fetch_version
202
206
  distribution == 'opensearch'
203
207
  end
204
208
 
@@ -245,19 +249,19 @@ module Antbird
245
249
  end
246
250
  end
247
251
 
248
- def fetch_version
249
- return if @version
250
-
252
+ def fetch_version_and_distribution
251
253
  version_hash = connection.get('/').body.dig('version')
252
- @version ||= version_hash['number']
253
- @distribution ||= version_hash['distribution']
254
+ @version = version_hash['number']
255
+ @distribution = version_hash['distribution']
256
+ end
257
+
258
+ def class_version
259
+ version.split('.')[0, 2].join('_')
254
260
  end
255
261
 
256
262
  def ensure_api_spec_loaded
257
263
  return if api_specs_loaded?
258
264
 
259
- fetch_version
260
- class_version = @version.split('.')[0, 2].join('_')
261
265
  if opensearch?
262
266
  require "antbird/rest_api/rest_api_opensearch_v#{class_version}"
263
267
  extend Antbird::RestApi.const_get "RestApiOpensearchV#{class_version}"
@@ -1,3 +1,3 @@
1
1
  module Antbird
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: antbird
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - fukayatsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-07 00:00:00.000000000 Z
11
+ date: 2021-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday