wreq 1.0.0-aarch64-linux

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.
@@ -0,0 +1,516 @@
1
+ # frozen_string_literal: true
2
+
3
+ unless defined?(Wreq)
4
+ module Wreq
5
+ # HTTP client with extensive configuration options.
6
+ #
7
+ # This class wraps a native Rust implementation providing high-performance
8
+ # HTTP/1.1 and HTTP/2 client functionality with support for connection pooling,
9
+ # compression, redirects, proxies, and fine-grained timeout controls.
10
+ #
11
+ # The client is thread-safe and maintains an internal connection pool for
12
+ # efficient request reuse.
13
+ #
14
+ # @example Basic usage
15
+ # client = Wreq::Client.new
16
+ # # Use client for HTTP requests
17
+ #
18
+ # @example With common options
19
+ # client = Wreq::Client.new(
20
+ # user_agent: "MyApp/1.0",
21
+ # timeout: 30,
22
+ # gzip: true,
23
+ # brotli: true
24
+ # )
25
+ #
26
+ # @see https://github.com/your-repo/wreq-ruby Full documentation
27
+ class Client
28
+ # Create a new HTTP client instance.
29
+ #
30
+ # All options are optional. Time-related numeric values are expressed in seconds.
31
+ #
32
+ # @param emulation [Wreq::Emulation, nil] Device and OS emulation settings.
33
+ # If specified, the client will modify request headers and behaviors
34
+ #
35
+ # @param user_agent [String, nil] Custom User-Agent header value.
36
+ # If not specified, a default user agent will be used.
37
+ #
38
+ # @param headers [Hash{String=>String}, nil] Default headers to include
39
+ # in every request. Header names are case-insensitive. These headers
40
+ # can be overridden on a per-request basis.
41
+ #
42
+ # @param referer [Boolean, nil] Whether to automatically send Referer
43
+ # headers when following redirects. When true, the previous URL will
44
+ # be sent as the Referer header.
45
+ #
46
+ # @param allow_redirects [Boolean, nil] Enable automatic following of
47
+ # HTTP redirects (3xx status codes). When false, redirect responses
48
+ # will be returned directly to the caller.
49
+ #
50
+ # @param max_redirects [Integer, nil] Maximum number of redirects to
51
+ # follow before returning an error. Only applies when allow_redirects
52
+ # is true. Default is typically 10 if not specified.
53
+ #
54
+ # @param cookie_store [Boolean, nil] Enable an in-memory cookie jar
55
+ # that automatically handles Set-Cookie headers and sends appropriate
56
+ # Cookie headers on subsequent requests.
57
+ #
58
+ # @param cookie_provider [Wreq::Jar, nil] Custom cookie jar provider
59
+ # used to store and retrieve cookies for all requests made by this
60
+ # client. Typically used together with `cookie_store: true`.
61
+ #
62
+ # @param timeout [Integer, nil] Overall timeout for the entire request
63
+ # in seconds, including connection establishment, request transmission,
64
+ # and response reading. If not set, requests may wait indefinitely.
65
+ #
66
+ # @param connect_timeout [Integer, nil] Maximum time in seconds to wait
67
+ # when establishing a connection to the remote server. This is separate
68
+ # from the overall timeout.
69
+ #
70
+ # @param read_timeout [Integer, nil] Maximum time in seconds to wait
71
+ # between reading chunks of data from the server. Applies to each
72
+ # read operation, not the entire response.
73
+ #
74
+ # @param tcp_keepalive [Integer, nil] Time in seconds that a connection
75
+ # must be idle before TCP keepalive probes are sent. Helps detect
76
+ # broken connections.
77
+ #
78
+ # @param tcp_keepalive_interval [Integer, nil] Time in seconds between
79
+ # individual TCP keepalive probes. Only relevant if tcp_keepalive is set.
80
+ #
81
+ # @param tcp_keepalive_retries [Integer, nil] Number of failed keepalive
82
+ # probes before the connection is considered dead and closed.
83
+ #
84
+ # @param tcp_user_timeout [Integer, nil] Maximum time in seconds that
85
+ # transmitted data may remain unacknowledged before the connection is
86
+ # forcibly closed. Linux-specific option (Android, Fuchsia, Linux only).
87
+ #
88
+ # @param tcp_nodelay [Boolean, nil] Enable TCP_NODELAY socket option,
89
+ # which disables Nagle's algorithm. When true, small packets are sent
90
+ # immediately rather than being buffered. Useful for reducing latency
91
+ # in interactive protocols.
92
+ #
93
+ # @param tcp_reuse_address [Boolean, nil] Enable SO_REUSEADDR socket option,
94
+ # allowing the reuse of local addresses in TIME_WAIT state. Useful for
95
+ # reducing port exhaustion in high-throughput scenarios.
96
+ #
97
+ # @param pool_idle_timeout [Integer, nil] Time in seconds before idle
98
+ # connections in the pool are evicted and closed. Helps free up
99
+ # resources for long-running applications.
100
+ #
101
+ # @param pool_max_idle_per_host [Integer, nil] Maximum number of idle
102
+ # connections to maintain per host in the connection pool. Connections
103
+ # beyond this limit will be closed immediately after use.
104
+ #
105
+ # @param pool_max_size [Integer, nil] Total maximum size of the connection
106
+ # pool across all hosts. Once reached, new requests may need to wait
107
+ # for existing connections to become available.
108
+ #
109
+ # @param http1_only [Boolean, nil] Force the client to use HTTP/1.1 only,
110
+ # even if HTTP/2 is available. Useful for compatibility with servers
111
+ # that have problematic HTTP/2 implementations.
112
+ #
113
+ # @param http2_only [Boolean, nil] Force the client to use HTTP/2 only.
114
+ # Requests to servers that don't support HTTP/2 will fail. Cannot be
115
+ # combined with http1_only.
116
+ #
117
+ # @param https_only [Boolean, nil] Reject plain HTTP connections and
118
+ # only allow HTTPS. Provides an additional layer of security by
119
+ # preventing accidental cleartext connections.
120
+ #
121
+ # @param verify [Boolean, nil] Enable or disable TLS certificate
122
+ # verification. When false, the client will accept any certificate,
123
+ # including self-signed or expired ones. Should only be disabled
124
+ # for testing purposes.
125
+ #
126
+ # @param no_proxy [Boolean, nil] Disable use of any configured proxy
127
+ # for this client, even if proxy settings are detected from the
128
+ # environment.
129
+ #
130
+ # @param proxy [String, nil] Proxy server URI to use for all requests.
131
+ # Supports HTTP, HTTPS, and SOCKS5 proxies. Format: "protocol://host:port"
132
+ # Example: "http://proxy.example.com:8080"
133
+ # @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable.
134
+ # @param interface [String, nil] Bind the socket to a specific network interface via `SO_BINDTODEVICE` (e.g., "eth0", "wlan0", "tun0"). Effective only on systems that support the option (Linux/Android/Fuchsia) and typically requires privileges (root or CAP_NET_ADMIN).
135
+ #
136
+ # @param gzip [Boolean, nil] Accept and automatically decompress gzip
137
+ # content encoding. When true, adds "Accept-Encoding: gzip" header.
138
+ #
139
+ # @param brotli [Boolean, nil] Accept and automatically decompress Brotli
140
+ # content encoding. When true, adds "Accept-Encoding: br" header.
141
+ # Provides better compression than gzip.
142
+ #
143
+ # @param deflate [Boolean, nil] Accept and automatically decompress deflate
144
+ # content encoding. When true, adds "Accept-Encoding: deflate" header.
145
+ #
146
+ # @param zstd [Boolean, nil] Accept and automatically decompress Zstandard
147
+ # content encoding. When true, adds "Accept-Encoding: zstd" header.
148
+ # Modern compression algorithm with excellent performance.
149
+ #
150
+ # @return [Wreq::Client] A configured HTTP client instance ready to make requests.
151
+ #
152
+ # @raise [ArgumentError] if incompatible options are specified together
153
+ # (e.g., http1_only and http2_only both true).
154
+ # @raise [RuntimeError] if the underlying client cannot be initialized
155
+ # due to system resource constraints or invalid configuration.
156
+ #
157
+ # @example Minimal client
158
+ # client = Wreq::Client.new
159
+ #
160
+ # @example Client with custom headers
161
+ # client = Wreq::Client.new(
162
+ # user_agent: "MyApp/2.0 (https://example.com)",
163
+ # headers: {
164
+ # "Accept" => "application/json",
165
+ # "X-API-Key" => "secret-key-here"
166
+ # }
167
+ # )
168
+ #
169
+ # @example Client with timeouts
170
+ # client = Wreq::Client.new(
171
+ # timeout: 30, # 30 seconds total
172
+ # connect_timeout: 5, # 5 seconds to connect
173
+ # read_timeout: 10 # 10 seconds between reads
174
+ # )
175
+ #
176
+ # @example Client with redirect handling
177
+ # client = Wreq::Client.new(
178
+ # allow_redirects: true,
179
+ # max_redirects: 5,
180
+ # referer: true,
181
+ # history: true
182
+ # )
183
+ #
184
+ # @example Client with compression
185
+ # client = Wreq::Client.new(
186
+ # gzip: true,
187
+ # brotli: true,
188
+ # zstd: true
189
+ # )
190
+ #
191
+ # @example Client with proxy
192
+ # client = Wreq::Client.new(
193
+ # proxy: "http://proxy.corp.com:8080"
194
+ # )
195
+ #
196
+ # @example Client with SOCKS5 proxy
197
+ # client = Wreq::Client.new(
198
+ # proxy: "socks5://localhost:1080"
199
+ # )
200
+ #
201
+ # @example HTTPS-only client with strict verification
202
+ # client = Wreq::Client.new(
203
+ # https_only: true,
204
+ # verify: true
205
+ # )
206
+ #
207
+ # @example HTTP/2 optimized client
208
+ # client = Wreq::Client.new(
209
+ # http2_only: true,
210
+ # tcp_nodelay: true
211
+ # )
212
+ #
213
+ # @example Connection pool tuning
214
+ # client = Wreq::Client.new(
215
+ # pool_max_idle_per_host: 32,
216
+ # pool_idle_timeout: 90,
217
+ # pool_max_size: 128
218
+ # )
219
+ #
220
+ # @example TCP keepalive configuration
221
+ # client = Wreq::Client.new(
222
+ # tcp_keepalive: 60,
223
+ # tcp_keepalive_interval: 10,
224
+ # tcp_keepalive_retries: 3
225
+ # )
226
+ #
227
+ # @example Development/testing client (insecure)
228
+ # client = Wreq::Client.new(
229
+ # verify: false, # WARNING: Do not use in production!
230
+ # timeout: 5
231
+ # )
232
+ def self.new(**options)
233
+ end
234
+
235
+ # Send an HTTP request.
236
+ #
237
+ # @param method [Wreq::Method] HTTP method to use
238
+ # @param url [String] Target URL
239
+ # @param headers [Hash{String=>String}, nil] Custom headers for this request
240
+ # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
241
+ # @param default_headers [Hash{String=>String}, nil] Default headers to merge
242
+ # @param query [Hash, nil] URL query parameters
243
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
244
+ # @param json [Object, nil] JSON body (will be serialized)
245
+ # @param body [String, IO, nil] Raw request body (string or stream)
246
+ # @param auth [String, nil] Authorization header value
247
+ # @param bearer_auth [String, nil] Bearer token for Authorization header
248
+ # @param basic_auth [Array<String>, nil] Username and password for basic auth
249
+ # @param cookies [Array<String>, nil] Cookies to send
250
+ # @param allow_redirects [Boolean, nil] Whether to follow redirects
251
+ # @param max_redirects [Integer, nil] Maximum number of redirects to follow
252
+ # @param gzip [Boolean, nil] Enable gzip compression
253
+ # @param brotli [Boolean, nil] Enable Brotli compression
254
+ # @param deflate [Boolean, nil] Enable deflate compression
255
+ # @param zstd [Boolean, nil] Enable Zstandard compression
256
+ # @param timeout [Integer, nil] Total request timeout (seconds)
257
+ # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
258
+ # @param proxy [String, nil] Proxy server URI
259
+ # @param local_address [String, nil] Bind the client's local source IP address (IPv4/IPv6). Useful on multi-homed hosts to originate connections from a specific address or enforce source routing. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable or the connection may fail.
260
+ # @param interface [String, nil] Bind the socket to a specific network interface via `SO_BINDTODEVICE` (e.g., "eth0", "wlan0", "tun0"). Effective only on systems that support the option (Linux/Android/Fuchsia) and typically requires privileges (root or CAP_NET_ADMIN).
261
+ # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
262
+ # @param version [Wreq::Version, nil] HTTP version to use
263
+ # @return [Wreq::Response] HTTP response
264
+ def request(method, url, **options)
265
+ end
266
+
267
+ # Send an HTTP GET request.
268
+ #
269
+ # @param url [String] Target URL
270
+ # @param headers [Hash{String=>String}, nil] Custom headers for this request
271
+ # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
272
+ # @param default_headers [Hash{String=>String}, nil] Default headers to merge
273
+ # @param query [Hash, nil] URL query parameters
274
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
275
+ # @param json [Object, nil] JSON body (will be serialized)
276
+ # @param body [String, IO, nil] Raw request body (string or stream)
277
+ # @param auth [String, nil] Authorization header value
278
+ # @param bearer_auth [String, nil] Bearer token for Authorization header
279
+ # @param basic_auth [Array<String>, nil] Username and password for basic auth
280
+ # @param cookies [Array<String>, nil] Cookies to send
281
+ # @param allow_redirects [Boolean, nil] Whether to follow redirects
282
+ # @param max_redirects [Integer, nil] Maximum number of redirects to follow
283
+ # @param gzip [Boolean, nil] Enable gzip compression
284
+ # @param brotli [Boolean, nil] Enable Brotli compression
285
+ # @param deflate [Boolean, nil] Enable deflate compression
286
+ # @param zstd [Boolean, nil] Enable Zstandard compression
287
+ # @param timeout [Integer, nil] Total request timeout (seconds)
288
+ # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
289
+ # @param proxy [String, nil] Proxy server URI
290
+ # @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate GET requests from a specific address. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1". The address must exist on the host and be routable.
291
+ # @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE` (e.g., "eth0", "wlan0", "tun0"). Supported on Linux/Android/Fuchsia; typically requires privileges.
292
+ # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
293
+ # @param version [Wreq::Version, nil] HTTP version to use
294
+ # @return [Wreq::Response] HTTP response
295
+ def get(url, **options)
296
+ end
297
+
298
+ # Send an HTTP HEAD request.
299
+ #
300
+ # @param url [String] Target URL
301
+ # @param headers [Hash{String=>String}, nil] Custom headers for this request
302
+ # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
303
+ # @param default_headers [Hash{String=>String}, nil] Default headers to merge
304
+ # @param query [Hash, nil] URL query parameters
305
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
306
+ # @param json [Object, nil] JSON body (will be serialized)
307
+ # @param body [String, IO, nil] Raw request body (string or stream)
308
+ # @param auth [String, nil] Authorization header value
309
+ # @param bearer_auth [String, nil] Bearer token for Authorization header
310
+ # @param basic_auth [Array<String>, nil] Username and password for basic auth
311
+ # @param cookies [Array<String>, nil] Cookies to send
312
+ # @param allow_redirects [Boolean, nil] Whether to follow redirects
313
+ # @param max_redirects [Integer, nil] Maximum number of redirects to follow
314
+ # @param gzip [Boolean, nil] Enable gzip compression
315
+ # @param brotli [Boolean, nil] Enable Brotli compression
316
+ # @param deflate [Boolean, nil] Enable deflate compression
317
+ # @param zstd [Boolean, nil] Enable Zstandard compression
318
+ # @param timeout [Integer, nil] Total request timeout (seconds)
319
+ # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
320
+ # @param proxy [String, nil] Proxy server URI
321
+ # @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate HEAD requests from a specific address. Examples: "192.168.1.10", "10.0.0.5", "2001:db8::1".
322
+ # @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE` (e.g., "eth0", "wlan0", "tun0").
323
+ # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
324
+ # @param version [Wreq::Version, nil] HTTP version to use
325
+ # @return [Wreq::Response] HTTP response
326
+ def head(url, **options)
327
+ end
328
+
329
+ # Send an HTTP POST request.
330
+ #
331
+ # @param url [String] Target URL
332
+ # @param headers [Hash{String=>String}, nil] Custom headers for this request
333
+ # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
334
+ # @param default_headers [Hash{String=>String}, nil] Default headers to merge
335
+ # @param query [Hash, nil] URL query parameters
336
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
337
+ # @param json [Object, nil] JSON body (will be serialized)
338
+ # @param body [String, IO, nil] Raw request body (string or stream)
339
+ # @param auth [String, nil] Authorization header value
340
+ # @param bearer_auth [String, nil] Bearer token for Authorization header
341
+ # @param basic_auth [Array<String>, nil] Username and password for basic auth
342
+ # @param cookies [Array<String>, nil] Cookies to send
343
+ # @param allow_redirects [Boolean, nil] Whether to follow redirects
344
+ # @param max_redirects [Integer, nil] Maximum number of redirects to follow
345
+ # @param gzip [Boolean, nil] Enable gzip compression
346
+ # @param brotli [Boolean, nil] Enable Brotli compression
347
+ # @param deflate [Boolean, nil] Enable deflate compression
348
+ # @param zstd [Boolean, nil] Enable Zstandard compression
349
+ # @param timeout [Integer, nil] Total request timeout (seconds)
350
+ # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
351
+ # @param proxy [String, nil] Proxy server URI
352
+ # @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate POST requests from a specific address.
353
+ # @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
354
+ # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
355
+ # @param version [Wreq::Version, nil] HTTP version to use
356
+ # @return [Wreq::Response] HTTP response
357
+ def post(url, **options)
358
+ end
359
+
360
+ # Send an HTTP PUT request.
361
+ #
362
+ # @param url [String] Target URL
363
+ # @param headers [Hash{String=>String}, nil] Custom headers for this request
364
+ # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
365
+ # @param default_headers [Hash{String=>String}, nil] Default headers to merge
366
+ # @param query [Hash, nil] URL query parameters
367
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
368
+ # @param json [Object, nil] JSON body (will be serialized)
369
+ # @param body [String, IO, nil] Raw request body (string or stream)
370
+ # @param auth [String, nil] Authorization header value
371
+ # @param bearer_auth [String, nil] Bearer token for Authorization header
372
+ # @param basic_auth [Array<String>, nil] Username and password for basic auth
373
+ # @param cookies [Array<String>, nil] Cookies to send
374
+ # @param allow_redirects [Boolean, nil] Whether to follow redirects
375
+ # @param max_redirects [Integer, nil] Maximum number of redirects to follow
376
+ # @param gzip [Boolean, nil] Enable gzip compression
377
+ # @param brotli [Boolean, nil] Enable Brotli compression
378
+ # @param deflate [Boolean, nil] Enable deflate compression
379
+ # @param zstd [Boolean, nil] Enable Zstandard compression
380
+ # @param timeout [Integer, nil] Total request timeout (seconds)
381
+ # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
382
+ # @param proxy [String, nil] Proxy server URI
383
+ # @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate PUT requests from a specific address.
384
+ # @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
385
+ # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
386
+ # @param version [Wreq::Version, nil] HTTP version to use
387
+ # @return [Wreq::Response] HTTP response
388
+ def put(url, **options)
389
+ end
390
+
391
+ # Send an HTTP DELETE request.
392
+ #
393
+ # @param url [String] Target URL
394
+ # @param headers [Hash{String=>String}, nil] Custom headers for this request
395
+ # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
396
+ # @param default_headers [Hash{String=>String}, nil] Default headers to merge
397
+ # @param query [Hash, nil] URL query parameters
398
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
399
+ # @param json [Object, nil] JSON body (will be serialized)
400
+ # @param body [String, IO, nil] Raw request body (string or stream)
401
+ # @param auth [String, nil] Authorization header value
402
+ # @param bearer_auth [String, nil] Bearer token for Authorization header
403
+ # @param basic_auth [Array<String>, nil] Username and password for basic auth
404
+ # @param cookies [Array<String>, nil] Cookies to send
405
+ # @param allow_redirects [Boolean, nil] Whether to follow redirects
406
+ # @param max_redirects [Integer, nil] Maximum number of redirects to follow
407
+ # @param gzip [Boolean, nil] Enable gzip compression
408
+ # @param brotli [Boolean, nil] Enable Brotli compression
409
+ # @param deflate [Boolean, nil] Enable deflate compression
410
+ # @param zstd [Boolean, nil] Enable Zstandard compression
411
+ # @param timeout [Integer, nil] Total request timeout (seconds)
412
+ # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
413
+ # @param proxy [String, nil] Proxy server URI
414
+ # @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate DELETE requests from a specific address.
415
+ # @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
416
+ # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
417
+ # @param version [Wreq::Version, nil] HTTP version to use
418
+ # @return [Wreq::Response] HTTP response
419
+ def delete(url, **options)
420
+ end
421
+
422
+ # Send an HTTP OPTIONS request.
423
+ #
424
+ # @param url [String] Target URL
425
+ # @param headers [Hash{String=>String}, nil] Custom headers for this request
426
+ # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
427
+ # @param default_headers [Hash{String=>String}, nil] Default headers to merge
428
+ # @param query [Hash, nil] URL query parameters
429
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
430
+ # @param json [Object, nil] JSON body (will be serialized)
431
+ # @param body [String, IO, nil] Raw request body (string or stream)
432
+ # @param auth [String, nil] Authorization header value
433
+ # @param bearer_auth [String, nil] Bearer token for Authorization header
434
+ # @param basic_auth [Array<String>, nil] Username and password for basic auth
435
+ # @param cookies [Array<String>, nil] Cookies to send
436
+ # @param allow_redirects [Boolean, nil] Whether to follow redirects
437
+ # @param max_redirects [Integer, nil] Maximum number of redirects to follow
438
+ # @param gzip [Boolean, nil] Enable gzip compression
439
+ # @param brotli [Boolean, nil] Enable Brotli compression
440
+ # @param deflate [Boolean, nil] Enable deflate compression
441
+ # @param zstd [Boolean, nil] Enable Zstandard compression
442
+ # @param timeout [Integer, nil] Total request timeout (seconds)
443
+ # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
444
+ # @param proxy [String, nil] Proxy server URI
445
+ # @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate OPTIONS requests from a specific address.
446
+ # @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
447
+ # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
448
+ # @param version [Wreq::Version, nil] HTTP version to use
449
+ # @return [Wreq::Response] HTTP response
450
+ def options(url, **options)
451
+ end
452
+
453
+ # Send an HTTP TRACE request.
454
+ #
455
+ # @param url [String] Target URL
456
+ # @param headers [Hash{String=>String}, nil] Custom headers for this request
457
+ # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
458
+ # @param default_headers [Hash{String=>String}, nil] Default headers to merge
459
+ # @param query [Hash, nil] URL query parameters
460
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
461
+ # @param json [Object, nil] JSON body (will be serialized)
462
+ # @param body [String, IO, nil] Raw request body (string or stream)
463
+ # @param auth [String, nil] Authorization header value
464
+ # @param bearer_auth [String, nil] Bearer token for Authorization header
465
+ # @param basic_auth [Array<String>, nil] Username and password for basic auth
466
+ # @param cookies [Array<String>, nil] Cookies to send
467
+ # @param allow_redirects [Boolean, nil] Whether to follow redirects
468
+ # @param max_redirects [Integer, nil] Maximum number of redirects to follow
469
+ # @param gzip [Boolean, nil] Enable gzip compression
470
+ # @param brotli [Boolean, nil] Enable Brotli compression
471
+ # @param deflate [Boolean, nil] Enable deflate compression
472
+ # @param zstd [Boolean, nil] Enable Zstandard compression
473
+ # @param timeout [Integer, nil] Total request timeout (seconds)
474
+ # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
475
+ # @param proxy [String, nil] Proxy server URI
476
+ # @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate OPTIONS requests from a specific address.
477
+ # @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
478
+ # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
479
+ # @param version [Wreq::Version, nil] HTTP version to use
480
+ # @return [Wreq::Response] HTTP response
481
+ def trace(url, **options)
482
+ end
483
+
484
+ # Send an HTTP PATCH request.
485
+ #
486
+ # @param url [String] Target URL
487
+ # @param headers [Hash{String=>String}, nil] Custom headers for this request
488
+ # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
489
+ # @param default_headers [Hash{String=>String}, nil] Default headers to merge
490
+ # @param query [Hash, nil] URL query parameters
491
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
492
+ # @param json [Object, nil] JSON body (will be serialized)
493
+ # @param body [String, IO, nil] Raw request body (string or stream)
494
+ # @param auth [String, nil] Authorization header value
495
+ # @param bearer_auth [String, nil] Bearer token for Authorization header
496
+ # @param basic_auth [Array<String>, nil] Username and password for basic auth
497
+ # @param cookies [Array<String>, nil] Cookies to send
498
+ # @param allow_redirects [Boolean, nil] Whether to follow redirects
499
+ # @param max_redirects [Integer, nil] Maximum number of redirects to follow
500
+ # @param gzip [Boolean, nil] Enable gzip compression
501
+ # @param brotli [Boolean, nil] Enable Brotli compression
502
+ # @param deflate [Boolean, nil] Enable deflate compression
503
+ # @param zstd [Boolean, nil] Enable Zstandard compression
504
+ # @param timeout [Integer, nil] Total request timeout (seconds)
505
+ # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
506
+ # @param proxy [String, nil] Proxy server URI
507
+ # @param local_address [String, nil] Bind the request's local source IP address (IPv4/IPv6). Useful to originate OPTIONS requests from a specific address.
508
+ # @param interface [String, nil] Bind the socket to a network interface via `SO_BINDTODEVICE`.
509
+ # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
510
+ # @param version [Wreq::Version, nil] HTTP version to use
511
+ # @return [Wreq::Response] HTTP response
512
+ def patch(url, **options)
513
+ end
514
+ end
515
+ end
516
+ end
@@ -0,0 +1,144 @@
1
+ unless defined?(Wreq)
2
+ module Wreq
3
+ # Cookie SameSite attribute.
4
+ #
5
+ # Values follow the Rust enum exposed by the native extension.
6
+ class SameSite
7
+ # Lax same-site policy.
8
+ Strict = nil
9
+ # Strict same-site policy.
10
+ Lax = nil
11
+ # None same-site policy.
12
+ None = nil
13
+ end
14
+
15
+ # A single HTTP cookie.
16
+ #
17
+ # Thread-safe: instances are backed by an immutable Rust value and can be
18
+ # shared across threads safely. This mirrors the native `Wreq::Cookie`.
19
+ # Constructor accepts `name`, `value`, plus optional keyword arguments for
20
+ # other attributes.
21
+ class Cookie
22
+ # Create a new Cookie instance.
23
+ #
24
+ # Note: This matches the native binding which defines `new` (not `initialize`).
25
+ #
26
+ # @param name [String] Cookie name
27
+ # @param value [String] Cookie value
28
+ # @param options [Hash] Optional keyword arguments
29
+ # @option options [String] :domain Domain attribute
30
+ # @option options [String] :path Path attribute
31
+ # @option options [Integer] :max_age Max-Age in seconds
32
+ # @option options [Float] :expires Unix timestamp (seconds, float)
33
+ # @option options [Boolean] :http_only HttpOnly flag
34
+ # @option options [Boolean] :secure Secure flag
35
+ # @option options [Wreq::SameSite] :same_site SameSite attribute
36
+ # @return [Wreq::Cookie]
37
+ # @example
38
+ # c = Wreq::Cookie.new(
39
+ # "sid", "abc",
40
+ # domain: "example.com",
41
+ # path: "/",
42
+ # max_age: 3600,
43
+ # http_only: true,
44
+ # secure: true,
45
+ # same_site: Wreq::SameSite::Lax
46
+ # )
47
+ def self.new(name, value, **options)
48
+ end
49
+
50
+ # @return [String] Cookie name
51
+ def name
52
+ end
53
+
54
+ # @return [String] Cookie value
55
+ def value
56
+ end
57
+
58
+ # Returns true if the HttpOnly directive is enabled.
59
+ # @return [Boolean]
60
+ def http_only
61
+ end
62
+
63
+ # Predicate version of http_only.
64
+ # @return [Boolean]
65
+ def http_only?
66
+ end
67
+
68
+ # Returns true if the Secure directive is enabled.
69
+ # @return [Boolean]
70
+ def secure
71
+ end
72
+
73
+ # Predicate version of secure.
74
+ # @return [Boolean]
75
+ def secure?
76
+ end
77
+
78
+ # Returns true if SameSite is Lax.
79
+ # @return [Boolean]
80
+ def same_site_lax?
81
+ end
82
+
83
+ # Returns true if SameSite is Strict.
84
+ # @return [Boolean]
85
+ def same_site_strict?
86
+ end
87
+
88
+ # @return [String, nil] Path attribute
89
+ def path
90
+ end
91
+
92
+ # @return [String, nil] Domain attribute
93
+ def domain
94
+ end
95
+
96
+ # @return [Integer, nil] Max-Age in seconds
97
+ def max_age
98
+ end
99
+
100
+ # @return [Float, nil] Expires as Unix timestamp (seconds)
101
+ def expires
102
+ end
103
+ end
104
+
105
+ # A cookie store (jar) used by the client to manage cookies across requests.
106
+ class Jar
107
+ # Create a new, empty cookie jar.
108
+ # @return [Wreq::Jar]
109
+ def self.new
110
+ end
111
+
112
+ # Get all cookies currently stored.
113
+ # @return [Array<Wreq::Cookie>]
114
+ def get_all
115
+ end
116
+
117
+ # Add a cookie object for the given URL.
118
+ # @param cookie [Wreq::Cookie]
119
+ # @param url [String]
120
+ # @return [void]
121
+ def add_cookie(cookie, url)
122
+ end
123
+
124
+ # Add a cookie from a Set-Cookie string for the given URL.
125
+ # @param cookie [String] A Set-Cookie string
126
+ # @param url [String]
127
+ # @return [void]
128
+ def add_cookie_str(cookie, url)
129
+ end
130
+
131
+ # Remove a cookie by name for the given URL.
132
+ # @param name [String]
133
+ # @param url [String]
134
+ # @return [void]
135
+ def remove(name, url)
136
+ end
137
+
138
+ # Clear all cookies from the jar.
139
+ # @return [void]
140
+ def clear
141
+ end
142
+ end
143
+ end
144
+ end