docraptor 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.docker_env.list +2 -0
- data/.docker_mounts.list +4 -0
- data/.generator-revision +1 -1
- data/.gitlab-ci.yml +1 -1
- data/.openapi-generator/FILES +5 -0
- data/.openapi-generator/VERSION +1 -1
- data/.openapi-generator-ignore +0 -10
- data/.review/generated_files/README.md +6 -5
- data/.review/generated_files/docs/AsyncDoc.md +18 -0
- data/.review/generated_files/docs/Doc.md +50 -0
- data/.review/generated_files/docs/DocApi.md +503 -0
- data/.review/generated_files/docs/DocStatus.md +28 -0
- data/.review/generated_files/docs/PrinceOptions.md +82 -0
- data/.review/generated_files/spec/api/doc_api_spec.rb +112 -0
- data/.review/generated_files/spec/api_client_spec.rb +228 -0
- data/.review/generated_files/spec/configuration_spec.rb +42 -0
- data/.review/generated_files/spec/models/async_doc_spec.rb +34 -0
- data/.review/generated_files/spec/models/doc_spec.rb +138 -0
- data/.review/generated_files/spec/models/doc_status_spec.rb +64 -0
- data/.review/generated_files/spec/models/prince_options_spec.rb +234 -0
- data/.review/generated_files/spec/spec_helper.rb +111 -0
- data/.runtime-environments +3 -0
- data/.travis.yml +2 -5
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/docraptor.gemspec +1 -1
- data/docraptor.yaml +281 -283
- data/gemfiles/Gemfile.3.1.lock +72 -0
- data/gemfiles/Gemfile.3.2.lock +72 -0
- data/gemfiles/Gemfile.3.3.lock +72 -0
- data/generator-config.json +1 -1
- data/lib/docraptor/api/doc_api.rb +33 -13
- data/lib/docraptor/api_client.rb +1 -1
- data/lib/docraptor/api_error.rb +2 -1
- data/lib/docraptor/configuration.rb +19 -3
- data/lib/docraptor/models/async_doc.rb +1 -1
- data/lib/docraptor/models/doc.rb +1 -6
- data/lib/docraptor/models/doc_status.rb +1 -1
- data/lib/docraptor/models/prince_options.rb +49 -10
- data/lib/docraptor/version.rb +2 -2
- data/lib/docraptor.rb +1 -1
- data/script/docker +21 -4
- data/script/generate_language +26 -4
- data/script/inside_container/test +52 -3
- data/script/post_generate_language +1 -3
- data/script/release +13 -0
- data/test/iframes_default.rb +40 -0
- data/test/iframes_false.rb +40 -0
- data/test/iframes_true.rb +40 -0
- data/test/prince_options.rb +45 -0
- data/test/xlsx.rb +6 -2
- metadata +32 -6
@@ -0,0 +1,28 @@
|
|
1
|
+
# DocRaptor::DocStatus
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **status** | **String** | The present status of the document. Can be queued, working, completed, and failed. | [optional] |
|
8
|
+
| **download_url** | **String** | The URL where the document can be retrieved. This URL may only be used a few times. | [optional] |
|
9
|
+
| **download_id** | **String** | The identifier for downloading the document with the download API. | [optional] |
|
10
|
+
| **message** | **String** | Additional information. | [optional] |
|
11
|
+
| **number_of_pages** | **Integer** | Number of PDF pages in document. | [optional] |
|
12
|
+
| **validation_errors** | **String** | Error information. | [optional] |
|
13
|
+
|
14
|
+
## Example
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
require 'docraptor'
|
18
|
+
|
19
|
+
instance = DocRaptor::DocStatus.new(
|
20
|
+
status: null,
|
21
|
+
download_url: null,
|
22
|
+
download_id: null,
|
23
|
+
message: null,
|
24
|
+
number_of_pages: null,
|
25
|
+
validation_errors: null
|
26
|
+
)
|
27
|
+
```
|
28
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# DocRaptor::PrinceOptions
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **baseurl** | **String** | Set the baseurl for assets. | [optional] |
|
8
|
+
| **no_xinclude** | **Boolean** | Disable XML inclusion. | [optional] |
|
9
|
+
| **no_network** | **Boolean** | Disable network access. | [optional] |
|
10
|
+
| **no_parallel_downloads** | **Boolean** | Disables parallel fetching of assets during PDF creation. Useful if your asset host has strict rate limiting. | [optional] |
|
11
|
+
| **http_user** | **String** | Set the user for HTTP authentication. | [optional] |
|
12
|
+
| **http_password** | **String** | Set the password for HTTP authentication. | [optional] |
|
13
|
+
| **http_proxy** | **String** | Set the HTTP proxy server. | [optional] |
|
14
|
+
| **http_timeout** | **Integer** | Set the HTTP request timeout. | [optional] |
|
15
|
+
| **insecure** | **Boolean** | Disable SSL verification. | [optional] |
|
16
|
+
| **media** | **String** | Specify the CSS media type. Defaults to \"print\" but you may want to use \"screen\" for web styles. | [optional] |
|
17
|
+
| **no_author_style** | **Boolean** | Ignore author stylesheets. | [optional] |
|
18
|
+
| **no_default_style** | **Boolean** | Ignore default stylesheets. | [optional] |
|
19
|
+
| **no_embed_fonts** | **Boolean** | Disable font embedding in PDFs. | [optional] |
|
20
|
+
| **no_subset_fonts** | **Boolean** | Disable font subsetting in PDFs. | [optional] |
|
21
|
+
| **no_compress** | **Boolean** | Disable PDF compression. | [optional] |
|
22
|
+
| **encrypt** | **Boolean** | Encrypt PDF output. | [optional] |
|
23
|
+
| **key_bits** | **Integer** | Set encryption key size. | [optional] |
|
24
|
+
| **user_password** | **String** | Set the PDF user password. | [optional] |
|
25
|
+
| **owner_password** | **String** | Set the PDF owner password. | [optional] |
|
26
|
+
| **disallow_print** | **Boolean** | Disallow printing of this PDF. | [optional] |
|
27
|
+
| **disallow_copy** | **Boolean** | Disallow copying of this PDF. | [optional] |
|
28
|
+
| **disallow_annotate** | **Boolean** | Disallow annotation of this PDF. | [optional] |
|
29
|
+
| **disallow_modify** | **Boolean** | Disallow modification of this PDF. | [optional] |
|
30
|
+
| **debug** | **Boolean** | Enable Prince debug mode. | [optional] |
|
31
|
+
| **input** | **String** | Specify the input format, defaults to html. | [optional] |
|
32
|
+
| **version** | **String** | Deprecated, use the appropriate `pipeline` version. Specify a specific verison of PrinceXML to use. | [optional] |
|
33
|
+
| **javascript** | **Boolean** | Enable PrinceXML JavaScript. DocRaptor JavaScript parsing is also available elsewhere. | [optional] |
|
34
|
+
| **css_dpi** | **Integer** | Set the DPI when rendering CSS. Defaults to 96 but can be set with Prince 9.0 and up. | [optional] |
|
35
|
+
| **profile** | **String** | In Prince 9.0 and up you can set the PDF profile. | [optional] |
|
36
|
+
| **pdf_title** | **String** | Specify the PDF title, part of the document's metadata. | [optional] |
|
37
|
+
| **iframes** | **Boolean** | Enable loading of iframes. | [optional] |
|
38
|
+
| **page_margin** | **String** | Specify the page margin distance. | [optional] |
|
39
|
+
| **pdf_forms** | **Boolean** | Make form fields editable by default. | [optional] |
|
40
|
+
|
41
|
+
## Example
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
require 'docraptor'
|
45
|
+
|
46
|
+
instance = DocRaptor::PrinceOptions.new(
|
47
|
+
baseurl: null,
|
48
|
+
no_xinclude: null,
|
49
|
+
no_network: null,
|
50
|
+
no_parallel_downloads: null,
|
51
|
+
http_user: null,
|
52
|
+
http_password: null,
|
53
|
+
http_proxy: null,
|
54
|
+
http_timeout: null,
|
55
|
+
insecure: null,
|
56
|
+
media: null,
|
57
|
+
no_author_style: null,
|
58
|
+
no_default_style: null,
|
59
|
+
no_embed_fonts: null,
|
60
|
+
no_subset_fonts: null,
|
61
|
+
no_compress: null,
|
62
|
+
encrypt: null,
|
63
|
+
key_bits: null,
|
64
|
+
user_password: null,
|
65
|
+
owner_password: null,
|
66
|
+
disallow_print: null,
|
67
|
+
disallow_copy: null,
|
68
|
+
disallow_annotate: null,
|
69
|
+
disallow_modify: null,
|
70
|
+
debug: null,
|
71
|
+
input: null,
|
72
|
+
version: null,
|
73
|
+
javascript: null,
|
74
|
+
css_dpi: null,
|
75
|
+
profile: null,
|
76
|
+
pdf_title: null,
|
77
|
+
iframes: null,
|
78
|
+
page_margin: null,
|
79
|
+
pdf_forms: null
|
80
|
+
)
|
81
|
+
```
|
82
|
+
|
@@ -0,0 +1,112 @@
|
|
1
|
+
=begin
|
2
|
+
#DocRaptor
|
3
|
+
|
4
|
+
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for DocRaptor::DocApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'DocApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = DocRaptor::DocApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of DocApi' do
|
30
|
+
it 'should create an instance of DocApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(DocRaptor::DocApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for create_async_doc
|
36
|
+
# Creates a document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document.
|
37
|
+
# @param doc
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @return [AsyncDoc]
|
40
|
+
describe 'create_async_doc test' do
|
41
|
+
it 'should work' do
|
42
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# unit tests for create_doc
|
47
|
+
# Creates a document synchronously.
|
48
|
+
# @param doc
|
49
|
+
# @param [Hash] opts the optional parameters
|
50
|
+
# @return [String]
|
51
|
+
describe 'create_doc test' do
|
52
|
+
it 'should work' do
|
53
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# unit tests for create_hosted_async_doc
|
58
|
+
# Creates a hosted document asynchronously. You must use a callback url or the returned status id and the status API to find out when it completes. Then use the download API to get the document.
|
59
|
+
# @param doc
|
60
|
+
# @param [Hash] opts the optional parameters
|
61
|
+
# @return [AsyncDoc]
|
62
|
+
describe 'create_hosted_async_doc test' do
|
63
|
+
it 'should work' do
|
64
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# unit tests for create_hosted_doc
|
69
|
+
# Creates a hosted document synchronously.
|
70
|
+
# @param doc The document to be created.
|
71
|
+
# @param [Hash] opts the optional parameters
|
72
|
+
# @return [DocStatus]
|
73
|
+
describe 'create_hosted_doc test' do
|
74
|
+
it 'should work' do
|
75
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# unit tests for expire
|
80
|
+
# Expires a previously created hosted doc.
|
81
|
+
# @param id The download_id returned from status request or hosted document response.
|
82
|
+
# @param [Hash] opts the optional parameters
|
83
|
+
# @return [nil]
|
84
|
+
describe 'expire test' do
|
85
|
+
it 'should work' do
|
86
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# unit tests for get_async_doc
|
91
|
+
# Downloads a finished document.
|
92
|
+
# @param id The download_id returned from an async status request or callback.
|
93
|
+
# @param [Hash] opts the optional parameters
|
94
|
+
# @return [String]
|
95
|
+
describe 'get_async_doc test' do
|
96
|
+
it 'should work' do
|
97
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# unit tests for get_async_doc_status
|
102
|
+
# Check on the status of an asynchronously created document.
|
103
|
+
# @param id The status_id returned when creating an asynchronous document.
|
104
|
+
# @param [Hash] opts the optional parameters
|
105
|
+
# @return [DocStatus]
|
106
|
+
describe 'get_async_doc_status test' do
|
107
|
+
it 'should work' do
|
108
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
@@ -0,0 +1,228 @@
|
|
1
|
+
=begin
|
2
|
+
#DocRaptor
|
3
|
+
|
4
|
+
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
|
15
|
+
describe DocRaptor::ApiClient do
|
16
|
+
context 'initialization' do
|
17
|
+
context 'URL stuff' do
|
18
|
+
context 'host' do
|
19
|
+
it 'removes http from host' do
|
20
|
+
DocRaptor.configure { |c| c.host = 'http://example.com' }
|
21
|
+
expect(DocRaptor::Configuration.default.host).to eq('example.com')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'removes https from host' do
|
25
|
+
DocRaptor.configure { |c| c.host = 'https://wookiee.com' }
|
26
|
+
expect(DocRaptor::ApiClient.default.config.host).to eq('wookiee.com')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'removes trailing path from host' do
|
30
|
+
DocRaptor.configure { |c| c.host = 'hobo.com/v4' }
|
31
|
+
expect(DocRaptor::Configuration.default.host).to eq('hobo.com')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'base_path' do
|
36
|
+
it "prepends a slash to base_path" do
|
37
|
+
DocRaptor.configure { |c| c.base_path = 'v4/dog' }
|
38
|
+
expect(DocRaptor::Configuration.default.base_path).to eq('/v4/dog')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "doesn't prepend a slash if one is already there" do
|
42
|
+
DocRaptor.configure { |c| c.base_path = '/v4/dog' }
|
43
|
+
expect(DocRaptor::Configuration.default.base_path).to eq('/v4/dog')
|
44
|
+
end
|
45
|
+
|
46
|
+
it "ends up as a blank string if nil" do
|
47
|
+
DocRaptor.configure { |c| c.base_path = nil }
|
48
|
+
expect(DocRaptor::Configuration.default.base_path).to eq('')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'params_encoding in #build_request' do
|
55
|
+
let(:config) { DocRaptor::Configuration.new }
|
56
|
+
let(:api_client) { DocRaptor::ApiClient.new(config) }
|
57
|
+
|
58
|
+
it 'defaults to nil' do
|
59
|
+
expect(DocRaptor::Configuration.default.params_encoding).to eq(nil)
|
60
|
+
expect(config.params_encoding).to eq(nil)
|
61
|
+
|
62
|
+
request = api_client.build_request(:get, '/test')
|
63
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'can be customized' do
|
67
|
+
config.params_encoding = :multi
|
68
|
+
request = api_client.build_request(:get, '/test')
|
69
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'timeout in #build_request' do
|
74
|
+
let(:config) { DocRaptor::Configuration.new }
|
75
|
+
let(:api_client) { DocRaptor::ApiClient.new(config) }
|
76
|
+
|
77
|
+
it 'defaults to 0' do
|
78
|
+
expect(DocRaptor::Configuration.default.timeout).to eq(0)
|
79
|
+
expect(config.timeout).to eq(0)
|
80
|
+
|
81
|
+
request = api_client.build_request(:get, '/test')
|
82
|
+
expect(request.options[:timeout]).to eq(0)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'can be customized' do
|
86
|
+
config.timeout = 100
|
87
|
+
request = api_client.build_request(:get, '/test')
|
88
|
+
expect(request.options[:timeout]).to eq(100)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
describe '#deserialize' do
|
95
|
+
it "handles Array<Integer>" do
|
96
|
+
api_client = DocRaptor::ApiClient.new
|
97
|
+
headers = { 'Content-Type' => 'application/json' }
|
98
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
99
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
100
|
+
expect(data).to be_instance_of(Array)
|
101
|
+
expect(data).to eq([12, 34])
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'handles Array<Array<Integer>>' do
|
105
|
+
api_client = DocRaptor::ApiClient.new
|
106
|
+
headers = { 'Content-Type' => 'application/json' }
|
107
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
108
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
109
|
+
expect(data).to be_instance_of(Array)
|
110
|
+
expect(data).to eq([[12, 34], [56]])
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'handles Hash<String, String>' do
|
114
|
+
api_client = DocRaptor::ApiClient.new
|
115
|
+
headers = { 'Content-Type' => 'application/json' }
|
116
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
117
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
118
|
+
expect(data).to be_instance_of(Hash)
|
119
|
+
expect(data).to eq(:message => 'Hello')
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "#object_to_hash" do
|
124
|
+
it 'ignores nils and includes empty arrays' do
|
125
|
+
# uncomment below to test object_to_hash for model
|
126
|
+
# api_client = DocRaptor::ApiClient.new
|
127
|
+
# _model = DocRaptor::ModelName.new
|
128
|
+
# update the model attribute below
|
129
|
+
# _model.id = 1
|
130
|
+
# update the expected value (hash) below
|
131
|
+
# expected = {id: 1, name: '', tags: []}
|
132
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
describe '#build_collection_param' do
|
137
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
138
|
+
let(:api_client) { DocRaptor::ApiClient.new }
|
139
|
+
|
140
|
+
it 'works for csv' do
|
141
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'works for ssv' do
|
145
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'works for tsv' do
|
149
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'works for pipes' do
|
153
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'works for multi' do
|
157
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'fails for invalid collection format' do
|
161
|
+
expect { api_client.build_collection_param(param, :INVALID) }.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
describe '#json_mime?' do
|
166
|
+
let(:api_client) { DocRaptor::ApiClient.new }
|
167
|
+
|
168
|
+
it 'works' do
|
169
|
+
expect(api_client.json_mime?(nil)).to eq false
|
170
|
+
expect(api_client.json_mime?('')).to eq false
|
171
|
+
|
172
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
173
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
174
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
175
|
+
|
176
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
177
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
178
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
describe '#select_header_accept' do
|
183
|
+
let(:api_client) { DocRaptor::ApiClient.new }
|
184
|
+
|
185
|
+
it 'works' do
|
186
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
187
|
+
expect(api_client.select_header_accept([])).to be_nil
|
188
|
+
|
189
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
190
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
191
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
192
|
+
|
193
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
194
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
describe '#select_header_content_type' do
|
199
|
+
let(:api_client) { DocRaptor::ApiClient.new }
|
200
|
+
|
201
|
+
it 'works' do
|
202
|
+
expect(api_client.select_header_content_type(nil)).to be_nil
|
203
|
+
expect(api_client.select_header_content_type([])).to be_nil
|
204
|
+
|
205
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
206
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
207
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
208
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
209
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
describe '#sanitize_filename' do
|
214
|
+
let(:api_client) { DocRaptor::ApiClient.new }
|
215
|
+
|
216
|
+
it 'works' do
|
217
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
218
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
219
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
220
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
221
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
222
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
223
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
224
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
225
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
=begin
|
2
|
+
#DocRaptor
|
3
|
+
|
4
|
+
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
|
15
|
+
describe DocRaptor::Configuration do
|
16
|
+
let(:config) { DocRaptor::Configuration.default }
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
# uncomment below to setup host and base_path
|
20
|
+
# require 'URI'
|
21
|
+
# uri = URI.parse("https://api.docraptor.com")
|
22
|
+
# DocRaptor.configure do |c|
|
23
|
+
# c.host = uri.host
|
24
|
+
# c.base_path = uri.path
|
25
|
+
# end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#base_url' do
|
29
|
+
it 'should have the default value' do
|
30
|
+
# uncomment below to test default value of the base path
|
31
|
+
# expect(config.base_url).to eq("https://api.docraptor.com")
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should remove trailing slashes' do
|
35
|
+
[nil, '', '/', '//'].each do |base_path|
|
36
|
+
config.base_path = base_path
|
37
|
+
# uncomment below to test trailing slashes
|
38
|
+
# expect(config.base_url).to eq("https://api.docraptor.com")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
=begin
|
2
|
+
#DocRaptor
|
3
|
+
|
4
|
+
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for DocRaptor::AsyncDoc
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe DocRaptor::AsyncDoc do
|
21
|
+
let(:instance) { DocRaptor::AsyncDoc.new }
|
22
|
+
|
23
|
+
describe 'test an instance of AsyncDoc' do
|
24
|
+
it 'should create an instance of AsyncDoc' do
|
25
|
+
expect(instance).to be_instance_of(DocRaptor::AsyncDoc)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
describe 'test attribute "status_id"' do
|
29
|
+
it 'should work' do
|
30
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
=begin
|
2
|
+
#DocRaptor
|
3
|
+
|
4
|
+
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for DocRaptor::Doc
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe DocRaptor::Doc do
|
21
|
+
let(:instance) { DocRaptor::Doc.new }
|
22
|
+
|
23
|
+
describe 'test an instance of Doc' do
|
24
|
+
it 'should create an instance of Doc' do
|
25
|
+
expect(instance).to be_instance_of(DocRaptor::Doc)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
describe 'test attribute "name"' do
|
29
|
+
it 'should work' do
|
30
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'test attribute "document_type"' do
|
35
|
+
it 'should work' do
|
36
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
37
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["pdf", "xls", "xlsx"])
|
38
|
+
# validator.allowable_values.each do |value|
|
39
|
+
# expect { instance.document_type = value }.not_to raise_error
|
40
|
+
# end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'test attribute "document_content"' do
|
45
|
+
it 'should work' do
|
46
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe 'test attribute "document_url"' do
|
51
|
+
it 'should work' do
|
52
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe 'test attribute "test"' do
|
57
|
+
it 'should work' do
|
58
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe 'test attribute "pipeline"' do
|
63
|
+
it 'should work' do
|
64
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe 'test attribute "strict"' do
|
69
|
+
it 'should work' do
|
70
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
71
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["none", "html"])
|
72
|
+
# validator.allowable_values.each do |value|
|
73
|
+
# expect { instance.strict = value }.not_to raise_error
|
74
|
+
# end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe 'test attribute "ignore_resource_errors"' do
|
79
|
+
it 'should work' do
|
80
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe 'test attribute "ignore_console_messages"' do
|
85
|
+
it 'should work' do
|
86
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe 'test attribute "tag"' do
|
91
|
+
it 'should work' do
|
92
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe 'test attribute "help"' do
|
97
|
+
it 'should work' do
|
98
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe 'test attribute "javascript"' do
|
103
|
+
it 'should work' do
|
104
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe 'test attribute "referrer"' do
|
109
|
+
it 'should work' do
|
110
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe 'test attribute "callback_url"' do
|
115
|
+
it 'should work' do
|
116
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe 'test attribute "hosted_download_limit"' do
|
121
|
+
it 'should work' do
|
122
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe 'test attribute "hosted_expires_at"' do
|
127
|
+
it 'should work' do
|
128
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
describe 'test attribute "prince_options"' do
|
133
|
+
it 'should work' do
|
134
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|