curlify 1.0.0 → 1.0.1
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 +4 -4
- data/README.md +33 -4
- data/lib/curlify.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f8603bf909c7334127104c8fab5861f012831d6fa81da078babdabbc57c4fd8
|
4
|
+
data.tar.gz: '088456a7f8dacbbd4a9907117fc0d2fa804a4947e29f0de85d18860364be9c29'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11f6723c766d88aae5d04034bab585e699abd729282ab6f0b520bd177f7d8e519cb50eb03f2cd4de70303a3e5663e0b593f702378aac6aa267da82c7eb9dcb5d
|
7
|
+
data.tar.gz: 2ff5487bba2d8491e1295be94f37dcef6fe1dff2a52b977c614d7dda06887774e73856b55ba812003e2f8d2cc6d502454649c5efce5bf0368becb3d6d9879224
|
data/README.md
CHANGED
@@ -16,16 +16,45 @@ $ bundle add curlify
|
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
Import
|
19
|
+
Import `curlify`, `uri` and `net/http` gems and execute curlify, see:
|
20
20
|
|
21
21
|
```python
|
22
22
|
require 'uri'
|
23
23
|
require 'net/http'
|
24
24
|
require 'curlify'
|
25
25
|
|
26
|
-
uri = URI('https://
|
27
|
-
request = Net::HTTP::
|
26
|
+
uri = URI('https://httpbin.org/post')
|
27
|
+
request = Net::HTTP::Post.new(uri, { 'content-type': 'application/json' })
|
28
|
+
request.body = { title: 'Ruby is great :)' }.to_json
|
29
|
+
|
28
30
|
curlify = Curlify.new(request)
|
29
31
|
|
30
|
-
puts curlify.to_curl
|
32
|
+
puts curlify.to_curl
|
33
|
+
|
34
|
+
# curl -X POST -H 'content-type: application/json' -H 'accept-encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3' -H 'accept: */*' -H 'user-agent: Ruby' -H 'host: httpbin.org' -d '{"title":"Ruby is great :)"}' https://httpbin.org/post
|
35
|
+
```
|
36
|
+
|
37
|
+
Running this command generated, we have the following result:
|
38
|
+
|
39
|
+
```bash
|
40
|
+
{
|
41
|
+
"args": {},
|
42
|
+
"data": "{\"title\":\"Ruby is great :)\"}",
|
43
|
+
"files": {},
|
44
|
+
"form": {},
|
45
|
+
"headers": {
|
46
|
+
"Accept": "*/*",
|
47
|
+
"Accept-Encoding": "gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
|
48
|
+
"Content-Length": "28",
|
49
|
+
"Content-Type": "application/json",
|
50
|
+
"Host": "httpbin.org",
|
51
|
+
"User-Agent": "Ruby",
|
52
|
+
"X-Amzn-Trace-Id": "Root=1-64f38ad0-444dbe403f03082e14ba1d62"
|
53
|
+
},
|
54
|
+
"json": {
|
55
|
+
"title": "Ruby is great :)"
|
56
|
+
},
|
57
|
+
"origin": "xxx.xxx.xx.xx",
|
58
|
+
"url": "https://httpbin.org/post"
|
59
|
+
}
|
31
60
|
```
|
data/lib/curlify.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curlify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcus Almeida
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The gem convert python requests object in curl command.
|
14
14
|
email: mpereirassa@gmail.com
|
@@ -45,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
requirements: []
|
48
|
-
rubygems_version: 3.
|
48
|
+
rubygems_version: 3.2.22
|
49
49
|
signing_key:
|
50
50
|
specification_version: 4
|
51
51
|
summary: Hola!
|