docraptor 0.0.3 → 0.1.0
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/.gitignore +5 -0
- data/CHANGELOG.md +4 -1
- data/README.md +14 -7
- data/docraptor.gemspec +3 -2
- data/docraptor.yaml +7 -5
- data/examples/async.rb +64 -0
- data/examples/sync.rb +49 -0
- data/lib/docraptor/api/client_api.rb +6 -6
- data/lib/docraptor/api_client.rb +4 -1
- data/lib/docraptor/version.rb +1 -1
- data/script/test +13 -3
- data/swagger-config.json +1 -1
- data/test/async.rb +12 -9
- data/test/invalid_async.rb +10 -6
- data/test/invalid_sync.rb +8 -6
- data/test/sync.rb +9 -5
- data/test/xlsx.rb +9 -5
- metadata +27 -7
- data/Gemfile.lock +0 -67
- data/pkg/docraptor-0.0.3.gem +0 -0
- data/test/Gemfile +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fad9a985e8677d1e169dfe5ff389f8a49c8d1ebd
|
4
|
+
data.tar.gz: 345911f7f165e051bc60a171493524a0cdc169d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f43ad89a0e4bddb075348cbd73b3eefd72398c282b2640e14516e53acbb945a3bf14ba00a1e338066cbbcf6bbb8b22485ad32d9e3749bb0441911a4da196ae49
|
7
|
+
data.tar.gz: e9d1311fe9e602dffbc5429dd266f916c850f9069c3272b7c462280f32363b0f901f6d27bd9a08672e156ebb33664935b2fe43fbd18280699afa0e5206a69564
|
data/.gitignore
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
### 0.0
|
1
|
+
### 0.1.0 [January 27, 2016]
|
2
|
+
* **BREAKING CHANGE**: create_doc and get_async_doc responses are now binary strings instead of Tempfiles
|
3
|
+
|
4
|
+
### 0.0.3 [January 15, 2016]
|
2
5
|
* Use better API command names: create_doc, create_async_doc, get_async_doc_status, get_async_doc
|
3
6
|
* Fix file encoding issues when used in Rails
|
4
7
|
|
data/README.md
CHANGED
@@ -16,6 +16,8 @@ Then run `bundle install`.
|
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
+
See [examples](examples/) for runnable examples with file output, error handling, etc.
|
20
|
+
|
19
21
|
```ruby
|
20
22
|
DocRaptor.configure do |dr|
|
21
23
|
dr.username = "YOUR_API_KEY_HERE" # this key works for test documents
|
@@ -24,11 +26,11 @@ end
|
|
24
26
|
|
25
27
|
$docraptor = DocRaptor::ClientApi.new
|
26
28
|
|
27
|
-
response = $docraptor.
|
29
|
+
response = $docraptor.create_doc(
|
28
30
|
test: true, # test documents are free but watermarked
|
29
31
|
document_content: "<html><body>Hello World</body></html>", # supply content directly
|
30
32
|
# document_url: "http://docraptor.com/examples/invoice.html", # or use a url
|
31
|
-
name: "
|
33
|
+
name: "docraptor-ruby.pdf", # help you find a document later
|
32
34
|
document_type: "pdf", # pdf or xls or xlsx
|
33
35
|
# javascript: true, # enable JavaScript processing
|
34
36
|
# prince_options: {
|
@@ -38,7 +40,7 @@ response = $docraptor.docs_post(
|
|
38
40
|
)
|
39
41
|
```
|
40
42
|
|
41
|
-
|
43
|
+
Docs created like this are limited to 60 seconds to render, check out the [async example](examples/async.rb) which allows 10 minutes.
|
42
44
|
|
43
45
|
|
44
46
|
We have guides for doing some of the common things:
|
@@ -57,13 +59,18 @@ Stuck? We're experts at using DocRaptor so please [email us](mailto:support@docr
|
|
57
59
|
|
58
60
|
The majority of the code in this repo is generated using swagger-codegen on [docraptor.yaml](docraptor.yaml). You can modify this file and regenerate the client using `script/generate_language ruby`.
|
59
61
|
|
62
|
+
The generated client needed a few fixes
|
63
|
+
- binary string response code generated from https://github.com/swagger-api/swagger-codegen/pull/1934
|
64
|
+
|
65
|
+
|
60
66
|
## Release Process
|
61
67
|
|
62
|
-
1.
|
63
|
-
2. Increment version in code
|
68
|
+
1. `script/test`
|
69
|
+
2. Increment version in code:
|
70
|
+
- `swagger-config.json`
|
71
|
+
- `docraptor.gemspec`
|
64
72
|
3. Update [CHANGELOG.md](CHANGELOG.md)
|
65
|
-
4.
|
66
|
-
5. `rake release`
|
73
|
+
4. `rake release`
|
67
74
|
|
68
75
|
## Version Policy
|
69
76
|
|
data/docraptor.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Elijah Miller", "Matthew Gordon"]
|
10
10
|
s.email = ["elijah@expectedbehavior.com", "matt@expectedbehavior.com"]
|
11
|
-
s.homepage = "https://
|
11
|
+
s.homepage = "https://github.com/docraptor/docraptor-ruby"
|
12
12
|
s.summary = %q{A wrapper for the DocRaptor HTML to PDF/XLS service.}
|
13
13
|
s.description = %q{A native client library for the DocRaptor HTML to PDF/XLS service.}
|
14
14
|
s.license = "Apache-2.0"
|
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_runtime_dependency 'typhoeus', '~> 0.2', '>= 0.2.1'
|
17
17
|
s.add_runtime_dependency 'json', '~> 1.4', '>= 1.4.6'
|
18
18
|
|
19
|
+
s.add_development_dependency 'pry', '~> 0.10', '>= 0.10.3'
|
19
20
|
s.add_development_dependency 'rake', '~> 10.4', '>= 10.4.2'
|
20
21
|
s.add_development_dependency 'rspec', '~> 3.2', '>= 3.2.0'
|
21
22
|
s.add_development_dependency 'vcr', '~> 2.9', '>= 2.9.3'
|
@@ -25,7 +26,7 @@ Gem::Specification.new do |s|
|
|
25
26
|
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
|
26
27
|
s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.11'
|
27
28
|
|
28
|
-
s.files = `
|
29
|
+
s.files = `git ls-files`.split("\n").uniq.sort.select{|f| !f.empty? }
|
29
30
|
s.executables = []
|
30
31
|
s.require_paths = ["lib"]
|
31
32
|
end
|
data/docraptor.yaml
CHANGED
@@ -8,9 +8,9 @@ host: docraptor.com
|
|
8
8
|
basePath: /
|
9
9
|
schemes: [https]
|
10
10
|
securityDefinitions:
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
basicAuth:
|
12
|
+
type: basic
|
13
|
+
description: HTTP Basic Authentication. Works over `HTTP` and `HTTPS`
|
14
14
|
produces:
|
15
15
|
- application/json
|
16
16
|
- application/xml
|
@@ -38,7 +38,8 @@ paths:
|
|
38
38
|
200:
|
39
39
|
description: Successful response
|
40
40
|
schema:
|
41
|
-
type:
|
41
|
+
type: string
|
42
|
+
format: binary
|
42
43
|
400:
|
43
44
|
description: Bad Request
|
44
45
|
401:
|
@@ -126,7 +127,8 @@ paths:
|
|
126
127
|
200:
|
127
128
|
description: Successful response
|
128
129
|
schema:
|
129
|
-
type:
|
130
|
+
type: string
|
131
|
+
format: binary
|
130
132
|
400:
|
131
133
|
description: Bad Request
|
132
134
|
403:
|
data/examples/async.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# This example demonstrates creating a PDF using common options and saving it
|
2
|
+
# to a place on the filesystem.
|
3
|
+
#
|
4
|
+
# It is created asynchronously, which means DocRaptor will render it for up to
|
5
|
+
# 10 minutes. This is useful when creating many documents in parallel, or very
|
6
|
+
# large documents with lots of assets.
|
7
|
+
#
|
8
|
+
# DocRaptor supports many options for output customization, the full list is
|
9
|
+
# https://docraptor.com/documentation/api#api_general
|
10
|
+
#
|
11
|
+
# You can run this example with: ruby async.rb
|
12
|
+
|
13
|
+
require "bundler/setup"
|
14
|
+
Bundler.require
|
15
|
+
|
16
|
+
DocRaptor.configure do |dr|
|
17
|
+
dr.username = "YOUR_API_KEY_HERE" # this key works for test documents
|
18
|
+
# dr.debugging = true
|
19
|
+
end
|
20
|
+
|
21
|
+
$docraptor = DocRaptor::ClientApi.new
|
22
|
+
|
23
|
+
begin
|
24
|
+
|
25
|
+
# https://docraptor.com/documentation/api#api_general
|
26
|
+
create_response = $docraptor.create_async_doc(
|
27
|
+
test: true, # test documents are free but watermarked
|
28
|
+
document_content: "<html><body>Hello World</body></html>", # supply content directly
|
29
|
+
# document_url: "http://docraptor.com/examples/invoice.html", # or use a url
|
30
|
+
name: "docraptor-ruby.pdf", # help you find a document later
|
31
|
+
document_type: "pdf", # pdf or xls or xlsx
|
32
|
+
# javascript: true, # enable JavaScript processing
|
33
|
+
# prince_options: {
|
34
|
+
# media: "screen", # use screen styles instead of print styles
|
35
|
+
# baseurl: "http://hello.com", # pretend URL when using document_content
|
36
|
+
# },
|
37
|
+
)
|
38
|
+
|
39
|
+
loop do
|
40
|
+
status_response = $docraptor.get_async_doc_status(create_response.status_id)
|
41
|
+
puts "doc status: #{status_response.status}"
|
42
|
+
case status_response.status
|
43
|
+
when "completed"
|
44
|
+
doc_response = $docraptor.get_async_doc(status_response.download_id)
|
45
|
+
File.open("/tmp/docraptor-ruby.pdf", "wb") do |file|
|
46
|
+
file.write(doc_response)
|
47
|
+
end
|
48
|
+
puts "Wrote PDF to /tmp/docraptor-ruby.pdf"
|
49
|
+
break
|
50
|
+
when "failed"
|
51
|
+
puts "FAILED"
|
52
|
+
puts status_response
|
53
|
+
break
|
54
|
+
else
|
55
|
+
sleep 1
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
rescue DocRaptor::ApiError => error
|
60
|
+
puts "#{error.class}: #{error.message}"
|
61
|
+
puts error.code # HTTP response code
|
62
|
+
puts error.response_body # HTTP response body
|
63
|
+
puts error.backtrace[0..3].join("\n")
|
64
|
+
end
|
data/examples/sync.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# This example demonstrates creating a PDF using common options and saving it
|
2
|
+
# to a place on the filesystem.
|
3
|
+
#
|
4
|
+
# It is created synchronously, which means DocRaptor will render it for up to
|
5
|
+
# 60 seconds. It is slightly simpler than making documents using the async
|
6
|
+
# interface but making many documents in parallel or very large documents with
|
7
|
+
# lots of assets will require the async api.
|
8
|
+
#
|
9
|
+
# DocRaptor supports many options for output customization, the full list is
|
10
|
+
# https://docraptor.com/documentation/api#api_general
|
11
|
+
#
|
12
|
+
# You can run this example with: ruby sync.rb
|
13
|
+
|
14
|
+
require "bundler/setup"
|
15
|
+
Bundler.require
|
16
|
+
|
17
|
+
DocRaptor.configure do |dr|
|
18
|
+
dr.username = "YOUR_API_KEY_HERE" # this key works for test documents
|
19
|
+
# dr.debugging = true
|
20
|
+
end
|
21
|
+
|
22
|
+
$docraptor = DocRaptor::ClientApi.new
|
23
|
+
|
24
|
+
begin
|
25
|
+
|
26
|
+
# https://docraptor.com/documentation/api#api_general
|
27
|
+
create_response = $docraptor.create_doc(
|
28
|
+
test: true, # test documents are free but watermarked
|
29
|
+
document_content: "<html><body>Hello World</body></html>", # supply content directly
|
30
|
+
# document_url: "http://docraptor.com/examples/invoice.html", # or use a url
|
31
|
+
name: "docraptor-ruby.pdf", # help you find a document later
|
32
|
+
document_type: "pdf", # pdf or xls or xlsx
|
33
|
+
# javascript: true, # enable JavaScript processing
|
34
|
+
# prince_options: {
|
35
|
+
# media: "screen", # use screen styles instead of print styles
|
36
|
+
# baseurl: "http://hello.com", # pretend URL when using document_content
|
37
|
+
# },
|
38
|
+
)
|
39
|
+
File.open("/tmp/docraptor-ruby.pdf", "wb") do |file|
|
40
|
+
file.write(create_response)
|
41
|
+
end
|
42
|
+
puts "Wrote PDF to /tmp/docraptor-ruby.pdf"
|
43
|
+
|
44
|
+
rescue DocRaptor::ApiError => error
|
45
|
+
puts "#{error.class}: #{error.message}"
|
46
|
+
puts error.code # HTTP response code
|
47
|
+
puts error.response_body # HTTP response body
|
48
|
+
puts error.backtrace[0..3].join("\n")
|
49
|
+
end
|
@@ -73,7 +73,7 @@ module DocRaptor
|
|
73
73
|
# Creates a document synchronously.
|
74
74
|
# @param doc The document to be created.
|
75
75
|
# @param [Hash] opts the optional parameters
|
76
|
-
# @return [
|
76
|
+
# @return [String]
|
77
77
|
def create_doc(doc, opts = {})
|
78
78
|
data, status_code, headers = create_doc_with_http_info(doc, opts)
|
79
79
|
return data
|
@@ -83,7 +83,7 @@ module DocRaptor
|
|
83
83
|
# Creates a document synchronously.
|
84
84
|
# @param doc The document to be created.
|
85
85
|
# @param [Hash] opts the optional parameters
|
86
|
-
# @return [Array<(
|
86
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
87
87
|
def create_doc_with_http_info(doc, opts = {})
|
88
88
|
if @api_client.config.debugging
|
89
89
|
@api_client.config.logger.debug "Calling API: ClientApi#create_doc ..."
|
@@ -123,7 +123,7 @@ module DocRaptor
|
|
123
123
|
:form_params => form_params,
|
124
124
|
:body => post_body,
|
125
125
|
:auth_names => auth_names,
|
126
|
-
:return_type => '
|
126
|
+
:return_type => 'String')
|
127
127
|
if @api_client.config.debugging
|
128
128
|
@api_client.config.logger.debug "API called: ClientApi#create_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
129
129
|
end
|
@@ -134,7 +134,7 @@ module DocRaptor
|
|
134
134
|
# Downloads a document.
|
135
135
|
# @param id The download_id returned from status request or a callback.
|
136
136
|
# @param [Hash] opts the optional parameters
|
137
|
-
# @return [
|
137
|
+
# @return [String]
|
138
138
|
def get_async_doc(id, opts = {})
|
139
139
|
data, status_code, headers = get_async_doc_with_http_info(id, opts)
|
140
140
|
return data
|
@@ -144,7 +144,7 @@ module DocRaptor
|
|
144
144
|
# Downloads a document.
|
145
145
|
# @param id The download_id returned from status request or a callback.
|
146
146
|
# @param [Hash] opts the optional parameters
|
147
|
-
# @return [Array<(
|
147
|
+
# @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers
|
148
148
|
def get_async_doc_with_http_info(id, opts = {})
|
149
149
|
if @api_client.config.debugging
|
150
150
|
@api_client.config.logger.debug "Calling API: ClientApi#get_async_doc ..."
|
@@ -184,7 +184,7 @@ module DocRaptor
|
|
184
184
|
:form_params => form_params,
|
185
185
|
:body => post_body,
|
186
186
|
:auth_names => auth_names,
|
187
|
-
:return_type => '
|
187
|
+
:return_type => 'String')
|
188
188
|
if @api_client.config.debugging
|
189
189
|
@api_client.config.logger.debug "API called: ClientApi#get_async_doc\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
190
190
|
end
|
data/lib/docraptor/api_client.rb
CHANGED
@@ -106,6 +106,9 @@ module DocRaptor
|
|
106
106
|
body = response.body
|
107
107
|
return nil if body.nil? || body.empty?
|
108
108
|
|
109
|
+
# return response body directly for String return type
|
110
|
+
return body if return_type == 'String'
|
111
|
+
|
109
112
|
# handle file downloading - save response body into a tmp file and return the File instance
|
110
113
|
return download_file(response) if return_type == 'File'
|
111
114
|
|
@@ -274,7 +277,7 @@ module DocRaptor
|
|
274
277
|
# @param [Object] model object to be converted into JSON string
|
275
278
|
# @return [String] JSON string representation of the object
|
276
279
|
def object_to_http_body(model)
|
277
|
-
return if model.nil?
|
280
|
+
return model if model.nil? || model.is_a?(String)
|
278
281
|
_body = nil
|
279
282
|
if model.is_a?(Array)
|
280
283
|
_body = model.map{|m| object_to_hash(m) }
|
data/lib/docraptor/version.rb
CHANGED
data/script/test
CHANGED
@@ -2,13 +2,23 @@
|
|
2
2
|
set -e
|
3
3
|
cd "`dirname \"$0\"`/.."
|
4
4
|
|
5
|
-
|
5
|
+
# check dependencies
|
6
|
+
ruby -v > /dev/null || (echo "ruby must be installed"; exit 1)
|
7
|
+
bundler -v > /dev/null || (echo "bundler must be installed"; exit 1)
|
8
|
+
|
6
9
|
bundle install
|
7
10
|
|
11
|
+
cd test
|
12
|
+
|
13
|
+
# runs a test file with PASS/FAIL message
|
14
|
+
run_test() {
|
15
|
+
ruby $1 && echo "PASS $1" || (echo "FAIL $1"; exit 1)
|
16
|
+
}
|
17
|
+
|
8
18
|
if [ "$1" == "" ]; then
|
9
19
|
for test in $(ls *.rb); do
|
10
|
-
|
20
|
+
run_test $test
|
11
21
|
done
|
12
22
|
else
|
13
|
-
|
23
|
+
run_test $1.rb
|
14
24
|
fi
|
data/swagger-config.json
CHANGED
data/test/async.rb
CHANGED
@@ -1,22 +1,25 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
require "bundler/setup"
|
3
2
|
Bundler.require
|
4
3
|
|
5
4
|
DocRaptor.configure do |dr|
|
6
|
-
dr.username
|
7
|
-
dr.debugging = true
|
5
|
+
dr.username = "YOUR_API_KEY_HERE"
|
6
|
+
# dr.debugging = true
|
8
7
|
end
|
9
8
|
|
10
|
-
|
9
|
+
$docraptor = DocRaptor::ClientApi.new
|
11
10
|
|
12
|
-
|
11
|
+
create_response = $docraptor.create_async_doc(
|
12
|
+
test: true,
|
13
|
+
document_content: "<html><body>Hello from Ruby</body></html>",
|
14
|
+
name: "ruby-async.pdf",
|
15
|
+
document_type: "pdf",
|
16
|
+
)
|
13
17
|
|
14
18
|
status_response = nil
|
15
|
-
|
16
|
-
status_response =
|
19
|
+
30.times do
|
20
|
+
status_response = $docraptor.get_async_doc_status(create_response.status_id)
|
17
21
|
break if status_response.status == "completed"
|
18
22
|
sleep 1
|
19
23
|
end
|
20
24
|
|
21
|
-
|
22
|
-
|
25
|
+
$docraptor.get_async_doc(status_response.download_id)
|
data/test/invalid_async.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
require "bundler/setup"
|
3
2
|
Bundler.require
|
4
3
|
|
5
4
|
DocRaptor.configure do |dr|
|
6
|
-
dr.username
|
7
|
-
dr.debugging = true
|
5
|
+
dr.username = "YOUR_API_KEY_HERE"
|
6
|
+
# dr.debugging = true
|
8
7
|
end
|
9
8
|
|
10
|
-
|
9
|
+
$docraptor = DocRaptor::ClientApi.new
|
11
10
|
|
12
|
-
|
11
|
+
create_response = $docraptor.create_async_doc(
|
12
|
+
test: true,
|
13
|
+
document_content: "<html><body>Hello from Ruby</body></html>",
|
14
|
+
name: "s" * 201, # limit is 200 characters
|
15
|
+
document_type: "pdf",
|
16
|
+
)
|
13
17
|
|
14
18
|
status_response = nil
|
15
19
|
30.times do
|
16
|
-
status_response =
|
20
|
+
status_response = $docraptor.get_async_doc_status(create_response.status_id)
|
17
21
|
exit if status_response.status == "failed"
|
18
22
|
sleep 1
|
19
23
|
end
|
data/test/invalid_sync.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
require "bundler/setup"
|
3
2
|
Bundler.require
|
4
3
|
|
5
4
|
DocRaptor.configure do |dr|
|
6
|
-
dr.username
|
7
|
-
dr.debugging = true
|
5
|
+
dr.username = "YOUR_API_KEY_HERE"
|
6
|
+
# dr.debugging = true
|
8
7
|
end
|
9
8
|
|
10
|
-
|
11
|
-
|
9
|
+
$docraptor = DocRaptor::ClientApi.new
|
12
10
|
|
13
11
|
begin
|
14
|
-
|
12
|
+
$docraptor.create_doc(
|
13
|
+
test: true,
|
14
|
+
name: "s" * 201, # limit is 200 characters
|
15
|
+
document_type: "pdf",
|
16
|
+
)
|
15
17
|
rescue DocRaptor::ApiError
|
16
18
|
exit
|
17
19
|
end
|
data/test/sync.rb
CHANGED
@@ -1,12 +1,16 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
require "bundler/setup"
|
3
2
|
Bundler.require
|
4
3
|
|
5
4
|
DocRaptor.configure do |dr|
|
6
|
-
dr.username
|
7
|
-
dr.debugging = true
|
5
|
+
dr.username = "YOUR_API_KEY_HERE"
|
6
|
+
# dr.debugging = true
|
8
7
|
end
|
9
8
|
|
10
|
-
|
9
|
+
$docraptor = DocRaptor::ClientApi.new
|
11
10
|
|
12
|
-
|
11
|
+
$docraptor.create_doc(
|
12
|
+
test: true,
|
13
|
+
document_content: "<html><body>Hello from Ruby</body></html>",
|
14
|
+
name: "ruby-sync.pdf",
|
15
|
+
document_type: "pdf",
|
16
|
+
)
|
data/test/xlsx.rb
CHANGED
@@ -1,12 +1,16 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
require "bundler/setup"
|
3
2
|
Bundler.require
|
4
3
|
|
5
4
|
DocRaptor.configure do |dr|
|
6
|
-
dr.username
|
7
|
-
dr.debugging = true
|
5
|
+
dr.username = "YOUR_API_KEY_HERE"
|
6
|
+
# dr.debugging = true
|
8
7
|
end
|
9
8
|
|
10
|
-
|
9
|
+
$docraptor = DocRaptor::ClientApi.new
|
11
10
|
|
12
|
-
|
11
|
+
$docraptor.create_doc(
|
12
|
+
test: true,
|
13
|
+
document_content: "<html><body><table><tr><td>Hello from Ruby</td></tr></table></body></html>",
|
14
|
+
name: "ruby-xlsx.xlsx",
|
15
|
+
document_type: "xlsx",
|
16
|
+
)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docraptor
|
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
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-01-
|
12
|
+
date: 2016-01-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: typhoeus
|
@@ -51,6 +51,26 @@ dependencies:
|
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 1.4.6
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: pry
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0.10'
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 0.10.3
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0.10'
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 0.10.3
|
54
74
|
- !ruby/object:Gem::Dependency
|
55
75
|
name: rake
|
56
76
|
requirement: !ruby/object:Gem::Requirement
|
@@ -219,14 +239,16 @@ executables: []
|
|
219
239
|
extensions: []
|
220
240
|
extra_rdoc_files: []
|
221
241
|
files:
|
242
|
+
- ".gitignore"
|
222
243
|
- CHANGELOG.md
|
223
244
|
- Gemfile
|
224
|
-
- Gemfile.lock
|
225
245
|
- LICENSE
|
226
246
|
- README.md
|
227
247
|
- Rakefile
|
228
248
|
- docraptor.gemspec
|
229
249
|
- docraptor.yaml
|
250
|
+
- examples/async.rb
|
251
|
+
- examples/sync.rb
|
230
252
|
- lib/docraptor.rb
|
231
253
|
- lib/docraptor/api/client_api.rb
|
232
254
|
- lib/docraptor/api_client.rb
|
@@ -237,20 +259,18 @@ files:
|
|
237
259
|
- lib/docraptor/models/doc.rb
|
238
260
|
- lib/docraptor/models/prince_options.rb
|
239
261
|
- lib/docraptor/version.rb
|
240
|
-
- pkg/docraptor-0.0.3.gem
|
241
262
|
- script/clean
|
242
263
|
- script/generate_language
|
243
264
|
- script/swagger
|
244
265
|
- script/test
|
245
266
|
- script/update_from_upstream
|
246
267
|
- swagger-config.json
|
247
|
-
- test/Gemfile
|
248
268
|
- test/async.rb
|
249
269
|
- test/invalid_async.rb
|
250
270
|
- test/invalid_sync.rb
|
251
271
|
- test/sync.rb
|
252
272
|
- test/xlsx.rb
|
253
|
-
homepage: https://
|
273
|
+
homepage: https://github.com/docraptor/docraptor-ruby
|
254
274
|
licenses:
|
255
275
|
- Apache-2.0
|
256
276
|
metadata: {}
|
@@ -270,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
290
|
version: '0'
|
271
291
|
requirements: []
|
272
292
|
rubyforge_project:
|
273
|
-
rubygems_version: 2.
|
293
|
+
rubygems_version: 2.5.1
|
274
294
|
signing_key:
|
275
295
|
specification_version: 4
|
276
296
|
summary: A wrapper for the DocRaptor HTML to PDF/XLS service.
|
data/Gemfile.lock
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
docraptor (0.0.3)
|
5
|
-
json (~> 1.4, >= 1.4.6)
|
6
|
-
typhoeus (~> 0.2, >= 0.2.1)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
ZenTest (4.11.0)
|
12
|
-
addressable (2.4.0)
|
13
|
-
autotest (4.4.6)
|
14
|
-
ZenTest (>= 4.4.1)
|
15
|
-
autotest-fsevent (0.2.11)
|
16
|
-
sys-uname
|
17
|
-
autotest-growl (0.2.16)
|
18
|
-
autotest-rails-pure (4.1.2)
|
19
|
-
crack (0.4.3)
|
20
|
-
safe_yaml (~> 1.0.0)
|
21
|
-
diff-lcs (1.2.5)
|
22
|
-
ethon (0.8.1)
|
23
|
-
ffi (>= 1.3.0)
|
24
|
-
ffi (1.9.10)
|
25
|
-
hashdiff (0.2.3)
|
26
|
-
json (1.8.3)
|
27
|
-
rake (10.5.0)
|
28
|
-
rspec (3.4.0)
|
29
|
-
rspec-core (~> 3.4.0)
|
30
|
-
rspec-expectations (~> 3.4.0)
|
31
|
-
rspec-mocks (~> 3.4.0)
|
32
|
-
rspec-core (3.4.1)
|
33
|
-
rspec-support (~> 3.4.0)
|
34
|
-
rspec-expectations (3.4.0)
|
35
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
-
rspec-support (~> 3.4.0)
|
37
|
-
rspec-mocks (3.4.1)
|
38
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
39
|
-
rspec-support (~> 3.4.0)
|
40
|
-
rspec-support (3.4.1)
|
41
|
-
safe_yaml (1.0.4)
|
42
|
-
sys-uname (1.0.2)
|
43
|
-
ffi (>= 1.0.0)
|
44
|
-
typhoeus (0.8.0)
|
45
|
-
ethon (>= 0.8.0)
|
46
|
-
vcr (2.9.3)
|
47
|
-
webmock (1.22.6)
|
48
|
-
addressable (>= 2.3.6)
|
49
|
-
crack (>= 0.3.2)
|
50
|
-
hashdiff
|
51
|
-
|
52
|
-
PLATFORMS
|
53
|
-
ruby
|
54
|
-
|
55
|
-
DEPENDENCIES
|
56
|
-
autotest (~> 4.4, >= 4.4.6)
|
57
|
-
autotest-fsevent (~> 0.2, >= 0.2.11)
|
58
|
-
autotest-growl (~> 0.2, >= 0.2.16)
|
59
|
-
autotest-rails-pure (~> 4.1, >= 4.1.2)
|
60
|
-
docraptor!
|
61
|
-
rake (~> 10.4, >= 10.4.2)
|
62
|
-
rspec (~> 3.2, >= 3.2.0)
|
63
|
-
vcr (~> 2.9, >= 2.9.3)
|
64
|
-
webmock (~> 1.6, >= 1.6.2)
|
65
|
-
|
66
|
-
BUNDLED WITH
|
67
|
-
1.10.6
|
data/pkg/docraptor-0.0.3.gem
DELETED
Binary file
|
data/test/Gemfile
DELETED