faraday-net_http_persistent 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -16
- data/lib/faraday/adapter/net_http_persistent.rb +6 -11
- data/lib/faraday/net_http_persistent/version.rb +1 -1
- metadata +14 -98
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4da892e0d8f0da0870720d9be4fe02ba9a43b3ad02abef06a95cf1665c14dd8
|
4
|
+
data.tar.gz: fe2b3d188a12ace453e570c3d80d21075887c4e703746fe4e71b6c6d64cb528b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31f8bb4f02d25a74f2a3bcc1f79f6deb2d2e097afd6a1d9eb29c5f33a4d6e097dc61d07a8412e1ba218972f60bb2ac41b12445b75c9c3f19d80dc2f636d5e64d
|
7
|
+
data.tar.gz: 45d15ddfe4306489388634c58f3f9c0c90b7da6e38000df13f7c49004d99f176614463faf2285d1824bb88785120fbab6a2248cd3a6cdd183e1e665227edd966
|
data/README.md
CHANGED
@@ -7,36 +7,29 @@ This gem is a [Faraday][faraday] adapter for the [Net::HTTP::Persistent gem][net
|
|
7
7
|
|
8
8
|
## Installation
|
9
9
|
|
10
|
-
Add
|
10
|
+
Add this to your application's Gemfile:
|
11
11
|
|
12
12
|
```ruby
|
13
|
-
gem 'faraday-net_http_persistent'
|
14
|
-
gem 'net-http-persistent', '>= 3.1'
|
13
|
+
gem 'faraday-net_http_persistent', '~> 2.0'
|
15
14
|
```
|
16
15
|
|
17
16
|
And then execute:
|
18
17
|
|
19
18
|
$ bundle
|
20
19
|
|
21
|
-
Or install them yourself as:
|
22
|
-
|
23
|
-
$ gem install net_http_persistent -v '>= 3.1'
|
24
|
-
$ gem install faraday-net_http_persistent
|
25
|
-
|
26
20
|
## Usage
|
27
21
|
|
28
|
-
Configure your Faraday connection to use this adapter instead of the default one:
|
29
|
-
|
30
22
|
```ruby
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
require 'faraday/net_http_persistent'
|
24
|
+
|
25
|
+
conn = Faraday.new(...) do |f|
|
26
|
+
f.adapter :net_http_persistent, pool_size: 5 do |http|
|
27
|
+
# yields Net::HTTP::Persistent
|
28
|
+
http.idle_timeout = 100
|
29
|
+
end
|
34
30
|
end
|
35
31
|
```
|
36
32
|
|
37
|
-
For more information on how to setup your Faraday connection and adapters usage,
|
38
|
-
please refer to the [Faraday Website][faraday-website].
|
39
|
-
|
40
33
|
## Development
|
41
34
|
|
42
35
|
After checking out the repo, run `bin/setup` to install dependencies.
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "faraday/net_http"
|
4
|
+
require "net/http/persistent"
|
5
|
+
|
3
6
|
module Faraday
|
4
7
|
class Adapter
|
5
8
|
# Net::HTTP::Persistent adapter.
|
6
9
|
class NetHttpPersistent < NetHttp
|
7
|
-
dependency "net/http/persistent"
|
8
|
-
|
9
10
|
private
|
10
11
|
|
11
12
|
def net_http_connection(env)
|
@@ -13,18 +14,14 @@ module Faraday
|
|
13
14
|
if Net::HTTP::Persistent.instance_method(:initialize)
|
14
15
|
.parameters.first == %i[key name]
|
15
16
|
options = {name: "Faraday"}
|
16
|
-
if @connection_options.key?(:pool_size)
|
17
|
-
options[:pool_size] = @connection_options[:pool_size]
|
18
|
-
end
|
17
|
+
options[:pool_size] = @connection_options[:pool_size] if @connection_options.key?(:pool_size)
|
19
18
|
Net::HTTP::Persistent.new(**options)
|
20
19
|
else
|
21
20
|
Net::HTTP::Persistent.new("Faraday")
|
22
21
|
end
|
23
22
|
|
24
23
|
proxy_uri = proxy_uri(env)
|
25
|
-
if @cached_connection.proxy_uri != proxy_uri
|
26
|
-
@cached_connection.proxy = proxy_uri
|
27
|
-
end
|
24
|
+
@cached_connection.proxy = proxy_uri if @cached_connection.proxy_uri != proxy_uri
|
28
25
|
@cached_connection
|
29
26
|
end
|
30
27
|
|
@@ -75,9 +72,7 @@ module Faraday
|
|
75
72
|
rescue Net::HTTP::Persistent::Error => e
|
76
73
|
raise Faraday::TimeoutError, e if e.message.include? "Timeout"
|
77
74
|
|
78
|
-
if e.message.include? "connection refused"
|
79
|
-
raise Faraday::ConnectionFailed, e
|
80
|
-
end
|
75
|
+
raise Faraday::ConnectionFailed, e if e.message.include? "connection refused"
|
81
76
|
|
82
77
|
raise
|
83
78
|
end
|
metadata
CHANGED
@@ -1,37 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-net_http_persistent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Rogers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.1'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '3.1'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
14
|
+
name: faraday
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
19
|
version: '2.0'
|
34
|
-
type: :
|
20
|
+
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
@@ -39,103 +25,33 @@ dependencies:
|
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: '2.0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: faraday
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '13.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '13.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '3.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '3.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: simplecov
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.19.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.19.0
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: standardrb
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '1.0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '1.0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: multipart-parser
|
28
|
+
name: faraday-net_http
|
113
29
|
requirement: !ruby/object:Gem::Requirement
|
114
30
|
requirements:
|
115
31
|
- - "~>"
|
116
32
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0
|
118
|
-
type: :
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
119
35
|
prerelease: false
|
120
36
|
version_requirements: !ruby/object:Gem::Requirement
|
121
37
|
requirements:
|
122
38
|
- - "~>"
|
123
39
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0
|
40
|
+
version: '2.0'
|
125
41
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
42
|
+
name: net-http-persistent
|
127
43
|
requirement: !ruby/object:Gem::Requirement
|
128
44
|
requirements:
|
129
45
|
- - "~>"
|
130
46
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
132
|
-
type: :
|
47
|
+
version: '4.0'
|
48
|
+
type: :runtime
|
133
49
|
prerelease: false
|
134
50
|
version_requirements: !ruby/object:Gem::Requirement
|
135
51
|
requirements:
|
136
52
|
- - "~>"
|
137
53
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
54
|
+
version: '4.0'
|
139
55
|
description: Faraday adapter for NetHttpPersistent
|
140
56
|
email:
|
141
57
|
- me@mikerogers.io
|
@@ -154,7 +70,7 @@ licenses:
|
|
154
70
|
metadata:
|
155
71
|
homepage_uri: https://github.com/lostisland/faraday-net_http_persistent
|
156
72
|
source_code_uri: https://github.com/lostisland/faraday-net_http_persistent
|
157
|
-
changelog_uri: https://github.com/lostisland/faraday-net_http_persistent
|
73
|
+
changelog_uri: https://github.com/lostisland/faraday-net_http_persistent/releases/tag/v2.0.0
|
158
74
|
post_install_message:
|
159
75
|
rdoc_options: []
|
160
76
|
require_paths:
|
@@ -163,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
79
|
requirements:
|
164
80
|
- - ">="
|
165
81
|
- !ruby/object:Gem::Version
|
166
|
-
version: 2.
|
82
|
+
version: 2.6.0
|
167
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
84
|
requirements:
|
169
85
|
- - ">="
|