faraday-typhoeus 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.md +1 -1
- data/README.md +24 -6
- data/lib/faraday/adapter/typhoeus.rb +6 -0
- data/lib/faraday/typhoeus/version.rb +1 -1
- metadata +4 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1f7f589b91eba8e0f1397798d4c80f239b42c9396d1aa8dece302231133b441e
|
|
4
|
+
data.tar.gz: 249bb2a906e2b46af947825c729904a16ece5192ae327b45d52d57bf39ed96f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6ab22db2585d259a3b1235b217dd909893e6c763f076a7a7da7037b02011e7bf2b4aaa5fb85c308c198b4001298ca765d78a96293b18257b2edf0161cffc711f
|
|
7
|
+
data.tar.gz: 8ae5279149e15e9c6acfefaa99784beac083ed71def30e69b2bc656dac8cd7874f8998357bd36994409891b6fad0cb4754f095d2d0d085f9007b5275dfde2f08
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
|
@@ -14,9 +14,7 @@ And then execute:
|
|
|
14
14
|
|
|
15
15
|
$ bundle install
|
|
16
16
|
|
|
17
|
-
Or install it yourself
|
|
18
|
-
|
|
19
|
-
$ gem install faraday-typhoeus
|
|
17
|
+
Or install it yourself with `gem install faraday-typhoeus` and require it in your ruby code with `require 'faraday/typhoeus'`
|
|
20
18
|
|
|
21
19
|
## Usage
|
|
22
20
|
|
|
@@ -68,9 +66,17 @@ responses[0].body
|
|
|
68
66
|
responses[1].body
|
|
69
67
|
```
|
|
70
68
|
|
|
69
|
+
Typhoeus's [max concurrency][max_concurrency] defaults to 200 and can be controlled like so:
|
|
70
|
+
|
|
71
|
+
```ruby
|
|
72
|
+
conn.in_parallel(Typhoeus::Hydra.new(max_concurrency: 20)) do
|
|
73
|
+
# ...requests
|
|
74
|
+
end
|
|
75
|
+
```
|
|
76
|
+
|
|
71
77
|
### Streaming Responses
|
|
72
78
|
|
|
73
|
-
The adapter supports [streamed responses]
|
|
79
|
+
The adapter supports [streamed responses][faraday_streaming] via the `on_data` option:
|
|
74
80
|
|
|
75
81
|
```ruby
|
|
76
82
|
conn = Faraday.new(...) do |f|
|
|
@@ -110,6 +116,16 @@ rescue Faraday::ConnectionFailed => ex
|
|
|
110
116
|
end
|
|
111
117
|
```
|
|
112
118
|
|
|
119
|
+
### Compression
|
|
120
|
+
|
|
121
|
+
By default, this adapter takes advantage of libcurl's ability to [transparently handle HTTP compression][curl_accept_encoding]. To disable this behavior, set `accept_encoding` to `nil`:
|
|
122
|
+
|
|
123
|
+
```ruby
|
|
124
|
+
conn = Faraday.new(...) do |f|
|
|
125
|
+
f.adapter :typhoeus, accept_encoding: nil
|
|
126
|
+
end
|
|
127
|
+
```
|
|
128
|
+
|
|
113
129
|
## Resources
|
|
114
130
|
|
|
115
131
|
- See [Typhoeus Documentation][typhoeus] for more info.
|
|
@@ -141,7 +157,9 @@ The gem is available as open source under the terms of the [license][license].
|
|
|
141
157
|
[typhoeus]: https://github.com/typhoeus/typhoeus
|
|
142
158
|
[typhoeus_options]: https://github.com/typhoeus/typhoeus/blob/3544111b76b95d13da7cc6bfe4eb07921d771d93/lib/typhoeus/easy_factory.rb#L13-L39
|
|
143
159
|
[ethon_options]: https://github.com/typhoeus/ethon/blob/5d9ddf8f609a6be4b5c60d55e1e338eeeb08f25f/lib/ethon/curls/options.rb#L214-L499
|
|
144
|
-
[faraday_streaming]: https://lostisland.github.io/faraday/
|
|
160
|
+
[faraday_streaming]: https://lostisland.github.io/faraday/#/advanced/streaming-responses
|
|
145
161
|
[repo]: https://github.com/dleavitt/faraday-typhoeus
|
|
146
162
|
[license]: LICENSE.md
|
|
147
|
-
[rubygems]: https://github.com/dleavitt/faraday-typhoeus/blob/main/rubygems
|
|
163
|
+
[rubygems]: https://github.com/dleavitt/faraday-typhoeus/blob/main/rubygems
|
|
164
|
+
[max_concurrency]: https://github.com/typhoeus/typhoeus?tab=readme-ov-file#specifying-max-concurrency
|
|
165
|
+
[curl_accept_encoding]: https://curl.se/libcurl/c/CURLOPT_ACCEPT_ENCODING.html
|
|
@@ -92,6 +92,12 @@ module Faraday
|
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
|
|
95
|
+
env[:typhoeus_timings] = %i[
|
|
96
|
+
appconnect connect namelookup pretransfer redirect starttransfer total
|
|
97
|
+
].to_h do |key|
|
|
98
|
+
[key, resp.public_send("#{key}_time")]
|
|
99
|
+
end
|
|
100
|
+
|
|
95
101
|
save_response(env, resp.code, resp.body, nil, resp.status_message) do |response_headers|
|
|
96
102
|
response_headers.parse resp.response_headers
|
|
97
103
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: faraday-typhoeus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Leavitt
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: faraday
|
|
@@ -58,7 +57,6 @@ metadata:
|
|
|
58
57
|
source_code_uri: https://github.com/dleavitt/faraday-typhoeus
|
|
59
58
|
changelog_uri: https://github.com/dleavitt/faraday-typhoeus
|
|
60
59
|
rubygems_mfa_required: 'true'
|
|
61
|
-
post_install_message:
|
|
62
60
|
rdoc_options: []
|
|
63
61
|
require_paths:
|
|
64
62
|
- lib
|
|
@@ -66,15 +64,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
66
64
|
requirements:
|
|
67
65
|
- - ">="
|
|
68
66
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: 2.
|
|
67
|
+
version: 2.7.0
|
|
70
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
69
|
requirements:
|
|
72
70
|
- - ">="
|
|
73
71
|
- !ruby/object:Gem::Version
|
|
74
72
|
version: '0'
|
|
75
73
|
requirements: []
|
|
76
|
-
rubygems_version:
|
|
77
|
-
signing_key:
|
|
74
|
+
rubygems_version: 4.1.0.dev
|
|
78
75
|
specification_version: 4
|
|
79
76
|
summary: Faraday adapter for Typhoeus
|
|
80
77
|
test_files: []
|