wreq 1.1.0 → 1.2.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.
@@ -35,7 +35,7 @@ unless defined?(Wreq)
35
35
  # @param user_agent [String, nil] Custom User-Agent header value.
36
36
  # If not specified, a default user agent will be used.
37
37
  #
38
- # @param headers [Hash{String=>String}, nil] Default headers to include
38
+ # @param headers [Wreq::Headers, Hash{String=>String}, nil] Default headers to include
39
39
  # in every request. Header names are case-insensitive. These headers
40
40
  # can be overridden on a per-request basis.
41
41
  #
@@ -236,17 +236,14 @@ unless defined?(Wreq)
236
236
  #
237
237
  # @param method [Wreq::Method] HTTP method to use
238
238
  # @param url [String] Target URL
239
- # @param headers [Hash{String=>String}, nil] Custom headers for this request
239
+ # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
240
240
  # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
241
241
  # @param default_headers [Hash{String=>String}, nil] Default headers to merge
242
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
243
  # @param auth [String, nil] Authorization header value
247
244
  # @param bearer_auth [String, nil] Bearer token for Authorization header
248
245
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
249
- # @param cookies [Array<String>, nil] Cookies to send
246
+ # @param cookies [Hash{String=>String}, String, nil] Cookies to send
250
247
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
251
248
  # @param max_redirects [Integer, nil] Maximum number of redirects to follow
252
249
  # @param gzip [Boolean, nil] Enable gzip compression
@@ -256,10 +253,13 @@ unless defined?(Wreq)
256
253
  # @param timeout [Integer, nil] Total request timeout (seconds)
257
254
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
258
255
  # @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.
256
+ # @param local_address [String, nil] Bind the request'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
257
  # @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
258
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
262
259
  # @param version [Wreq::Version, nil] HTTP version to use
260
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
261
+ # @param json [Object, nil] JSON body (will be serialized)
262
+ # @param body [String, IO, nil] Raw request body (string or stream)
263
263
  # @return [Wreq::Response] HTTP response
264
264
  def request(method, url, **options)
265
265
  end
@@ -267,17 +267,14 @@ unless defined?(Wreq)
267
267
  # Send an HTTP GET request.
268
268
  #
269
269
  # @param url [String] Target URL
270
- # @param headers [Hash{String=>String}, nil] Custom headers for this request
270
+ # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
271
271
  # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
272
272
  # @param default_headers [Hash{String=>String}, nil] Default headers to merge
273
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
274
  # @param auth [String, nil] Authorization header value
278
275
  # @param bearer_auth [String, nil] Bearer token for Authorization header
279
276
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
280
- # @param cookies [Array<String>, nil] Cookies to send
277
+ # @param cookies [Hash{String=>String}, String, nil] Cookies to send
281
278
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
282
279
  # @param max_redirects [Integer, nil] Maximum number of redirects to follow
283
280
  # @param gzip [Boolean, nil] Enable gzip compression
@@ -287,10 +284,13 @@ unless defined?(Wreq)
287
284
  # @param timeout [Integer, nil] Total request timeout (seconds)
288
285
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
289
286
  # @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.
287
+ # @param local_address [String, nil] Bind the request'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.
288
+ # @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).
292
289
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
293
290
  # @param version [Wreq::Version, nil] HTTP version to use
291
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
292
+ # @param json [Object, nil] JSON body (will be serialized)
293
+ # @param body [String, IO, nil] Raw request body (string or stream)
294
294
  # @return [Wreq::Response] HTTP response
295
295
  def get(url, **options)
296
296
  end
@@ -298,17 +298,14 @@ unless defined?(Wreq)
298
298
  # Send an HTTP HEAD request.
299
299
  #
300
300
  # @param url [String] Target URL
301
- # @param headers [Hash{String=>String}, nil] Custom headers for this request
301
+ # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
302
302
  # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
303
303
  # @param default_headers [Hash{String=>String}, nil] Default headers to merge
304
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
305
  # @param auth [String, nil] Authorization header value
309
306
  # @param bearer_auth [String, nil] Bearer token for Authorization header
310
307
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
311
- # @param cookies [Array<String>, nil] Cookies to send
308
+ # @param cookies [Hash{String=>String}, String, nil] Cookies to send
312
309
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
313
310
  # @param max_redirects [Integer, nil] Maximum number of redirects to follow
314
311
  # @param gzip [Boolean, nil] Enable gzip compression
@@ -318,10 +315,13 @@ unless defined?(Wreq)
318
315
  # @param timeout [Integer, nil] Total request timeout (seconds)
319
316
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
320
317
  # @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").
318
+ # @param local_address [String, nil] Bind the request'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.
319
+ # @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).
323
320
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
324
321
  # @param version [Wreq::Version, nil] HTTP version to use
322
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
323
+ # @param json [Object, nil] JSON body (will be serialized)
324
+ # @param body [String, IO, nil] Raw request body (string or stream)
325
325
  # @return [Wreq::Response] HTTP response
326
326
  def head(url, **options)
327
327
  end
@@ -329,17 +329,14 @@ unless defined?(Wreq)
329
329
  # Send an HTTP POST request.
330
330
  #
331
331
  # @param url [String] Target URL
332
- # @param headers [Hash{String=>String}, nil] Custom headers for this request
332
+ # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
333
333
  # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
334
334
  # @param default_headers [Hash{String=>String}, nil] Default headers to merge
335
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
336
  # @param auth [String, nil] Authorization header value
340
337
  # @param bearer_auth [String, nil] Bearer token for Authorization header
341
338
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
342
- # @param cookies [Array<String>, nil] Cookies to send
339
+ # @param cookies [Hash{String=>String}, String, nil] Cookies to send
343
340
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
344
341
  # @param max_redirects [Integer, nil] Maximum number of redirects to follow
345
342
  # @param gzip [Boolean, nil] Enable gzip compression
@@ -349,10 +346,13 @@ unless defined?(Wreq)
349
346
  # @param timeout [Integer, nil] Total request timeout (seconds)
350
347
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
351
348
  # @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`.
349
+ # @param local_address [String, nil] Bind the request'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.
350
+ # @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).
354
351
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
355
352
  # @param version [Wreq::Version, nil] HTTP version to use
353
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
354
+ # @param json [Object, nil] JSON body (will be serialized)
355
+ # @param body [String, IO, nil] Raw request body (string or stream)
356
356
  # @return [Wreq::Response] HTTP response
357
357
  def post(url, **options)
358
358
  end
@@ -360,17 +360,14 @@ unless defined?(Wreq)
360
360
  # Send an HTTP PUT request.
361
361
  #
362
362
  # @param url [String] Target URL
363
- # @param headers [Hash{String=>String}, nil] Custom headers for this request
363
+ # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
364
364
  # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
365
365
  # @param default_headers [Hash{String=>String}, nil] Default headers to merge
366
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
367
  # @param auth [String, nil] Authorization header value
371
368
  # @param bearer_auth [String, nil] Bearer token for Authorization header
372
369
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
373
- # @param cookies [Array<String>, nil] Cookies to send
370
+ # @param cookies [Hash{String=>String}, String, nil] Cookies to send
374
371
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
375
372
  # @param max_redirects [Integer, nil] Maximum number of redirects to follow
376
373
  # @param gzip [Boolean, nil] Enable gzip compression
@@ -380,10 +377,13 @@ unless defined?(Wreq)
380
377
  # @param timeout [Integer, nil] Total request timeout (seconds)
381
378
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
382
379
  # @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`.
380
+ # @param local_address [String, nil] Bind the request'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.
381
+ # @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).
385
382
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
386
383
  # @param version [Wreq::Version, nil] HTTP version to use
384
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
385
+ # @param json [Object, nil] JSON body (will be serialized)
386
+ # @param body [String, IO, nil] Raw request body (string or stream)
387
387
  # @return [Wreq::Response] HTTP response
388
388
  def put(url, **options)
389
389
  end
@@ -391,17 +391,14 @@ unless defined?(Wreq)
391
391
  # Send an HTTP DELETE request.
392
392
  #
393
393
  # @param url [String] Target URL
394
- # @param headers [Hash{String=>String}, nil] Custom headers for this request
394
+ # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
395
395
  # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
396
396
  # @param default_headers [Hash{String=>String}, nil] Default headers to merge
397
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
398
  # @param auth [String, nil] Authorization header value
402
399
  # @param bearer_auth [String, nil] Bearer token for Authorization header
403
400
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
404
- # @param cookies [Array<String>, nil] Cookies to send
401
+ # @param cookies [Hash{String=>String}, String, nil] Cookies to send
405
402
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
406
403
  # @param max_redirects [Integer, nil] Maximum number of redirects to follow
407
404
  # @param gzip [Boolean, nil] Enable gzip compression
@@ -411,10 +408,13 @@ unless defined?(Wreq)
411
408
  # @param timeout [Integer, nil] Total request timeout (seconds)
412
409
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
413
410
  # @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`.
411
+ # @param local_address [String, nil] Bind the request'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.
412
+ # @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).
416
413
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
417
414
  # @param version [Wreq::Version, nil] HTTP version to use
415
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
416
+ # @param json [Object, nil] JSON body (will be serialized)
417
+ # @param body [String, IO, nil] Raw request body (string or stream)
418
418
  # @return [Wreq::Response] HTTP response
419
419
  def delete(url, **options)
420
420
  end
@@ -422,17 +422,14 @@ unless defined?(Wreq)
422
422
  # Send an HTTP OPTIONS request.
423
423
  #
424
424
  # @param url [String] Target URL
425
- # @param headers [Hash{String=>String}, nil] Custom headers for this request
425
+ # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
426
426
  # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
427
427
  # @param default_headers [Hash{String=>String}, nil] Default headers to merge
428
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
429
  # @param auth [String, nil] Authorization header value
433
430
  # @param bearer_auth [String, nil] Bearer token for Authorization header
434
431
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
435
- # @param cookies [Array<String>, nil] Cookies to send
432
+ # @param cookies [Hash{String=>String}, String, nil] Cookies to send
436
433
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
437
434
  # @param max_redirects [Integer, nil] Maximum number of redirects to follow
438
435
  # @param gzip [Boolean, nil] Enable gzip compression
@@ -442,10 +439,13 @@ unless defined?(Wreq)
442
439
  # @param timeout [Integer, nil] Total request timeout (seconds)
443
440
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
444
441
  # @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`.
442
+ # @param local_address [String, nil] Bind the request'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.
443
+ # @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).
447
444
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
448
445
  # @param version [Wreq::Version, nil] HTTP version to use
446
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
447
+ # @param json [Object, nil] JSON body (will be serialized)
448
+ # @param body [String, IO, nil] Raw request body (string or stream)
449
449
  # @return [Wreq::Response] HTTP response
450
450
  def options(url, **options)
451
451
  end
@@ -453,17 +453,14 @@ unless defined?(Wreq)
453
453
  # Send an HTTP TRACE request.
454
454
  #
455
455
  # @param url [String] Target URL
456
- # @param headers [Hash{String=>String}, nil] Custom headers for this request
456
+ # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
457
457
  # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
458
458
  # @param default_headers [Hash{String=>String}, nil] Default headers to merge
459
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
460
  # @param auth [String, nil] Authorization header value
464
461
  # @param bearer_auth [String, nil] Bearer token for Authorization header
465
462
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
466
- # @param cookies [Array<String>, nil] Cookies to send
463
+ # @param cookies [Hash{String=>String}, String, nil] Cookies to send
467
464
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
468
465
  # @param max_redirects [Integer, nil] Maximum number of redirects to follow
469
466
  # @param gzip [Boolean, nil] Enable gzip compression
@@ -473,10 +470,13 @@ unless defined?(Wreq)
473
470
  # @param timeout [Integer, nil] Total request timeout (seconds)
474
471
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
475
472
  # @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`.
473
+ # @param local_address [String, nil] Bind the request'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.
474
+ # @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).
478
475
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
479
476
  # @param version [Wreq::Version, nil] HTTP version to use
477
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
478
+ # @param json [Object, nil] JSON body (will be serialized)
479
+ # @param body [String, IO, nil] Raw request body (string or stream)
480
480
  # @return [Wreq::Response] HTTP response
481
481
  def trace(url, **options)
482
482
  end
@@ -484,17 +484,14 @@ unless defined?(Wreq)
484
484
  # Send an HTTP PATCH request.
485
485
  #
486
486
  # @param url [String] Target URL
487
- # @param headers [Hash{String=>String}, nil] Custom headers for this request
487
+ # @param headers [Wreq::Headers, Hash{String=>String}, nil] Custom headers for this request
488
488
  # @param orig_headers [Hash{String=>String}, nil] Original headers (raw, unmodified)
489
489
  # @param default_headers [Hash{String=>String}, nil] Default headers to merge
490
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
491
  # @param auth [String, nil] Authorization header value
495
492
  # @param bearer_auth [String, nil] Bearer token for Authorization header
496
493
  # @param basic_auth [Array<String>, nil] Username and password for basic auth
497
- # @param cookies [Array<String>, nil] Cookies to send
494
+ # @param cookies [Hash{String=>String}, String, nil] Cookies to send
498
495
  # @param allow_redirects [Boolean, nil] Whether to follow redirects
499
496
  # @param max_redirects [Integer, nil] Maximum number of redirects to follow
500
497
  # @param gzip [Boolean, nil] Enable gzip compression
@@ -504,13 +501,24 @@ unless defined?(Wreq)
504
501
  # @param timeout [Integer, nil] Total request timeout (seconds)
505
502
  # @param read_timeout [Integer, nil] Per-chunk read timeout (seconds)
506
503
  # @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`.
504
+ # @param local_address [String, nil] Bind the request'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.
505
+ # @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).
509
506
  # @param emulation [Wreq::Emulation, nil] Device/OS emulation for this request
510
507
  # @param version [Wreq::Version, nil] HTTP version to use
508
+ # @param form [Hash{String=>String}, nil] Form data (application/x-www-form-urlencoded)
509
+ # @param json [Object, nil] JSON body (will be serialized)
510
+ # @param body [String, IO, nil] Raw request body (string or stream)
511
511
  # @return [Wreq::Response] HTTP response
512
512
  def patch(url, **options)
513
513
  end
514
514
  end
515
515
  end
516
516
  end
517
+
518
+ module Wreq
519
+ class Client
520
+ def inspect
521
+ "#<Wreq::Client>"
522
+ end
523
+ end
524
+ end
@@ -114,18 +114,11 @@ unless defined?(Wreq)
114
114
  def get_all
115
115
  end
116
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
117
  # Add a cookie from a Set-Cookie string for the given URL.
125
- # @param cookie [String] A Set-Cookie string
118
+ # @param cookie [String, Wreq::Cookie] A Set-Cookie string
126
119
  # @param url [String]
127
120
  # @return [void]
128
- def add_cookie_str(cookie, url)
121
+ def add(cookie, url)
129
122
  end
130
123
 
131
124
  # Remove a cookie by name for the given URL.
@@ -142,3 +135,22 @@ unless defined?(Wreq)
142
135
  end
143
136
  end
144
137
  end
138
+
139
+ module Wreq
140
+ class Cookie
141
+ def inspect
142
+ parts = ["#<Wreq::Cookie", name]
143
+ parts << "domain=#{domain}" if domain
144
+ parts << "path=#{path}" if path
145
+ parts << "secure" if secure?
146
+ parts << "http_only" if http_only?
147
+ parts.join(" ") + ">"
148
+ end
149
+ end
150
+
151
+ class Jar
152
+ def inspect
153
+ "#<Wreq::Jar [#{get_all.length} cookies]>"
154
+ end
155
+ end
156
+ end
@@ -1,15 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wreq
4
- # Device emulation enumeration backed by Rust.
4
+ # Browser and client fingerprint profile enumeration backed by Rust.
5
5
  #
6
6
  # Variants are exposed as constants under this class.
7
- # Each constant is an instance of {Wreq::EmulationDevice}.
7
+ # Each constant is an instance of {Wreq::Profile} and can be passed to
8
+ # {Wreq::Emulation.new} via the `profile:` keyword.
8
9
  #
9
- # @example Using predefined constants
10
- # device = Wreq::EmulationDevice::Chrome117
11
- # device.class #=> Wreq::EmulationDevice
12
- class EmulationDevice
10
+ # @example Using a predefined profile
11
+ # profile = Wreq::Profile::Chrome117
12
+ # profile.class #=> Wreq::Profile
13
+ #
14
+ # @example Applying a profile to emulation
15
+ # emu = Wreq::Emulation.new(profile: Wreq::Profile::Chrome117)
16
+ class Profile
13
17
  # Constants are set by the native extension at initialization.
14
18
  # These stubs are for documentation only.
15
19
  unless const_defined?(:Chrome100)
@@ -52,6 +56,8 @@ module Wreq
52
56
  Chrome145 = nil
53
57
  Chrome146 = nil
54
58
  Chrome147 = nil
59
+ Chrome148 = nil
60
+
55
61
  Edge101 = nil
56
62
  Edge122 = nil
57
63
  Edge127 = nil
@@ -70,6 +76,8 @@ module Wreq
70
76
  Edge145 = nil
71
77
  Edge146 = nil
72
78
  Edge147 = nil
79
+ Edge148 = nil
80
+
73
81
  Firefox109 = nil
74
82
  Firefox117 = nil
75
83
  Firefox128 = nil
@@ -88,6 +96,9 @@ module Wreq
88
96
  Firefox147 = nil
89
97
  Firefox148 = nil
90
98
  Firefox149 = nil
99
+ Firefox150 = nil
100
+ Firefox151 = nil
101
+
91
102
  SafariIos17_2 = nil
92
103
  SafariIos17_4_1 = nil
93
104
  SafariIos16_5 = nil
@@ -111,10 +122,13 @@ module Wreq
111
122
  Safari26 = nil
112
123
  Safari26_1 = nil
113
124
  Safari26_2 = nil
125
+ Safari26_3 = nil
126
+ Safari26_4 = nil
114
127
  SafariIos26 = nil
115
128
  SafariIos26_2 = nil
116
129
  SafariIPad26 = nil
117
130
  SafariIpad26_2 = nil
131
+
118
132
  OkHttp3_9 = nil
119
133
  OkHttp3_11 = nil
120
134
  OkHttp3_13 = nil
@@ -123,6 +137,7 @@ module Wreq
123
137
  OkHttp4_10 = nil
124
138
  OkHttp4_12 = nil
125
139
  OkHttp5 = nil
140
+
126
141
  Opera116 = nil
127
142
  Opera117 = nil
128
143
  Opera118 = nil
@@ -138,25 +153,30 @@ module Wreq
138
153
  Opera128 = nil
139
154
  Opera129 = nil
140
155
  Opera130 = nil
156
+ Opera131 = nils
141
157
  end
142
158
 
143
159
  unless method_defined?(:to_s)
144
- # Returns a string representation of the emulation device.
145
- # @return [String] Emulation device as string
160
+ # Returns the profile name.
161
+ # @return [String] Profile name as a string
146
162
  def to_s
147
163
  end
148
164
  end
149
165
  end
150
166
 
151
- # Operating system emulation enumeration backed by Rust.
167
+ # Operating system platform enumeration backed by Rust.
152
168
  #
153
169
  # Variants are exposed as constants under this class.
154
- # Each constant is an instance of {Wreq::EmulationOS}.
170
+ # Each constant is an instance of {Wreq::Platform} and can be passed to
171
+ # {Wreq::Emulation.new} via the `platform:` keyword.
155
172
  #
156
- # @example Using predefined constants
157
- # os = Wreq::EmulationOS::Windows
158
- # os.class #=> Wreq::EmulationOS
159
- class EmulationOS
173
+ # @example Using a predefined platform
174
+ # platform = Wreq::Platform::Windows
175
+ # platform.class #=> Wreq::Platform
176
+ #
177
+ # @example Applying a platform to emulation
178
+ # emu = Wreq::Emulation.new(platform: Wreq::Platform::Windows)
179
+ class Platform
160
180
  # Constants are set by the native extension at initialization.
161
181
  # These stubs are for documentation only.
162
182
  unless const_defined?(:Windows)
@@ -168,8 +188,8 @@ module Wreq
168
188
  end
169
189
 
170
190
  unless method_defined?(:to_s)
171
- # Returns a string representation of the emulation OS.
172
- # @return [String] Emulation OS as string
191
+ # Returns the platform name.
192
+ # @return [String] Platform name as a string
173
193
  def to_s
174
194
  end
175
195
  end
@@ -177,26 +197,34 @@ module Wreq
177
197
 
178
198
  # Emulation option wrapper.
179
199
  #
180
- # This class wraps device and OS emulation options and provides
181
- # a unified interface for browser environment simulation.
182
- # The actual implementation is provided by Rust for performance.
200
+ # This class combines a fingerprint `profile`, an OS `platform`, and toggles
201
+ # for HTTP/2 and automatic default headers. The actual implementation is
202
+ # provided by Rust.
203
+ #
204
+ # `profile:` defaults to the library's default profile when omitted.
205
+ # `platform:` defaults to the library's default platform when omitted.
183
206
  #
184
207
  # @example Create an emulation option
185
- # emu = Wreq::Emulation.new(device: Wreq::EmulationDevice::Chrome117, os: Wreq::EmulationOS::Windows)
208
+ # emu = Wreq::Emulation.new(
209
+ # profile: Wreq::Profile::Chrome117,
210
+ # platform: Wreq::Platform::Windows,
211
+ # http2: true,
212
+ # headers: true
213
+ # )
186
214
  #
187
- # @param device [Wreq::EmulationDevice] Device profile (optional)
188
- # @param os [Wreq::EmulationOS] Operating system profile (optional)
189
- # @param skip_http2 [Boolean] Whether to skip HTTP/2 (optional)
190
- # @param skip_headers [Boolean] Whether to skip default headers (optional)
215
+ # @param profile [Wreq::Profile, nil] Fingerprint profile to emulate
216
+ # @param platform [Wreq::Platform, nil] Operating system platform to emulate
217
+ # @param http2 [Boolean] Whether HTTP/2 support is enabled
218
+ # @param headers [Boolean] Whether default emulation headers are enabled
191
219
  class Emulation
192
220
  # Native fields and methods are set by the extension.
193
221
  # This stub is for documentation only.
194
222
  unless method_defined?(:new)
195
- # @param device [Wreq::EmulationDevice] Device profile (optional)
196
- # @param os [Wreq::EmulationOS] Operating system profile (optional)
197
- # @param skip_http2 [Boolean] Whether to skip HTTP/2 (optional)
198
- # @param skip_headers [Boolean] Whether to skip default headers (optional)
199
- def self.new(device: nil, os: nil, skip_http2: false, skip_headers: false)
223
+ # @param profile [Wreq::Profile, nil] Fingerprint profile to emulate
224
+ # @param platform [Wreq::Platform, nil] Operating system platform to emulate
225
+ # @param http2 [Boolean] Whether HTTP/2 support is enabled
226
+ # @param headers [Boolean] Whether default emulation headers are enabled
227
+ def self.new(profile: nil, platform: nil, http2: true, headers: true)
200
228
  end
201
229
  end
202
230
  end
@@ -195,3 +195,11 @@ unless defined?(Wreq)
195
195
  end
196
196
  end
197
197
  end
198
+
199
+ module Wreq
200
+ class Headers
201
+ def inspect
202
+ "#<Wreq::Headers [#{length} headers]>"
203
+ end
204
+ end
205
+ end
@@ -130,3 +130,17 @@ module Wreq
130
130
  end
131
131
  end
132
132
  end
133
+
134
+ module Wreq
135
+ class StatusCode
136
+ def inspect
137
+ "#<Wreq::StatusCode #{self}>"
138
+ end
139
+ end
140
+
141
+ class Version
142
+ def inspect
143
+ "#<Wreq::Version #{self}>"
144
+ end
145
+ end
146
+ end