ezclient 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/.travis.yml +14 -2
- data/lib/ezclient/version.rb +1 -1
- data/lib/ezclient.rb +10 -3
- metadata +1 -3
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36276a0601968419be332b235a0bacd0d8687a36b318d0d3351d4b431ef58f92
|
4
|
+
data.tar.gz: 58e5d7f226a2c9792229212329bf0cea4f73b0712bf70d0a0ddb4df93f2cfb24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9fddb90bf2bbf7fcfa337a9ca13f734e8330329345375679d3b2102012fd10f1d2abe1cc23498cdd3a66ba1ea85edbcdedb503c5c6753d9c18228ccaede9285
|
7
|
+
data.tar.gz: 81cc96427b233facb25ca58542aa569ae304b6ba95e42b6f6a475b63013bb7ff032c26fa5b3ac6ed786ea9d4f314dd9ec80a16933b5bb259f7b14dd15a779f51
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,15 +1,27 @@
|
|
1
|
-
sudo: false
|
2
1
|
language: ruby
|
2
|
+
|
3
|
+
sudo: false
|
4
|
+
|
3
5
|
rvm:
|
4
6
|
- 2.3.5
|
5
7
|
- 2.4.2
|
6
8
|
- 2.5.0
|
7
|
-
|
9
|
+
- ruby-head
|
10
|
+
|
11
|
+
before_install: gem install bundler
|
12
|
+
|
8
13
|
env: SUITE="rspec"
|
14
|
+
|
9
15
|
script: bundle exec $SUITE
|
16
|
+
|
10
17
|
matrix:
|
11
18
|
fast_finish: true
|
12
19
|
# Only run RuboCop on the latest Ruby
|
13
20
|
include:
|
14
21
|
- rvm: 2.5.0
|
15
22
|
env: SUITE="rubocop"
|
23
|
+
allow_failures:
|
24
|
+
- rvm: ruby-head
|
25
|
+
- rvm: jruby-head
|
26
|
+
|
27
|
+
cache: bundler
|
data/lib/ezclient/version.rb
CHANGED
data/lib/ezclient.rb
CHANGED
@@ -12,7 +12,10 @@ class EzClient
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def request(verb, url, **options)
|
15
|
+
options = { **default_options, **options }
|
16
|
+
|
15
17
|
keep_alive_timeout = options.delete(:keep_alive)
|
18
|
+
api_auth = options.delete(:api_auth)
|
16
19
|
|
17
20
|
if keep_alive_timeout
|
18
21
|
client = persistent_client_for(url, timeout: keep_alive_timeout)
|
@@ -20,7 +23,9 @@ class EzClient
|
|
20
23
|
client = HTTP::Client.new
|
21
24
|
end
|
22
25
|
|
23
|
-
Request.new(verb, url, client: client, **
|
26
|
+
Request.new(verb, url, client: client, **options).tap do |request|
|
27
|
+
request.api_auth!(*api_auth) if api_auth
|
28
|
+
end
|
24
29
|
end
|
25
30
|
|
26
31
|
private
|
@@ -34,11 +39,13 @@ class EzClient
|
|
34
39
|
|
35
40
|
def default_options
|
36
41
|
{
|
42
|
+
api_auth: options[:api_auth],
|
43
|
+
keep_alive: options[:keep_alive],
|
44
|
+
max_retries: options[:max_retries],
|
37
45
|
on_complete: options[:on_complete],
|
38
46
|
on_error: options[:on_error],
|
39
|
-
timeout: options[:default_timeout],
|
40
47
|
retry_exceptions: options[:retry_exceptions],
|
41
|
-
|
48
|
+
timeout: options[:default_timeout],
|
42
49
|
}
|
43
50
|
end
|
44
51
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ezclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuri Smirnov
|
@@ -151,8 +151,6 @@ files:
|
|
151
151
|
- LICENSE.txt
|
152
152
|
- README.md
|
153
153
|
- Rakefile
|
154
|
-
- bin/console
|
155
|
-
- bin/setup
|
156
154
|
- ezclient.gemspec
|
157
155
|
- lib/ezclient.rb
|
158
156
|
- lib/ezclient/request.rb
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "ezclient"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|