faraday 0.15.4 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +276 -0
- data/LICENSE.md +1 -1
- data/README.md +18 -344
- data/Rakefile +7 -0
- data/examples/client_spec.rb +65 -0
- data/examples/client_test.rb +79 -0
- data/lib/faraday/adapter/em_http.rb +144 -101
- data/lib/faraday/adapter/em_http_ssl_patch.rb +24 -18
- data/lib/faraday/adapter/em_synchrony/parallel_manager.rb +18 -15
- data/lib/faraday/adapter/em_synchrony.rb +104 -60
- data/lib/faraday/adapter/excon.rb +98 -56
- data/lib/faraday/adapter/httpclient.rb +83 -59
- data/lib/faraday/adapter/net_http.rb +130 -63
- data/lib/faraday/adapter/net_http_persistent.rb +51 -28
- data/lib/faraday/adapter/patron.rb +80 -43
- data/lib/faraday/adapter/rack.rb +30 -13
- data/lib/faraday/adapter/test.rb +86 -53
- data/lib/faraday/adapter/typhoeus.rb +4 -1
- data/lib/faraday/adapter.rb +82 -22
- data/lib/faraday/adapter_registry.rb +30 -0
- data/lib/faraday/autoload.rb +47 -36
- data/lib/faraday/connection.rb +312 -182
- data/lib/faraday/dependency_loader.rb +37 -0
- data/lib/faraday/encoders/flat_params_encoder.rb +98 -0
- data/lib/faraday/encoders/nested_params_encoder.rb +171 -0
- data/lib/faraday/error.rb +103 -37
- data/lib/faraday/file_part.rb +128 -0
- data/lib/faraday/logging/formatter.rb +105 -0
- data/lib/faraday/middleware.rb +12 -28
- data/lib/faraday/middleware_registry.rb +129 -0
- data/lib/faraday/options/connection_options.rb +22 -0
- data/lib/faraday/options/env.rb +181 -0
- data/lib/faraday/options/proxy_options.rb +28 -0
- data/lib/faraday/options/request_options.rb +22 -0
- data/lib/faraday/options/ssl_options.rb +59 -0
- data/lib/faraday/options.rb +35 -186
- data/lib/faraday/param_part.rb +53 -0
- data/lib/faraday/parameters.rb +4 -197
- data/lib/faraday/rack_builder.rb +67 -56
- data/lib/faraday/request/authorization.rb +44 -30
- data/lib/faraday/request/basic_authentication.rb +14 -7
- data/lib/faraday/request/instrumentation.rb +45 -27
- data/lib/faraday/request/multipart.rb +79 -48
- data/lib/faraday/request/retry.rb +198 -169
- data/lib/faraday/request/token_authentication.rb +15 -10
- data/lib/faraday/request/url_encoded.rb +43 -23
- data/lib/faraday/request.rb +68 -36
- data/lib/faraday/response/logger.rb +22 -69
- data/lib/faraday/response/raise_error.rb +38 -14
- data/lib/faraday/response.rb +27 -17
- data/lib/faraday/utils/headers.rb +139 -0
- data/lib/faraday/utils/params_hash.rb +61 -0
- data/lib/faraday/utils.rb +36 -245
- data/lib/faraday.rb +94 -176
- data/spec/external_adapters/faraday_specs_setup.rb +14 -0
- data/spec/faraday/adapter/em_http_spec.rb +47 -0
- data/spec/faraday/adapter/em_synchrony_spec.rb +16 -0
- data/spec/faraday/adapter/excon_spec.rb +49 -0
- data/spec/faraday/adapter/httpclient_spec.rb +73 -0
- data/spec/faraday/adapter/net_http_persistent_spec.rb +57 -0
- data/spec/faraday/adapter/net_http_spec.rb +64 -0
- data/spec/faraday/adapter/patron_spec.rb +18 -0
- data/spec/faraday/adapter/rack_spec.rb +8 -0
- data/spec/faraday/adapter/typhoeus_spec.rb +7 -0
- data/spec/faraday/adapter_registry_spec.rb +28 -0
- data/spec/faraday/adapter_spec.rb +55 -0
- data/spec/faraday/composite_read_io_spec.rb +80 -0
- data/spec/faraday/connection_spec.rb +691 -0
- data/spec/faraday/error_spec.rb +45 -0
- data/spec/faraday/middleware_spec.rb +26 -0
- data/spec/faraday/options/env_spec.rb +70 -0
- data/spec/faraday/options/options_spec.rb +297 -0
- data/spec/faraday/options/proxy_options_spec.rb +37 -0
- data/spec/faraday/options/request_options_spec.rb +19 -0
- data/spec/faraday/params_encoders/flat_spec.rb +34 -0
- data/spec/faraday/params_encoders/nested_spec.rb +134 -0
- data/spec/faraday/rack_builder_spec.rb +196 -0
- data/spec/faraday/request/authorization_spec.rb +88 -0
- data/spec/faraday/request/instrumentation_spec.rb +76 -0
- data/spec/faraday/request/multipart_spec.rb +274 -0
- data/spec/faraday/request/retry_spec.rb +242 -0
- data/spec/faraday/request/url_encoded_spec.rb +83 -0
- data/spec/faraday/request_spec.rb +109 -0
- data/spec/faraday/response/logger_spec.rb +220 -0
- data/spec/faraday/response/middleware_spec.rb +68 -0
- data/spec/faraday/response/raise_error_spec.rb +106 -0
- data/spec/faraday/response_spec.rb +75 -0
- data/spec/faraday/utils/headers_spec.rb +82 -0
- data/spec/faraday/utils_spec.rb +56 -0
- data/spec/faraday_spec.rb +37 -0
- data/spec/spec_helper.rb +132 -0
- data/spec/support/disabling_stub.rb +14 -0
- data/spec/support/fake_safe_buffer.rb +15 -0
- data/spec/support/helper_methods.rb +133 -0
- data/spec/support/shared_examples/adapter.rb +104 -0
- data/spec/support/shared_examples/params_encoder.rb +18 -0
- data/spec/support/shared_examples/request_method.rb +234 -0
- data/spec/support/streaming_response_checker.rb +35 -0
- data/spec/support/webmock_rack_app.rb +68 -0
- metadata +78 -9
- data/lib/faraday/upload_io.rb +0 -67
metadata
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- "@technoweenie"
|
8
|
+
- "@iMacTia"
|
9
|
+
- "@olleolleolle"
|
8
10
|
autorequire:
|
9
11
|
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date:
|
13
|
+
date: 2020-03-29 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: multipart-post
|
@@ -36,8 +38,12 @@ executables: []
|
|
36
38
|
extensions: []
|
37
39
|
extra_rdoc_files: []
|
38
40
|
files:
|
41
|
+
- CHANGELOG.md
|
39
42
|
- LICENSE.md
|
40
43
|
- README.md
|
44
|
+
- Rakefile
|
45
|
+
- examples/client_spec.rb
|
46
|
+
- examples/client_test.rb
|
41
47
|
- lib/faraday.rb
|
42
48
|
- lib/faraday/adapter.rb
|
43
49
|
- lib/faraday/adapter/em_http.rb
|
@@ -52,11 +58,24 @@ files:
|
|
52
58
|
- lib/faraday/adapter/rack.rb
|
53
59
|
- lib/faraday/adapter/test.rb
|
54
60
|
- lib/faraday/adapter/typhoeus.rb
|
61
|
+
- lib/faraday/adapter_registry.rb
|
55
62
|
- lib/faraday/autoload.rb
|
56
63
|
- lib/faraday/connection.rb
|
64
|
+
- lib/faraday/dependency_loader.rb
|
65
|
+
- lib/faraday/encoders/flat_params_encoder.rb
|
66
|
+
- lib/faraday/encoders/nested_params_encoder.rb
|
57
67
|
- lib/faraday/error.rb
|
68
|
+
- lib/faraday/file_part.rb
|
69
|
+
- lib/faraday/logging/formatter.rb
|
58
70
|
- lib/faraday/middleware.rb
|
71
|
+
- lib/faraday/middleware_registry.rb
|
59
72
|
- lib/faraday/options.rb
|
73
|
+
- lib/faraday/options/connection_options.rb
|
74
|
+
- lib/faraday/options/env.rb
|
75
|
+
- lib/faraday/options/proxy_options.rb
|
76
|
+
- lib/faraday/options/request_options.rb
|
77
|
+
- lib/faraday/options/ssl_options.rb
|
78
|
+
- lib/faraday/param_part.rb
|
60
79
|
- lib/faraday/parameters.rb
|
61
80
|
- lib/faraday/rack_builder.rb
|
62
81
|
- lib/faraday/request.rb
|
@@ -70,29 +89,79 @@ files:
|
|
70
89
|
- lib/faraday/response.rb
|
71
90
|
- lib/faraday/response/logger.rb
|
72
91
|
- lib/faraday/response/raise_error.rb
|
73
|
-
- lib/faraday/upload_io.rb
|
74
92
|
- lib/faraday/utils.rb
|
75
|
-
|
93
|
+
- lib/faraday/utils/headers.rb
|
94
|
+
- lib/faraday/utils/params_hash.rb
|
95
|
+
- spec/external_adapters/faraday_specs_setup.rb
|
96
|
+
- spec/faraday/adapter/em_http_spec.rb
|
97
|
+
- spec/faraday/adapter/em_synchrony_spec.rb
|
98
|
+
- spec/faraday/adapter/excon_spec.rb
|
99
|
+
- spec/faraday/adapter/httpclient_spec.rb
|
100
|
+
- spec/faraday/adapter/net_http_persistent_spec.rb
|
101
|
+
- spec/faraday/adapter/net_http_spec.rb
|
102
|
+
- spec/faraday/adapter/patron_spec.rb
|
103
|
+
- spec/faraday/adapter/rack_spec.rb
|
104
|
+
- spec/faraday/adapter/typhoeus_spec.rb
|
105
|
+
- spec/faraday/adapter_registry_spec.rb
|
106
|
+
- spec/faraday/adapter_spec.rb
|
107
|
+
- spec/faraday/composite_read_io_spec.rb
|
108
|
+
- spec/faraday/connection_spec.rb
|
109
|
+
- spec/faraday/error_spec.rb
|
110
|
+
- spec/faraday/middleware_spec.rb
|
111
|
+
- spec/faraday/options/env_spec.rb
|
112
|
+
- spec/faraday/options/options_spec.rb
|
113
|
+
- spec/faraday/options/proxy_options_spec.rb
|
114
|
+
- spec/faraday/options/request_options_spec.rb
|
115
|
+
- spec/faraday/params_encoders/flat_spec.rb
|
116
|
+
- spec/faraday/params_encoders/nested_spec.rb
|
117
|
+
- spec/faraday/rack_builder_spec.rb
|
118
|
+
- spec/faraday/request/authorization_spec.rb
|
119
|
+
- spec/faraday/request/instrumentation_spec.rb
|
120
|
+
- spec/faraday/request/multipart_spec.rb
|
121
|
+
- spec/faraday/request/retry_spec.rb
|
122
|
+
- spec/faraday/request/url_encoded_spec.rb
|
123
|
+
- spec/faraday/request_spec.rb
|
124
|
+
- spec/faraday/response/logger_spec.rb
|
125
|
+
- spec/faraday/response/middleware_spec.rb
|
126
|
+
- spec/faraday/response/raise_error_spec.rb
|
127
|
+
- spec/faraday/response_spec.rb
|
128
|
+
- spec/faraday/utils/headers_spec.rb
|
129
|
+
- spec/faraday/utils_spec.rb
|
130
|
+
- spec/faraday_spec.rb
|
131
|
+
- spec/spec_helper.rb
|
132
|
+
- spec/support/disabling_stub.rb
|
133
|
+
- spec/support/fake_safe_buffer.rb
|
134
|
+
- spec/support/helper_methods.rb
|
135
|
+
- spec/support/shared_examples/adapter.rb
|
136
|
+
- spec/support/shared_examples/params_encoder.rb
|
137
|
+
- spec/support/shared_examples/request_method.rb
|
138
|
+
- spec/support/streaming_response_checker.rb
|
139
|
+
- spec/support/webmock_rack_app.rb
|
140
|
+
homepage: https://lostisland.github.io/faraday
|
76
141
|
licenses:
|
77
142
|
- MIT
|
78
|
-
metadata:
|
143
|
+
metadata:
|
144
|
+
homepage_uri: https://lostisland.github.io/faraday
|
145
|
+
changelog_uri: https://github.com/lostisland/faraday/releases/tag/v1.0.1
|
146
|
+
source_code_uri: https://github.com/lostisland/faraday
|
147
|
+
bug_tracker_uri: https://github.com/lostisland/faraday/issues
|
79
148
|
post_install_message:
|
80
149
|
rdoc_options: []
|
81
150
|
require_paths:
|
82
151
|
- lib
|
152
|
+
- spec/external_adapters
|
83
153
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
154
|
requirements:
|
85
155
|
- - ">="
|
86
156
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
157
|
+
version: '2.3'
|
88
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
159
|
requirements:
|
90
160
|
- - ">="
|
91
161
|
- !ruby/object:Gem::Version
|
92
162
|
version: '0'
|
93
163
|
requirements: []
|
94
|
-
|
95
|
-
rubygems_version: 2.7.7
|
164
|
+
rubygems_version: 3.0.3
|
96
165
|
signing_key:
|
97
166
|
specification_version: 4
|
98
167
|
summary: HTTP/REST API client library.
|
data/lib/faraday/upload_io.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'composite_io'
|
3
|
-
require 'parts'
|
4
|
-
require 'stringio'
|
5
|
-
rescue LoadError
|
6
|
-
$stderr.puts "Install the multipart-post gem."
|
7
|
-
raise
|
8
|
-
end
|
9
|
-
|
10
|
-
module Faraday
|
11
|
-
# Similar but not compatible with ::CompositeReadIO provided by multipart-post.
|
12
|
-
class CompositeReadIO
|
13
|
-
def initialize(*parts)
|
14
|
-
@parts = parts.flatten
|
15
|
-
@ios = @parts.map { |part| part.to_io }
|
16
|
-
@index = 0
|
17
|
-
end
|
18
|
-
|
19
|
-
def length
|
20
|
-
@parts.inject(0) { |sum, part| sum + part.length }
|
21
|
-
end
|
22
|
-
|
23
|
-
def rewind
|
24
|
-
@ios.each { |io| io.rewind }
|
25
|
-
@index = 0
|
26
|
-
end
|
27
|
-
|
28
|
-
# Read from IOs in order until `length` bytes have been received.
|
29
|
-
def read(length = nil, outbuf = nil)
|
30
|
-
got_result = false
|
31
|
-
outbuf = outbuf ? outbuf.replace("") : ""
|
32
|
-
|
33
|
-
while io = current_io
|
34
|
-
if result = io.read(length)
|
35
|
-
got_result ||= !result.nil?
|
36
|
-
result.force_encoding("BINARY") if result.respond_to?(:force_encoding)
|
37
|
-
outbuf << result
|
38
|
-
length -= result.length if length
|
39
|
-
break if length == 0
|
40
|
-
end
|
41
|
-
advance_io
|
42
|
-
end
|
43
|
-
(!got_result && length) ? nil : outbuf
|
44
|
-
end
|
45
|
-
|
46
|
-
def close
|
47
|
-
@ios.each { |io| io.close }
|
48
|
-
end
|
49
|
-
|
50
|
-
def ensure_open_and_readable
|
51
|
-
# Rubinius compatibility
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def current_io
|
57
|
-
@ios[@index]
|
58
|
-
end
|
59
|
-
|
60
|
-
def advance_io
|
61
|
-
@index += 1
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
UploadIO = ::UploadIO
|
66
|
-
Parts = ::Parts
|
67
|
-
end
|