docraptor 2.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.docker_env.list +5 -0
  3. data/.docker_mounts.list +4 -0
  4. data/.generator-language-identifier +1 -0
  5. data/.generator-revision +1 -0
  6. data/.github/pull_request_template.txt +17 -0
  7. data/.gitignore +20 -14
  8. data/.gitlab-ci.yml +26 -0
  9. data/.openapi-generator/FILES +32 -0
  10. data/.openapi-generator/VERSION +1 -0
  11. data/{.swagger-codegen-ignore → .openapi-generator-ignore} +13 -7
  12. data/.review/README.md +16 -0
  13. data/.review/generated_files/.gitignore +39 -0
  14. data/.review/generated_files/README.md +108 -0
  15. data/.review/generated_files/docs/AsyncDoc.md +18 -0
  16. data/.review/generated_files/docs/Doc.md +50 -0
  17. data/.review/generated_files/docs/DocApi.md +503 -0
  18. data/.review/generated_files/docs/DocStatus.md +28 -0
  19. data/.review/generated_files/docs/PrinceOptions.md +82 -0
  20. data/.review/generated_files/spec/api/doc_api_spec.rb +112 -0
  21. data/{spec → .review/generated_files/spec}/api_client_spec.rb +6 -21
  22. data/{spec → .review/generated_files/spec}/configuration_spec.rb +6 -6
  23. data/.review/generated_files/spec/models/async_doc_spec.rb +34 -0
  24. data/.review/generated_files/spec/models/doc_spec.rb +138 -0
  25. data/.review/generated_files/spec/models/doc_status_spec.rb +64 -0
  26. data/.review/generated_files/spec/models/prince_options_spec.rb +234 -0
  27. data/{spec → .review/generated_files/spec}/spec_helper.rb +3 -3
  28. data/.rubocop.yml +148 -0
  29. data/.runtime-environments +13 -0
  30. data/.travis.yml +9 -7
  31. data/CHANGELOG.md +8 -0
  32. data/Gemfile +3 -1
  33. data/README.md +8 -8
  34. data/Rakefile +1 -2
  35. data/docraptor.gemspec +5 -19
  36. data/docraptor.yaml +283 -284
  37. data/examples/async.rb +24 -30
  38. data/examples/hosted_async.rb +21 -33
  39. data/examples/hosted_sync.rb +19 -32
  40. data/examples/sync.rb +20 -26
  41. data/gemfiles/Gemfile.2.5.lock +70 -0
  42. data/gemfiles/Gemfile.2.6.lock +70 -0
  43. data/gemfiles/Gemfile.2.7.lock +70 -0
  44. data/gemfiles/Gemfile.3.0.lock +70 -0
  45. data/gemfiles/Gemfile.3.1.lock +72 -0
  46. data/gemfiles/Gemfile.3.2.lock +72 -0
  47. data/gemfiles/Gemfile.3.3.lock +72 -0
  48. data/{swagger-config.json → generator-config.json} +3 -2
  49. data/lib/docraptor/api/doc_api.rb +180 -85
  50. data/lib/docraptor/api_client.rb +91 -90
  51. data/lib/docraptor/api_error.rb +23 -3
  52. data/lib/docraptor/configuration.rb +101 -15
  53. data/lib/docraptor/models/async_doc.rb +53 -18
  54. data/lib/docraptor/models/doc.rb +80 -50
  55. data/lib/docraptor/models/doc_status.rb +58 -23
  56. data/lib/docraptor/models/prince_options.rb +149 -75
  57. data/lib/docraptor/version.rb +4 -4
  58. data/lib/docraptor.rb +3 -3
  59. data/script/clean +2 -2
  60. data/script/console +5 -0
  61. data/script/docker +56 -0
  62. data/script/fix_gemspec.rb +3 -18
  63. data/script/generate_language +43 -4
  64. data/script/inside_container/README.md +6 -0
  65. data/script/inside_container/test +87 -0
  66. data/script/post_generate_language +8 -2
  67. data/script/release +13 -0
  68. data/script/setup +25 -14
  69. data/script/swagger +6 -33
  70. data/script/test +30 -27
  71. data/test/async.rb +2 -2
  72. data/test/expire_hosted.rb +2 -2
  73. data/test/hosted_async.rb +7 -1
  74. data/test/hosted_sync.rb +2 -2
  75. data/test/iframes_default.rb +40 -0
  76. data/test/iframes_false.rb +40 -0
  77. data/test/iframes_true.rb +40 -0
  78. data/test/prince_options.rb +45 -0
  79. data/test/sync.rb +2 -2
  80. data/test/xlsx.rb +10 -3
  81. metadata +52 -214
  82. data/.swagger-codegen/VERSION +0 -1
  83. data/.swagger-revision +0 -1
data/docraptor.yaml CHANGED
@@ -1,7 +1,7 @@
1
- swagger: '2.0'
1
+ openapi: '3.0.0'
2
2
 
3
3
  info: # https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#info-object
4
- version: "1.4.0"
4
+ version: "2.0.0"
5
5
  title: DocRaptor
6
6
  description: "A native client library for the DocRaptor HTML to PDF/XLS service."
7
7
  termsOfService: "https://docraptor.com/tos"
@@ -9,19 +9,9 @@ info: # https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
9
9
  name: "MIT"
10
10
  url: "https://mit-license.org/"
11
11
 
12
- host: docraptor.com
13
- basePath: /
14
- schemes: [https]
15
- securityDefinitions:
16
- basicAuth:
17
- type: basic
18
- description: Use your API key as the username. Password does not need to be set.
19
- produces:
20
- - application/json
21
- - application/xml
22
- - application/pdf
23
- - application/vnd.ms-excel
24
- - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
12
+ servers:
13
+ - url: https://api.docraptor.com
14
+ description: DocRaptor API endpoint
25
15
 
26
16
  paths:
27
17
  /docs:
@@ -32,19 +22,20 @@ paths:
32
22
  Creates a document synchronously.
33
23
  security:
34
24
  - basicAuth: []
35
- parameters:
36
- - name: doc
37
- in: body
38
- description: The document to be created.
39
- required: true
40
- schema:
41
- $ref: '#/definitions/Doc'
25
+ requestBody:
26
+ content:
27
+ application/json:
28
+ schema:
29
+ $ref: '#/components/schemas/Doc'
30
+ required: true
42
31
  responses:
43
32
  200:
44
33
  description: Successful response
45
- schema:
46
- type: string
47
- format: binary
34
+ content:
35
+ "*/*":
36
+ schema:
37
+ type: string
38
+ format: byte
48
39
  400:
49
40
  description: Bad Request
50
41
  401:
@@ -64,18 +55,20 @@ paths:
64
55
  Creates a hosted document synchronously.
65
56
  security:
66
57
  - basicAuth: []
67
- parameters:
68
- - name: doc
69
- in: body
70
- description: The document to be created.
71
- required: true
72
- schema:
73
- $ref: '#/definitions/Doc'
58
+ requestBody:
59
+ description: The document to be created.
60
+ required: true
61
+ content:
62
+ application/json:
63
+ schema:
64
+ $ref: '#/components/schemas/Doc'
74
65
  responses:
75
66
  200:
76
67
  description: Successful response
77
- schema:
78
- $ref: '#/definitions/DocStatus'
68
+ content:
69
+ "*/*":
70
+ schema:
71
+ $ref: '#/components/schemas/DocStatus'
79
72
  400:
80
73
  description: Bad Request
81
74
  401:
@@ -97,18 +90,19 @@ paths:
97
90
  Then use the download API to get the document.
98
91
  security:
99
92
  - basicAuth: []
100
- parameters:
101
- - name: doc
102
- in: body
103
- description: The document to be created.
104
- required: true
105
- schema:
106
- $ref: '#/definitions/Doc'
93
+ requestBody:
94
+ content:
95
+ application/json:
96
+ schema:
97
+ $ref: '#/components/schemas/Doc'
98
+ required: true
107
99
  responses:
108
100
  200:
109
101
  description: Successful response
110
- schema:
111
- $ref: '#/definitions/AsyncDoc'
102
+ content:
103
+ "*/*":
104
+ schema:
105
+ $ref: '#/components/schemas/AsyncDoc'
112
106
  400:
113
107
  description: Bad Request
114
108
  401:
@@ -130,18 +124,19 @@ paths:
130
124
  Then use the download API to get the document.
131
125
  security:
132
126
  - basicAuth: []
133
- parameters:
134
- - name: doc
135
- in: body
136
- description: The document to be created.
137
- required: true
138
- schema:
139
- $ref: '#/definitions/Doc'
127
+ requestBody:
128
+ content:
129
+ application/json:
130
+ schema:
131
+ $ref: '#/components/schemas/Doc'
132
+ required: true
140
133
  responses:
141
134
  200:
142
135
  description: Successful response
143
- schema:
144
- $ref: '#/definitions/AsyncDoc'
136
+ content:
137
+ "*/*":
138
+ schema:
139
+ $ref: '#/components/schemas/AsyncDoc'
145
140
  400:
146
141
  description: Bad Request
147
142
  401:
@@ -166,12 +161,15 @@ paths:
166
161
  in: path
167
162
  description: The status_id returned when creating an asynchronous document.
168
163
  required: true
169
- type: string
164
+ schema:
165
+ type: string
170
166
  responses:
171
167
  200:
172
168
  description: Successful response
173
- schema:
174
- $ref: '#/definitions/DocStatus'
169
+ content:
170
+ "*/*":
171
+ schema:
172
+ $ref: '#/components/schemas/DocStatus'
175
173
  401:
176
174
  description: Unauthorized
177
175
  403:
@@ -192,13 +190,16 @@ paths:
192
190
  in: path
193
191
  description: The download_id returned from an async status request or callback.
194
192
  required: true
195
- type: string
193
+ schema:
194
+ type: string
196
195
  responses:
197
196
  200:
198
197
  description: Successful response
199
- schema:
200
- type: string
201
- format: binary
198
+ content:
199
+ "*/*":
200
+ schema:
201
+ type: string
202
+ format: byte
202
203
  400:
203
204
  description: Bad Request
204
205
  403:
@@ -219,7 +220,8 @@ paths:
219
220
  in: path
220
221
  description: The download_id returned from status request or hosted document response.
221
222
  required: true
222
- type: string
223
+ schema:
224
+ type: string
223
225
  responses:
224
226
  200:
225
227
  description: Successful response
@@ -230,230 +232,227 @@ paths:
230
232
  500:
231
233
  description: Server Error
232
234
 
233
- definitions:
234
- Doc:
235
- type: object
236
- required:
237
- - name
238
- - document_type
239
- - document_content
240
- properties:
241
- name:
242
- type: string
243
- description: A name for identifying your document.
244
- document_type:
245
- type: string
246
- description: The type of document being created.
247
- enum:
248
- - pdf
249
- - xls
250
- - xlsx
251
- document_content:
252
- type: string
253
- description: >
254
- The HTML data to be transformed into a document.
255
- You must supply content using document_content or document_url.
256
- document_url:
257
- type: string
258
- description: >
259
- The URL to fetch the HTML data to be transformed into a document.
260
- You must supply content using document_content or document_url.
261
- test:
262
- type: boolean
263
- description: Enable test mode for this document. Test documents are not charged for but include a watermark.
264
- default: true
265
- pipeline:
266
- type: string
267
- description: Specify a specific verison of the DocRaptor Pipeline to use.
268
- strict:
269
- type: string
270
- description: Force strict HTML validation.
271
- enum:
272
- - none
273
- - html
274
- ignore_resource_errors:
275
- type: boolean
276
- description: Failed loading of images/javascripts/stylesheets/etc. will not cause the rendering to stop.
277
- default: true
278
- ignore_console_messages:
279
- type: boolean
280
- description: Prevent console.log from stopping document rendering during JavaScript execution.
281
- default: false
282
- tag:
283
- type: string
284
- description: A field for storing a small amount of metadata with this document.
285
- help:
286
- type: boolean
287
- description: Request support help with this request if it succeeds.
288
- default: false
289
- javascript:
290
- type: boolean
291
- description: Enable DocRaptor JavaScript parsing. PrinceXML JavaScript parsing is also available elsewhere.
292
- default: false
293
- referrer:
294
- type: string
295
- description: Set HTTP referrer when generating this document.
296
- callback_url:
297
- type: string
298
- description: >
299
- A URL that will receive a POST request after successfully completing an asynchronous document.
300
- The POST data will include download_url and download_id similar to status API responses.
301
- WARNING: this only works on asynchronous documents.
302
- hosted_download_limit:
303
- type: integer
304
- description: The number of times a hosted document can be downloaded. If no limit is specified, the document will be available for an unlimited number of downloads.
305
- hosted_expires_at:
306
- type: string
307
- description: The date and time at which a hosted document will be removed and no longer available. Must be a properly formatted ISO 8601 datetime, like 1981-01-23T08:02:30-05:00.
308
- prince_options:
309
- $ref: '#/definitions/PrinceOptions'
235
+ components:
236
+ securitySchemes:
237
+ basicAuth:
238
+ type: http
239
+ scheme: basic
240
+ description: Use your API key as the username. Password does not need to be set.
241
+ schemas:
242
+ Doc:
243
+ type: object
244
+ required:
245
+ - name
246
+ - document_type
247
+ properties:
248
+ name:
249
+ type: string
250
+ description: A name for identifying your document.
251
+ document_type:
252
+ type: string
253
+ description: The type of document being created.
254
+ enum:
255
+ - pdf
256
+ - xls
257
+ - xlsx
258
+ document_content:
259
+ type: string
260
+ description: >
261
+ The HTML data to be transformed into a document.
262
+ You must supply content using document_content or document_url.
263
+ document_url:
264
+ type: string
265
+ description: >
266
+ The URL to fetch the HTML data to be transformed into a document.
267
+ You must supply content using document_content or document_url.
268
+ test:
269
+ type: boolean
270
+ description: Enable test mode for this document. Test documents are not charged for but include a watermark.
271
+ default: true
272
+ pipeline:
273
+ type: string
274
+ description: Specify a specific verison of the DocRaptor Pipeline to use.
275
+ strict:
276
+ type: string
277
+ description: Force strict HTML validation.
278
+ enum:
279
+ - none
280
+ - html
281
+ ignore_resource_errors:
282
+ type: boolean
283
+ description: Failed loading of images/javascripts/stylesheets/etc. will not cause the rendering to stop.
284
+ default: true
285
+ ignore_console_messages:
286
+ type: boolean
287
+ description: Prevent console.log from stopping document rendering during JavaScript execution.
288
+ default: false
289
+ tag:
290
+ type: string
291
+ description: A field for storing a small amount of metadata with this document.
292
+ help:
293
+ type: boolean
294
+ description: Request support help with this request if it succeeds.
295
+ default: false
296
+ javascript:
297
+ type: boolean
298
+ description: Enable DocRaptor JavaScript parsing. PrinceXML JavaScript parsing is also available elsewhere.
299
+ default: false
300
+ referrer:
301
+ type: string
302
+ description: Set HTTP referrer when generating this document.
303
+ callback_url:
304
+ type: string
305
+ description: >
306
+ A URL that will receive a POST request after successfully completing an asynchronous document.
307
+ The POST data will include download_url and download_id similar to status API responses.
308
+ WARNING: this only works on asynchronous documents.
309
+ hosted_download_limit:
310
+ type: integer
311
+ description: The number of times a hosted document can be downloaded. If no limit is specified, the document will be available for an unlimited number of downloads.
312
+ hosted_expires_at:
313
+ type: string
314
+ description: The date and time at which a hosted document will be removed and no longer available. Must be a properly formatted ISO 8601 datetime, like 1981-01-23T08:02:30-05:00.
315
+ prince_options:
316
+ $ref: '#/components/schemas/PrinceOptions'
310
317
 
311
- PrinceOptions:
312
- type: object
313
- properties:
314
- baseurl:
315
- type: string
316
- description: Set the baseurl for assets.
317
- no_xinclude:
318
- type: boolean
319
- description: Disable XML inclusion.
320
- no_network:
321
- type: boolean
322
- description: Disable network access.
323
- no_parallel_downloads:
324
- type: boolean
325
- description: Disables parallel fetching of assets during PDF creation. Useful if your asset host has strict rate limiting.
326
- http_user:
327
- type: string
328
- description: Set the user for HTTP authentication.
329
- http_password:
330
- type: string
331
- description: Set the password for HTTP authentication.
332
- http_proxy:
333
- type: string
334
- description: Set the HTTP proxy server.
335
- http_timeout:
336
- type: integer
337
- description: Set the HTTP request timeout.
338
- # default: 10
339
- insecure:
340
- type: boolean
341
- description: Disable SSL verification.
342
- # default: false
343
- media:
344
- type: string
345
- description: Specify the CSS media type. Defaults to "print" but you may want to use "screen" for web styles.
346
- default: print
347
- no_author_style:
348
- type: boolean
349
- description: Ignore author stylesheets.
350
- no_default_style:
351
- type: boolean
352
- description: Ignore default stylesheets.
353
- no_embed_fonts:
354
- type: boolean
355
- description: Disable font embedding in PDFs.
356
- no_subset_fonts:
357
- type: boolean
358
- description: Disable font subsetting in PDFs.
359
- no_compress:
360
- type: boolean
361
- description: Disable PDF compression.
362
- encrypt:
363
- type: boolean
364
- description: Encrypt PDF output.
365
- key_bits:
366
- type: integer
367
- description: Set encryption key size.
368
- enum:
369
- - 40
370
- - 128
371
- user_password:
372
- type: string
373
- description: Set the PDF user password.
374
- owner_password:
375
- type: string
376
- description: Set the PDF owner password.
377
- disallow_print:
378
- type: boolean
379
- description: Disallow printing of this PDF.
380
- disallow_copy:
381
- type: boolean
382
- description: Disallow copying of this PDF.
383
- disallow_annotate:
384
- type: boolean
385
- description: Disallow annotation of this PDF.
386
- disallow_modify:
387
- type: boolean
388
- description: Disallow modification of this PDF.
389
- debug:
390
- type: boolean
391
- description: Enable Prince debug mode.
392
- input:
393
- type: string
394
- description: Specify the input format.
395
- default: html
396
- enum:
397
- - html
398
- - xml
399
- - auto
400
- version:
401
- type: string
402
- deprecated: true
403
- description: Deprecated, use the appropriate `pipeline` version. Specify a specific verison of PrinceXML to use.
404
- # default: 10
405
- # disabled because Java will try to make an enum as 7_1 which fails
406
- # enum:
407
- # - 7.1
408
- # - 8.1
409
- # - 9.0
410
- # - 10
411
- javascript:
412
- type: boolean
413
- description: Enable PrinceXML JavaScript. DocRaptor JavaScript parsing is also available elsewhere.
414
- css_dpi:
415
- type: integer
416
- description: Set the DPI when rendering CSS. Defaults to 96 but can be set with Prince 9.0 and up.
417
- # default: 96
418
- profile:
419
- type: string
420
- description: In Prince 9.0 and up you can set the PDF profile.
421
- # disabled because Java will try to make an enum with PDF/A-1b which fails
422
- # enum:
423
- # - PDF/A-1b
424
- # - PDF/A-3b # (Pipeline 6+)
425
- # - PDF/X-1a # (Pipeline 6+)
426
- # - PDF/X-3:2003
427
- # - PDF/X-4
428
- pdf_title:
429
- type: string
430
- description: Specify the PDF title, part of the document's metadata.
318
+ PrinceOptions:
319
+ type: object
320
+ properties:
321
+ baseurl:
322
+ type: string
323
+ description: Set the baseurl for assets.
324
+ no_xinclude:
325
+ type: boolean
326
+ description: Disable XML inclusion.
327
+ no_network:
328
+ type: boolean
329
+ description: Disable network access.
330
+ no_parallel_downloads:
331
+ type: boolean
332
+ description: Disables parallel fetching of assets during PDF creation. Useful if your asset host has strict rate limiting.
333
+ http_user:
334
+ type: string
335
+ description: Set the user for HTTP authentication.
336
+ http_password:
337
+ type: string
338
+ description: Set the password for HTTP authentication.
339
+ http_proxy:
340
+ type: string
341
+ description: Set the HTTP proxy server.
342
+ http_timeout:
343
+ type: integer
344
+ description: Set the HTTP request timeout.
345
+ insecure:
346
+ type: boolean
347
+ description: Disable SSL verification.
348
+ media:
349
+ type: string
350
+ description: Specify the CSS media type. Defaults to "print" but you may want to use "screen" for web styles.
351
+ no_author_style:
352
+ type: boolean
353
+ description: Ignore author stylesheets.
354
+ no_default_style:
355
+ type: boolean
356
+ description: Ignore default stylesheets.
357
+ no_embed_fonts:
358
+ type: boolean
359
+ description: Disable font embedding in PDFs.
360
+ no_subset_fonts:
361
+ type: boolean
362
+ description: Disable font subsetting in PDFs.
363
+ no_compress:
364
+ type: boolean
365
+ description: Disable PDF compression.
366
+ encrypt:
367
+ type: boolean
368
+ description: Encrypt PDF output.
369
+ key_bits:
370
+ type: integer
371
+ description: Set encryption key size.
372
+ enum:
373
+ - 40
374
+ - 128
375
+ user_password:
376
+ type: string
377
+ description: Set the PDF user password.
378
+ owner_password:
379
+ type: string
380
+ description: Set the PDF owner password.
381
+ disallow_print:
382
+ type: boolean
383
+ description: Disallow printing of this PDF.
384
+ disallow_copy:
385
+ type: boolean
386
+ description: Disallow copying of this PDF.
387
+ disallow_annotate:
388
+ type: boolean
389
+ description: Disallow annotation of this PDF.
390
+ disallow_modify:
391
+ type: boolean
392
+ description: Disallow modification of this PDF.
393
+ debug:
394
+ type: boolean
395
+ description: Enable Prince debug mode.
396
+ input:
397
+ type: string
398
+ description: Specify the input format, defaults to html.
399
+ enum:
400
+ - html
401
+ - xml
402
+ - auto
403
+ version:
404
+ type: string
405
+ deprecated: true
406
+ description: Deprecated, use the appropriate `pipeline` version. Specify a specific verison of PrinceXML to use.
407
+ javascript:
408
+ type: boolean
409
+ description: Enable PrinceXML JavaScript. DocRaptor JavaScript parsing is also available elsewhere.
410
+ css_dpi:
411
+ type: integer
412
+ description: Set the DPI when rendering CSS. Defaults to 96 but can be set with Prince 9.0 and up.
413
+ profile:
414
+ type: string
415
+ description: In Prince 9.0 and up you can set the PDF profile.
416
+ pdf_title:
417
+ type: string
418
+ description: Specify the PDF title, part of the document's metadata.
419
+ iframes:
420
+ type: boolean
421
+ description: Enable loading of iframes.
422
+ nullable: true
423
+ page_margin:
424
+ type: string
425
+ description: Specify the page margin distance.
426
+ pdf_forms:
427
+ type: boolean
428
+ description: Make form fields editable by default.
431
429
 
432
- AsyncDoc:
433
- type: object
434
- properties:
435
- status_id:
436
- type: string
437
- description: The identifier used to get the status of the document using the status API.
430
+ AsyncDoc:
431
+ type: object
432
+ properties:
433
+ status_id:
434
+ type: string
435
+ description: The identifier used to get the status of the document using the status API.
436
+
437
+ DocStatus:
438
+ type: object
439
+ properties:
440
+ status:
441
+ type: string
442
+ description: The present status of the document. Can be queued, working, completed, and failed.
443
+ download_url:
444
+ type: string
445
+ description: The URL where the document can be retrieved. This URL may only be used a few times.
446
+ download_id:
447
+ type: string
448
+ description: The identifier for downloading the document with the download API.
449
+ message:
450
+ type: string
451
+ description: Additional information.
452
+ number_of_pages:
453
+ type: integer
454
+ description: Number of PDF pages in document.
455
+ validation_errors:
456
+ type: string
457
+ description: Error information.
438
458
 
439
- DocStatus:
440
- type: object
441
- properties:
442
- status:
443
- type: string
444
- description: The present status of the document. Can be queued, working, completed, and failed.
445
- download_url:
446
- type: string
447
- description: The URL where the document can be retrieved. This URL may only be used a few times.
448
- download_id:
449
- type: string
450
- description: The identifier for downloading the document with the download API.
451
- message:
452
- type: string
453
- description: Additional information.
454
- number_of_pages:
455
- type: integer
456
- description: Number of PDF pages in document.
457
- validation_errors:
458
- type: string
459
- description: Error information.