antbird 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/antbird/client.rb +25 -6
- data/lib/antbird/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: 95d22cfe4e068e067929b6473a071f50c64cf50995a03b7621ac052093d19211
|
4
|
+
data.tar.gz: 0df5fbbfca2db06550df0dc222910de067225760c70ce2dad3705d579719f6d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 539b9a124240ca48400d10d3561900702f9414e45e3d1327ca97bc6d29ecd8a7fe5a0ca25541ca761e2941be036abbc54fed79167c7401c3f56df7059cbb3105
|
7
|
+
data.tar.gz: 655a9ec1fdcdcf0454b7030011d1f34dbe37fc74bca0abe07ae39c56b89239db787c2411ae1bc4c38a35e98de1504f61f57edadd1c0b6bb1dd58c22ee05576b7
|
data/lib/antbird/client.rb
CHANGED
@@ -18,14 +18,9 @@ module Antbird
|
|
18
18
|
@url = url
|
19
19
|
|
20
20
|
@scope = scope.transform_keys(&:to_sym)
|
21
|
-
@version = version
|
21
|
+
@version = version
|
22
22
|
|
23
23
|
@api_specs = {}
|
24
|
-
|
25
|
-
class_version = @version.split('.')[0,2].join('_')
|
26
|
-
|
27
|
-
require "antbird/rest_api/rest_api_v#{class_version}"
|
28
|
-
extend Antbird::RestApi.const_get "RestApiV#{class_version}"
|
29
24
|
end
|
30
25
|
attr_reader :scope, :url, :version
|
31
26
|
attr_reader :read_timeout, :open_timeout
|
@@ -181,5 +176,29 @@ module Antbird
|
|
181
176
|
def fetch_version
|
182
177
|
connection.get('/').body.dig('version', 'number')
|
183
178
|
end
|
179
|
+
|
180
|
+
def ensure_api_spec_loaded
|
181
|
+
return if api_specs_loaded?
|
182
|
+
|
183
|
+
@version ||= fetch_version
|
184
|
+
class_version = @version.split('.')[0, 2].join('_')
|
185
|
+
require "antbird/rest_api/rest_api_v#{class_version}"
|
186
|
+
extend Antbird::RestApi.const_get "RestApiV#{class_version}"
|
187
|
+
|
188
|
+
@api_specs_loaded = true
|
189
|
+
end
|
190
|
+
|
191
|
+
def api_specs_loaded?
|
192
|
+
!!@api_specs_loaded
|
193
|
+
end
|
194
|
+
|
195
|
+
def method_missing(name, *args, &block)
|
196
|
+
return super if api_specs_loaded?
|
197
|
+
|
198
|
+
ensure_api_spec_loaded
|
199
|
+
|
200
|
+
return super unless respond_to?(name)
|
201
|
+
__send__(name, *args, &block)
|
202
|
+
end
|
184
203
|
end
|
185
204
|
end
|
data/lib/antbird/version.rb
CHANGED
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.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fukayatsu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|