docraptor-cli 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +32 -0
- data/bin/docraptor +6 -0
- data/lib/docraptor-cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 728d1be587631813091655e13ceaad145e55ece5
|
4
|
+
data.tar.gz: a159b7a50d484292fe2f64160d09960909fab681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaf07e23b371c5c50298201e7287a8b34f8d65265444cb5233b3386c7f9b055c31df70de5674c57ae57dfe426863affacc683ea0174df6a2077e676f05c5abf5
|
7
|
+
data.tar.gz: 3c7fca6ccddc55604e018c339a4bc79d0290b6b9f4fd2b7a5c73edeadaf5d4da8c6384dcbd149a96464802a28bfc94fb69c939b576d273435780e2acd1ad4bd4
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -54,6 +54,38 @@ We have guides for doing some of the common things:
|
|
54
54
|
* [CSS Media Selector](https://docraptor.com/documentation/api#api_basic_pdf) to make the page look exactly as it does in your browser
|
55
55
|
* Protect content with [HTTP authentication](https://docraptor.com/documentation/api#api_http_user) or [proxies](https://docraptor.com/documentation/api#api_http_proxy) so only DocRaptor can access them
|
56
56
|
|
57
|
+
## Testing Callbacks
|
58
|
+
|
59
|
+
The `--callback-url` option can be used to set a URL that will receive a POST request after your document has successfully been processed. You can simulate this in your *nix development environment using a couple of simple tools: [`nc`](http://linux.die.net/man/1/nc) and [`ngrok`](https://ngrok.com/).
|
60
|
+
|
61
|
+
Let's say you had some document content in a file named `test.html`. To test the callback URL, start a new console and type:
|
62
|
+
|
63
|
+
```
|
64
|
+
nc -lk 9001
|
65
|
+
```
|
66
|
+
|
67
|
+
This will listen on port `9001` for requests. Now open another console and type in:
|
68
|
+
```
|
69
|
+
ngrok http 9001
|
70
|
+
```
|
71
|
+
|
72
|
+
This will setup an external URL that port forwards to port `9001` on your computer (conveniently being listened to by `nc`). Note the ngrok http URL. It should look something like `http://87654321.ngrok.io`. Copy that URL and open a third console where we will generate our document:
|
73
|
+
```
|
74
|
+
bin/docraptor test.html --async --callback_url "http://87654321.ngrok.io"
|
75
|
+
```
|
76
|
+
|
77
|
+
After the document has been generated, if we go to our console running `nc`, we should see we got an HTTP POST request that looks something like this:
|
78
|
+
|
79
|
+
```
|
80
|
+
POST / HTTP/1.1
|
81
|
+
Connection: close
|
82
|
+
Host: d94c779c.ngrok.io
|
83
|
+
Content-Length: 139
|
84
|
+
Content-Type: application/x-www-form-urlencoded
|
85
|
+
X-Forwarded-For: 54.158.114.123
|
86
|
+
|
87
|
+
download_url=https%3A%2F%2Fdocraptor.com%2Fdownload%2Fe4eabaca-f811-49f8-9375-fcb9cdeae5aa&download_id=e4eabaca-f811-49f8-9375-fcb9cdeae5aa
|
88
|
+
```
|
57
89
|
|
58
90
|
## More Help
|
59
91
|
|
data/bin/docraptor
CHANGED
@@ -53,6 +53,10 @@ opt_parser = OptionParser.new do |opts|
|
|
53
53
|
options[:async] = async
|
54
54
|
end
|
55
55
|
|
56
|
+
opts.on("--callback_url url", "Set a callback URL to be notified upon success.") do |callback_url|
|
57
|
+
options[:callback_url] = callback_url
|
58
|
+
end
|
59
|
+
|
56
60
|
opts.on("-d", "--debug", "Enable debug logging.") do
|
57
61
|
options[:debug] = true
|
58
62
|
end
|
@@ -236,6 +240,8 @@ all_doc_attributes = {
|
|
236
240
|
ignore_resource_errors: options[:ignore_resource_errors],
|
237
241
|
}
|
238
242
|
|
243
|
+
all_doc_attributes[:callback_url] = options[:callback_url] if options[:callback_url]
|
244
|
+
|
239
245
|
all_doc_attributes[:prince_options][:version] = options[:prince_version] if options[:prince_version]
|
240
246
|
all_doc_attributes[:prince_options][:javascript] = options[:prince_javascript] if options[:prince_javascript]
|
241
247
|
all_doc_attributes[:prince_options][:media] = options[:prince_media] if options[:prince_media]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docraptor-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elijah Miller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docraptor
|