antbird 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -0
- data/lib/antbird/client.rb +5 -2
- 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: b4c5039ccff974fe57df1991a32faec3f4c6ff5e42ff564bc54e4e2541a65c2f
|
4
|
+
data.tar.gz: c27abf56cb4429a89a9577b5f29e44df00e5b5d081d94a4292725697c69f8334
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b39414eacac5c6fab86828ea7f62ef9be11b7f9e74143876d2a551812ea544cba03b5b18aa9f814f632eebe60b20b038461e0c52ef5a556fb071d07ab30a13bf
|
7
|
+
data.tar.gz: e55b1cd638bf572c87b304e9a81fecdbf1c6763893788eecfee1a82daf73b0ffe9bb9d4fa72aa164aac660e31030f9699a3750a763cabad8c44ac9b4f79e530d
|
data/README.md
CHANGED
@@ -38,6 +38,26 @@ client = Antbird::Client.new(
|
|
38
38
|
type: 'test-type'
|
39
39
|
}
|
40
40
|
)
|
41
|
+
|
42
|
+
# OR
|
43
|
+
|
44
|
+
require 'faraday_middleware'
|
45
|
+
require 'faraday_middleware/aws_sigv4'
|
46
|
+
client = Antbird::Client.new(
|
47
|
+
url: ENV['AMAZON_ELASTICSEARCH_SERVICE_URL'],
|
48
|
+
scope: {
|
49
|
+
index: 'test-index',
|
50
|
+
type: 'test-type'
|
51
|
+
}
|
52
|
+
) do |f|
|
53
|
+
f.request(
|
54
|
+
:aws_sigv4,
|
55
|
+
service: 'es',
|
56
|
+
region: 'ap-northeast-1',
|
57
|
+
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
|
58
|
+
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
|
59
|
+
)
|
60
|
+
end
|
41
61
|
```
|
42
62
|
|
43
63
|
### Call APIs
|
data/lib/antbird/client.rb
CHANGED
@@ -9,11 +9,13 @@ module Antbird
|
|
9
9
|
url: "http://localhost:9200",
|
10
10
|
version: nil,
|
11
11
|
read_timeout: 5,
|
12
|
-
open_timeout: 2
|
12
|
+
open_timeout: 2,
|
13
|
+
&block)
|
13
14
|
|
14
15
|
@read_timeout = read_timeout
|
15
16
|
@open_timeout = open_timeout
|
16
|
-
@
|
17
|
+
@block = block
|
18
|
+
@url = url
|
17
19
|
|
18
20
|
@scope = scope.transform_keys(&:to_sym)
|
19
21
|
@version = version || fetch_version
|
@@ -137,6 +139,7 @@ module Antbird
|
|
137
139
|
|
138
140
|
def connection
|
139
141
|
@connection ||= Faraday.new(url) do |conn|
|
142
|
+
@block.call(conn) if @block
|
140
143
|
conn.request :json
|
141
144
|
conn.response :json, :content_type => /\bjson$/
|
142
145
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fukayatsu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|