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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -4
  3. data/lib/curlify.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 454dce1933ce73ea1d94fb65751136b63ec6db386cc95c7c2617810be4a7f12f
4
- data.tar.gz: 1d9a016845ea3a4a72bf4dbbe018c1c4ff18021be01949fe760d0beadb8b0056
3
+ metadata.gz: 6f8603bf909c7334127104c8fab5861f012831d6fa81da078babdabbc57c4fd8
4
+ data.tar.gz: '088456a7f8dacbbd4a9907117fc0d2fa804a4947e29f0de85d18860364be9c29'
5
5
  SHA512:
6
- metadata.gz: 90df8f74b718591df6dd9eacc1134207a41cd81f6a9f2ae6b7299a360aaf20b7fd0dd90a48b51c93c086e403ace3cfeb5bd02ad43acb7a278b56440618e59dda
7
- data.tar.gz: fa2b4a3e6f4b61b20bde6d5641f2d5df8ba84ba81107e859c38ec33ac3cc63e4297f963c1974e1f4ac6fa1a8eabf0665de1b75c53a92e15efdf88fbb425f2a6e
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 'curlify', 'uri' and 'net/http' gems and execute curlify, see:
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://run.mocky.io/v3/b0f4ffd8-6696-4f90-8bab-4a3bcad9ef3f')
27
- request = Net::HTTP::Get.new(uri, { 'content-type': 'application/json' })
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 # curl -X GET -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: run.mocky.io' https://run.mocky.io/v3/b0f4ffd8-6696-4f90-8bab-4a3bcad9ef3f
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
@@ -27,6 +27,6 @@ class Curlify
27
27
  end
28
28
 
29
29
  def body
30
- "-d #{request.body}" unless request.body.nil?
30
+ "-d '#{request.body}'" unless request.body.nil?
31
31
  end
32
32
  end
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.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-08-31 00:00:00.000000000 Z
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.4.1
48
+ rubygems_version: 3.2.22
49
49
  signing_key:
50
50
  specification_version: 4
51
51
  summary: Hola!