wreq 1.2.3 → 1.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9d5e7cd20693fbde055ccefc33ed364f51680a341c9145babecc973c5d032ce
4
- data.tar.gz: 4a63a9aeed17a700cf5a3e232f5e4ac8a68bc7f0fcac62ee45090eeb39eca25b
3
+ metadata.gz: 7b6f6be1747be018573cd9de556975068d57c30a0b25f324d0b89a8f018df1aa
4
+ data.tar.gz: 1181f1066b7c5fafb176def4dc1de0a27c192ff3fa9e499afe7f3ec3a70a8b28
5
5
  SHA512:
6
- metadata.gz: ab248c204f472afce85d089be910951c43be6721c555ac37b6483a0468627540aed426265e6594fe5f5e406a32190b5c3d869c93e7a129904cc4fede55e8213a
7
- data.tar.gz: e8ffccc605771de7b765647d1373a5cc8e0d8577ad301951981a90fd517b6674ea15c01e003d71a4e23e60ab2543569781c3796a276eb7b8c9b8e1a17abb3900
6
+ metadata.gz: c641ca408b98ac698cbb17a23c11d78215639793d7a90917058d3de58faa6c89ba403998b49c9b4551b7c237bab0d30e2cb8cfeae161f2c4207d679fb141fdf0
7
+ data.tar.gz: 4d57654f2abd06b9d7ad63fb59df28a5ab68bb211479769828384dc87f1ab87fa638c4a39f0215b73b7759dc428b75214afbae91af39febc1c18d4361fc23ab2
data/Cargo.lock CHANGED
@@ -137,9 +137,9 @@ dependencies = [
137
137
 
138
138
  [[package]]
139
139
  name = "bytes"
140
- version = "1.12.0"
140
+ version = "1.12.1"
141
141
  source = "registry+https://github.com/rust-lang/crates.io-index"
142
- checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593"
142
+ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
143
143
 
144
144
  [[package]]
145
145
  name = "cc"
@@ -901,9 +901,9 @@ dependencies = [
901
901
 
902
902
  [[package]]
903
903
  name = "regex"
904
- version = "1.12.4"
904
+ version = "1.13.0"
905
905
  source = "registry+https://github.com/rust-lang/crates.io-index"
906
- checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
906
+ checksum = "2a0e75113e14dc5acb068cd0786884f214f1312650a3d36d269f5c4f3cdee8a2"
907
907
  dependencies = [
908
908
  "aho-corasick",
909
909
  "memchr",
@@ -913,9 +913,9 @@ dependencies = [
913
913
 
914
914
  [[package]]
915
915
  name = "regex-automata"
916
- version = "0.4.14"
916
+ version = "0.4.15"
917
917
  source = "registry+https://github.com/rust-lang/crates.io-index"
918
- checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
918
+ checksum = "1f388202e4b80542a0921078cc23b6333bcf1409c1e3f86404cae4766a6131db"
919
919
  dependencies = [
920
920
  "aho-corasick",
921
921
  "memchr",
@@ -1537,7 +1537,7 @@ dependencies = [
1537
1537
 
1538
1538
  [[package]]
1539
1539
  name = "wreq-ruby"
1540
- version = "1.2.3"
1540
+ version = "1.2.4"
1541
1541
  dependencies = [
1542
1542
  "arc-swap",
1543
1543
  "bytes",
data/Cargo.toml CHANGED
@@ -6,7 +6,7 @@ homepage = "https://github.com/SearchApi/wreq-ruby"
6
6
  repository = "https://github.com/SearchApi/wreq-ruby"
7
7
  edition = "2024"
8
8
  rust-version = "1.85"
9
- version = "1.2.3"
9
+ version = "1.2.4"
10
10
 
11
11
  [lib]
12
12
  crate-type = ["cdylib"]
@@ -36,7 +36,7 @@ serde = { version = "1.0.228", features = ["derive"] }
36
36
  serde_magnus = "0.11.0"
37
37
  indexmap = { version = "2.14.0", features = ["serde"] }
38
38
  cookie = "0.18.1"
39
- bytes = "1.11.1"
39
+ bytes = "1.12.1"
40
40
  arc-swap = "1.9.1"
41
41
  http = "1.4.1"
42
42
  http-body-util = "0.1.3"
@@ -11,7 +11,7 @@ require_relative "../lib/wreq"
11
11
  # Set when creating the Wreq::Client instance.
12
12
  # All requests from this client will use the specified emulation unless overridden.
13
13
  client = Wreq::Client.new(emulation: Wreq::Emulation.new(
14
- profile: Wreq::Profile::Chrome142,
14
+ profile: Wreq::Profile::Chrome149,
15
15
  platform: Wreq::Platform::MacOS,
16
16
  http2: true,
17
17
  headers: true
@@ -154,6 +154,13 @@ Invoke-Step "Compile native extension" {
154
154
  ridk exec ruby -S bundle exec rake compile
155
155
  }
156
156
 
157
+ Invoke-Step "Sync versioned extension" {
158
+ $rubyMinor = & ruby -e "print RUBY_VERSION[/\A\d+\.\d+/]"
159
+ $dest = "lib\wreq_ruby\$rubyMinor"
160
+ New-Item -ItemType Directory -Force $dest | Out-Null
161
+ Copy-Item "lib\wreq_ruby\wreq_ruby.so" (Join-Path $dest "wreq_ruby.so") -Force
162
+ }
163
+
157
164
  Invoke-Step "Verify extension loads" {
158
165
  ruby -Ilib -rwreq -e "puts Wreq::VERSION; puts Wreq::Client.new.class"
159
166
  }
data/src/cookie.rs CHANGED
@@ -280,9 +280,7 @@ impl Jar {
280
280
  pub fn include(ruby: &Ruby, gem_module: &RModule) -> Result<(), Error> {
281
281
  // SameSite enum
282
282
  let same_site_class = gem_module.define_class("SameSite", ruby.class_object())?;
283
- same_site_class.const_set("Strict", SameSite::Strict)?;
284
- same_site_class.const_set("Lax", SameSite::Lax)?;
285
- same_site_class.const_set("None", SameSite::None)?;
283
+ SameSite::define_constants(same_site_class)?;
286
284
 
287
285
  // Cookie class
288
286
  let cookie_class = gem_module.define_class("Cookie", ruby.class_object())?;
data/src/emulate.rs CHANGED
@@ -222,152 +222,12 @@ pub fn include(ruby: &Ruby, gem_module: &RModule) -> Result<(), Error> {
222
222
  // Profile enum binding
223
223
  let profile = gem_module.define_class("Profile", ruby.class_object())?;
224
224
  profile.define_method("to_s", method!(Profile::to_s, 0))?;
225
- profile.const_set("Chrome100", Profile::Chrome100)?;
226
- profile.const_set("Chrome101", Profile::Chrome101)?;
227
- profile.const_set("Chrome104", Profile::Chrome104)?;
228
- profile.const_set("Chrome105", Profile::Chrome105)?;
229
- profile.const_set("Chrome106", Profile::Chrome106)?;
230
- profile.const_set("Chrome107", Profile::Chrome107)?;
231
- profile.const_set("Chrome108", Profile::Chrome108)?;
232
- profile.const_set("Chrome109", Profile::Chrome109)?;
233
- profile.const_set("Chrome110", Profile::Chrome110)?;
234
- profile.const_set("Chrome114", Profile::Chrome114)?;
235
- profile.const_set("Chrome116", Profile::Chrome116)?;
236
- profile.const_set("Chrome117", Profile::Chrome117)?;
237
- profile.const_set("Chrome118", Profile::Chrome118)?;
238
- profile.const_set("Chrome119", Profile::Chrome119)?;
239
- profile.const_set("Chrome120", Profile::Chrome120)?;
240
- profile.const_set("Chrome123", Profile::Chrome123)?;
241
- profile.const_set("Chrome124", Profile::Chrome124)?;
242
- profile.const_set("Chrome126", Profile::Chrome126)?;
243
- profile.const_set("Chrome127", Profile::Chrome127)?;
244
- profile.const_set("Chrome128", Profile::Chrome128)?;
245
- profile.const_set("Chrome129", Profile::Chrome129)?;
246
- profile.const_set("Chrome130", Profile::Chrome130)?;
247
- profile.const_set("Chrome131", Profile::Chrome131)?;
248
- profile.const_set("Chrome132", Profile::Chrome132)?;
249
- profile.const_set("Chrome133", Profile::Chrome133)?;
250
- profile.const_set("Chrome134", Profile::Chrome134)?;
251
- profile.const_set("Chrome135", Profile::Chrome135)?;
252
- profile.const_set("Chrome136", Profile::Chrome136)?;
253
- profile.const_set("Chrome137", Profile::Chrome137)?;
254
- profile.const_set("Chrome138", Profile::Chrome138)?;
255
- profile.const_set("Chrome139", Profile::Chrome139)?;
256
- profile.const_set("Chrome140", Profile::Chrome140)?;
257
- profile.const_set("Chrome141", Profile::Chrome141)?;
258
- profile.const_set("Chrome142", Profile::Chrome142)?;
259
- profile.const_set("Chrome143", Profile::Chrome143)?;
260
- profile.const_set("Chrome144", Profile::Chrome144)?;
261
- profile.const_set("Chrome145", Profile::Chrome145)?;
262
- profile.const_set("Chrome146", Profile::Chrome146)?;
263
- profile.const_set("Chrome147", Profile::Chrome147)?;
264
- profile.const_set("Chrome148", Profile::Chrome148)?;
265
-
266
- profile.const_set("Edge101", Profile::Edge101)?;
267
- profile.const_set("Edge122", Profile::Edge122)?;
268
- profile.const_set("Edge127", Profile::Edge127)?;
269
- profile.const_set("Edge131", Profile::Edge131)?;
270
- profile.const_set("Edge134", Profile::Edge134)?;
271
- profile.const_set("Edge135", Profile::Edge135)?;
272
- profile.const_set("Edge136", Profile::Edge136)?;
273
- profile.const_set("Edge137", Profile::Edge137)?;
274
- profile.const_set("Edge138", Profile::Edge138)?;
275
- profile.const_set("Edge139", Profile::Edge139)?;
276
- profile.const_set("Edge140", Profile::Edge140)?;
277
- profile.const_set("Edge141", Profile::Edge141)?;
278
- profile.const_set("Edge142", Profile::Edge142)?;
279
- profile.const_set("Edge143", Profile::Edge143)?;
280
- profile.const_set("Edge144", Profile::Edge144)?;
281
- profile.const_set("Edge145", Profile::Edge145)?;
282
- profile.const_set("Edge146", Profile::Edge146)?;
283
- profile.const_set("Edge147", Profile::Edge147)?;
284
- profile.const_set("Edge148", Profile::Edge148)?;
285
-
286
- profile.const_set("Firefox109", Profile::Firefox109)?;
287
- profile.const_set("Firefox117", Profile::Firefox117)?;
288
- profile.const_set("Firefox128", Profile::Firefox128)?;
289
- profile.const_set("Firefox133", Profile::Firefox133)?;
290
- profile.const_set("Firefox135", Profile::Firefox135)?;
291
- profile.const_set("FirefoxPrivate135", Profile::FirefoxPrivate135)?;
292
- profile.const_set("FirefoxAndroid135", Profile::FirefoxAndroid135)?;
293
- profile.const_set("Firefox136", Profile::Firefox136)?;
294
- profile.const_set("FirefoxPrivate136", Profile::FirefoxPrivate136)?;
295
- profile.const_set("Firefox139", Profile::Firefox139)?;
296
- profile.const_set("Firefox142", Profile::Firefox142)?;
297
- profile.const_set("Firefox143", Profile::Firefox143)?;
298
- profile.const_set("Firefox144", Profile::Firefox144)?;
299
- profile.const_set("Firefox145", Profile::Firefox145)?;
300
- profile.const_set("Firefox146", Profile::Firefox146)?;
301
- profile.const_set("Firefox147", Profile::Firefox147)?;
302
- profile.const_set("Firefox148", Profile::Firefox148)?;
303
- profile.const_set("Firefox149", Profile::Firefox149)?;
304
- profile.const_set("Firefox150", Profile::Firefox150)?;
305
- profile.const_set("Firefox151", Profile::Firefox151)?;
306
-
307
- profile.const_set("SafariIos17_2", Profile::SafariIos17_2)?;
308
- profile.const_set("SafariIos17_4_1", Profile::SafariIos17_4_1)?;
309
- profile.const_set("SafariIos16_5", Profile::SafariIos16_5)?;
310
- profile.const_set("Safari15_3", Profile::Safari15_3)?;
311
- profile.const_set("Safari15_5", Profile::Safari15_5)?;
312
- profile.const_set("Safari15_6_1", Profile::Safari15_6_1)?;
313
- profile.const_set("Safari16", Profile::Safari16)?;
314
- profile.const_set("Safari16_5", Profile::Safari16_5)?;
315
- profile.const_set("Safari17_0", Profile::Safari17_0)?;
316
- profile.const_set("Safari17_2_1", Profile::Safari17_2_1)?;
317
- profile.const_set("Safari17_4_1", Profile::Safari17_4_1)?;
318
- profile.const_set("Safari17_5", Profile::Safari17_5)?;
319
- profile.const_set("Safari17_6", Profile::Safari17_6)?;
320
- profile.const_set("Safari18", Profile::Safari18)?;
321
- profile.const_set("SafariIPad18", Profile::SafariIPad18)?;
322
- profile.const_set("Safari18_2", Profile::Safari18_2)?;
323
- profile.const_set("Safari18_3", Profile::Safari18_3)?;
324
- profile.const_set("Safari18_3_1", Profile::Safari18_3_1)?;
325
- profile.const_set("SafariIos18_1_1", Profile::SafariIos18_1_1)?;
326
- profile.const_set("Safari18_5", Profile::Safari18_5)?;
327
- profile.const_set("Safari26", Profile::Safari26)?;
328
- profile.const_set("Safari26_1", Profile::Safari26_1)?;
329
- profile.const_set("Safari26_2", Profile::Safari26_2)?;
330
- profile.const_set("Safari26_3", Profile::Safari26_3)?;
331
- profile.const_set("Safari26_4", Profile::Safari26_4)?;
332
- profile.const_set("SafariIos26", Profile::SafariIos26)?;
333
- profile.const_set("SafariIos26_2", Profile::SafariIos26_2)?;
334
- profile.const_set("SafariIPad26", Profile::SafariIPad26)?;
335
- profile.const_set("SafariIpad26_2", Profile::SafariIpad26_2)?;
336
-
337
- profile.const_set("OkHttp3_9", Profile::OkHttp3_9)?;
338
- profile.const_set("OkHttp3_11", Profile::OkHttp3_11)?;
339
- profile.const_set("OkHttp3_13", Profile::OkHttp3_13)?;
340
- profile.const_set("OkHttp3_14", Profile::OkHttp3_14)?;
341
- profile.const_set("OkHttp4_9", Profile::OkHttp4_9)?;
342
- profile.const_set("OkHttp4_10", Profile::OkHttp4_10)?;
343
- profile.const_set("OkHttp4_12", Profile::OkHttp4_12)?;
344
- profile.const_set("OkHttp5", Profile::OkHttp5)?;
345
-
346
- profile.const_set("Opera116", Profile::Opera116)?;
347
- profile.const_set("Opera117", Profile::Opera117)?;
348
- profile.const_set("Opera118", Profile::Opera118)?;
349
- profile.const_set("Opera119", Profile::Opera119)?;
350
- profile.const_set("Opera120", Profile::Opera120)?;
351
- profile.const_set("Opera121", Profile::Opera121)?;
352
- profile.const_set("Opera122", Profile::Opera122)?;
353
- profile.const_set("Opera123", Profile::Opera123)?;
354
- profile.const_set("Opera124", Profile::Opera124)?;
355
- profile.const_set("Opera125", Profile::Opera125)?;
356
- profile.const_set("Opera126", Profile::Opera126)?;
357
- profile.const_set("Opera127", Profile::Opera127)?;
358
- profile.const_set("Opera128", Profile::Opera128)?;
359
- profile.const_set("Opera129", Profile::Opera129)?;
360
- profile.const_set("Opera130", Profile::Opera130)?;
361
- profile.const_set("Opera131", Profile::Opera131)?;
225
+ Profile::define_constants(profile)?;
362
226
 
363
227
  // Platform enum binding
364
228
  let platform = gem_module.define_class("Platform", ruby.class_object())?;
365
229
  platform.define_method("to_s", method!(Platform::to_s, 0))?;
366
- platform.const_set("Windows", Platform::Windows)?;
367
- platform.const_set("MacOS", Platform::MacOS)?;
368
- platform.const_set("Linux", Platform::Linux)?;
369
- platform.const_set("Android", Platform::Android)?;
370
- platform.const_set("IOS", Platform::IOS)?;
230
+ Platform::define_constants(platform)?;
371
231
 
372
232
  // Emulation class binding
373
233
  let emulation = gem_module.define_class("Emulation", ruby.class_object())?;
data/src/http.rs CHANGED
@@ -111,21 +111,10 @@ impl From<wreq::StatusCode> for StatusCode {
111
111
 
112
112
  pub fn include(ruby: &Ruby, gem_module: &RModule) -> Result<(), Error> {
113
113
  let method_class = gem_module.define_class("Method", ruby.class_object())?;
114
- method_class.const_set("GET", Method::GET)?;
115
- method_class.const_set("POST", Method::POST)?;
116
- method_class.const_set("PUT", Method::PUT)?;
117
- method_class.const_set("DELETE", Method::DELETE)?;
118
- method_class.const_set("PATCH", Method::PATCH)?;
119
- method_class.const_set("HEAD", Method::HEAD)?;
120
- method_class.const_set("TRACE", Method::TRACE)?;
121
- method_class.const_set("OPTIONS", Method::OPTIONS)?;
114
+ Method::define_constants(method_class)?;
122
115
 
123
116
  let version_class = gem_module.define_class("Version", ruby.class_object())?;
124
- version_class.const_set("HTTP_09", Version::HTTP_09)?;
125
- version_class.const_set("HTTP_10", Version::HTTP_10)?;
126
- version_class.const_set("HTTP_11", Version::HTTP_11)?;
127
- version_class.const_set("HTTP_2", Version::HTTP_2)?;
128
- version_class.const_set("HTTP_3", Version::HTTP_3)?;
117
+ Version::define_constants(version_class)?;
129
118
  version_class.define_method("to_s", method!(Version::to_s, 0))?;
130
119
  version_class.define_method("==", method!(Version::equals, 1))?;
131
120
 
data/src/macros.rs CHANGED
@@ -75,6 +75,11 @@ macro_rules! define_ruby_enum {
75
75
  _ => unreachable!(),
76
76
  }
77
77
  }
78
+
79
+ pub fn define_constants(class: magnus::RClass) -> Result<(), magnus::Error> {
80
+ $(class.const_set(stringify!($rust_variant), <$enum_type>::$rust_variant)?;)*
81
+ Ok(())
82
+ }
78
83
  }
79
84
  };
80
85
 
@@ -103,6 +108,11 @@ macro_rules! define_ruby_enum {
103
108
  _ => unreachable!(),
104
109
  }
105
110
  }
111
+
112
+ pub fn define_constants(class: magnus::RClass) -> Result<(), magnus::Error> {
113
+ $(class.const_set(stringify!($rust_variant), <$enum_type>::$rust_variant)?;)*
114
+ Ok(())
115
+ }
106
116
  }
107
117
  };
108
118
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wreq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - SearchApi