antbird 0.2.0 → 0.2.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: 162b46a36d97a442af5e15d9c741fe28c63edd8f7a9be3d615ab84d93de930d0
4
- data.tar.gz: 2a00c3244dae121c1e33839bd69fe0358f43a474aab562f5fb3783263c75df51
3
+ metadata.gz: '0233525863b99bccb8734b00d5c92901924403113dd6bade6936ff566a00fa3a'
4
+ data.tar.gz: 00e9494e1a04c47adf6970bdc283a6854818186b112660c1830b9ada9370998c
5
5
  SHA512:
6
- metadata.gz: 0d7d986cde55b29d5f5a03527c1eb38d10bba3be4143586a481fa96b1d7dc045bc8766eb8b4474afb4aaf248a23113b498fd620449cb9f070c86b623a8796869
7
- data.tar.gz: '091ef52dec8499efaf8f073bbcb046318ac654fbb4b6a93a486867828a6ae5b376456eccaa32b53abb002ea21c9cbaaafd99f0142362161f90b92bc27d23a884'
6
+ metadata.gz: '0191b07ce7917e9d57bf2b96e75e4f45d735e578209fe8e093bdf2bab43b08f76a61c6150cbae034e7a723c248571bf68b22cedd2def7962aab06f7ad353063f'
7
+ data.tar.gz: ede40233ca26abddba033fe7c52920e3c8aa7167d1ab5bc27aad3bd1f2fd01305b9ce7aacaf16132759b79cc4ddacc99a53d6bec3bd52ad46e358433f5dcc6ef
data/README.md CHANGED
@@ -50,13 +50,9 @@ client = Antbird::Client.new(
50
50
  scope: {
51
51
  index: 'test-index',
52
52
  type: 'test-type'
53
- }
53
+ },
54
+ adapter: :net_http_persistent
54
55
  ) do |f|
55
- # https://github.com/lostisland/faraday/blob/master/docs/adapters/net_http_persistent.md
56
- f.adapter :net_http_persistent, pool_size: 5 do |http|
57
- http.idle_timeout = 100
58
- end
59
-
60
56
  # https://github.com/winebarrel/faraday_middleware-aws-sigv4
61
57
  f.request(
62
58
  :aws_sigv4,
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
  spec.add_dependency "faraday", "> 0.8", "< 2.0"
25
- spec.add_dependency 'faraday_middleware', "> 0.12", "< 1.0"
25
+ spec.add_dependency 'faraday_middleware', "> 0.12", "< 2.0"
26
26
 
27
27
  spec.add_development_dependency "net-http-persistent"
28
28
  spec.add_development_dependency "bundler", "> 1.16", "< 3.0"
@@ -10,10 +10,12 @@ module Antbird
10
10
  version: nil,
11
11
  read_timeout: 5,
12
12
  open_timeout: 2,
13
+ adapter: ::Faraday.default_adapter,
13
14
  &block)
14
15
 
15
16
  @read_timeout = read_timeout
16
17
  @open_timeout = open_timeout
18
+ @adapter = adapter
17
19
  @block = block
18
20
  @url = url
19
21
 
@@ -23,7 +25,7 @@ module Antbird
23
25
  @api_specs = {}
24
26
  end
25
27
  attr_reader :scope, :url, :version
26
- attr_reader :read_timeout, :open_timeout
28
+ attr_reader :read_timeout, :open_timeout, :adapter
27
29
  attr_reader :api_specs
28
30
 
29
31
  def scoped(new_scope = {})
@@ -149,12 +151,15 @@ module Antbird
149
151
 
150
152
  def connection
151
153
  @connection ||= Faraday.new(url) do |conn|
152
- @block.call(conn) if @block
154
+ @block&.call(conn)
155
+
153
156
  conn.request :json
154
157
  conn.response :json, content_type: /\bjson$/
155
158
 
156
159
  conn.options[:timeout] = read_timeout
157
160
  conn.options[:open_timeout] = open_timeout
161
+
162
+ conn.adapter adapter
158
163
  end
159
164
  end
160
165
 
@@ -1,3 +1,3 @@
1
1
  module Antbird
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - fukayatsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-18 00:00:00.000000000 Z
11
+ date: 2020-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '0.12'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '1.0'
42
+ version: '2.0'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '0.12'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '1.0'
52
+ version: '2.0'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: net-http-persistent
55
55
  requirement: !ruby/object:Gem::Requirement