curb 1.0.4 → 1.0.5

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: fbb34677764658fa7e245af071bc04109f4928469a55e7bb9637678b5517e331
4
- data.tar.gz: e71501d928f2d44943a097b648525b24ce93427507800ffa7e2fd481b6a84593
3
+ metadata.gz: e28b1d05b46460867acfadc87bbe422d58d8f2cdb93397fa6ded906b01cd7dab
4
+ data.tar.gz: 33e7037c1c2b23a793ec96c73bc80c008939c880702f884d2b258d4afd18c368
5
5
  SHA512:
6
- metadata.gz: bba51087a045a85954cb6b5470ae3f0fc2e8442489fd5a81f1d9e9ee4800e674156510d9a8cf6fd86daa66d18938ea50a5f625fa3fccf1db055faf58177455b2
7
- data.tar.gz: 67696266ddd2d0081b514b7a5a9bf81ea61c474ad0d8423e6d61db5cdba614c01dca14ed7a512cf52ca609db7bc5317828e1f033004ffdef6e6f3f7e09f63dbb
6
+ metadata.gz: 6eb448726a4fdce1e0832e36a45b2c8e0a078fbc2c04b3fe34f87fc38397f5c4ecc4fe621aed5637750c5c7a7a9d05b30c03f9f7db153c23d3694eb6adb464e8
7
+ data.tar.gz: 624e3f39af79eff874784a662776debc2b405378c6cdc963a50dee525d36aa225cc5f40558f9b35b396c222416006f66c29fc6193e651b5aa84093fdd52cb2ba
data/README.markdown CHANGED
@@ -12,26 +12,38 @@ Curb is a work-in-progress, and currently only supports libcurl's `easy` and `mu
12
12
 
13
13
  ## License
14
14
 
15
- Curb is copyright (c)2006 Ross Bamford, and released under the terms of the
15
+ Curb is copyright (c) 2006 Ross Bamford, and released under the terms of the
16
16
  Ruby license. See the LICENSE file for the gory details.
17
17
 
18
18
  ## Easy mode
19
19
 
20
- Get stuff
20
+ GET request
21
21
  ```
22
- res = Curl.get("https://www.google.com/")
23
- puts res.response_code
24
- puts res.header_str
22
+ res = Curl.get("https://www.google.com/") {|http|
23
+ http.timeout = 10 # raise exception if request/response not handled within 10 seconds
24
+ }
25
+ puts res.code
26
+ puts res.head
25
27
  puts res.body
26
28
  ```
27
29
 
28
- Post stuff
30
+ POST request
29
31
  ```
30
32
  res = Curl.post("https://your-server.com/endpoint", {post: "this"}.to_json) {|http|
31
33
  http.headers["Content-Type"] = "application/json"
32
34
  }
33
- puts res.response_code
34
- puts res.header_str
35
+ puts res.code
36
+ puts res.head
37
+ puts res.body
38
+ ```
39
+
40
+ PATCH request
41
+ ```
42
+ res = Curl.patch("https://your-server.com/endpoint", {post: "this"}.to_json) {|http|
43
+ http.headers["Content-Type"] = "application/json"
44
+ }
45
+ puts res.code
46
+ puts res.head
35
47
  puts res.body
36
48
  ```
37
49
 
data/ext/curb.h CHANGED
@@ -28,11 +28,11 @@
28
28
  #include "curb_macros.h"
29
29
 
30
30
  // These should be managed from the Rake 'release' task.
31
- #define CURB_VERSION "1.0.4"
32
- #define CURB_VER_NUM 1004
31
+ #define CURB_VERSION "1.0.5"
32
+ #define CURB_VER_NUM 1005
33
33
  #define CURB_VER_MAJ 1
34
34
  #define CURB_VER_MIN 0
35
- #define CURB_VER_MIC 4
35
+ #define CURB_VER_MIC 5
36
36
  #define CURB_VER_PATCH 0
37
37
 
38
38
 
data/ext/curb_easy.c CHANGED
@@ -3921,6 +3921,7 @@ void init_curb_easy() {
3921
3921
 
3922
3922
  rb_define_method(cCurlEasy, "last_effective_url", ruby_curl_easy_last_effective_url_get, 0);
3923
3923
  rb_define_method(cCurlEasy, "response_code", ruby_curl_easy_response_code_get, 0);
3924
+ rb_define_method(cCurlEasy, "code", ruby_curl_easy_response_code_get, 0);
3924
3925
  #if defined(HAVE_CURLINFO_PRIMARY_IP)
3925
3926
  rb_define_method(cCurlEasy, "primary_ip", ruby_curl_easy_primary_ip_get, 0);
3926
3927
  #endif
@@ -13,9 +13,9 @@ class TestCurbCurlEasy < Test::Unit::TestCase
13
13
  def test_nested_easy_methods
14
14
  easy = Curl.get(TestServlet.url) {|http|
15
15
  res = Curl.get(TestServlet.url + '/not_here')
16
- assert_equal 404, res.response_code
16
+ assert_equal 404, res.code
17
17
  }
18
- assert_equal 200, easy.response_code
18
+ assert_equal 200, easy.code
19
19
  end
20
20
 
21
21
  def test_curlopt_stderr_with_file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Bamford
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-03 00:00:00.000000000 Z
12
+ date: 2023-01-04 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Curb (probably CUrl-RuBy or something) provides Ruby-language bindings
15
15
  for the libcurl(3), a fully-featured client-side URL transfer library. cURL and