docraptor 2.0.0 → 3.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/.docker_env.list +5 -0
- data/.docker_mounts.list +4 -0
- data/.generator-language-identifier +1 -0
- data/.generator-revision +1 -0
- data/.github/pull_request_template.txt +17 -0
- data/.gitignore +20 -14
- data/.gitlab-ci.yml +26 -0
- data/.openapi-generator/FILES +32 -0
- data/.openapi-generator/VERSION +1 -0
- data/{.swagger-codegen-ignore → .openapi-generator-ignore} +13 -7
- data/.review/README.md +16 -0
- data/.review/generated_files/.gitignore +39 -0
- data/.review/generated_files/README.md +108 -0
- 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/{spec → .review/generated_files/spec}/api_client_spec.rb +6 -21
- data/{spec → .review/generated_files/spec}/configuration_spec.rb +6 -6
- 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/{spec → .review/generated_files/spec}/spec_helper.rb +3 -3
- data/.rubocop.yml +148 -0
- data/.runtime-environments +13 -0
- data/.travis.yml +9 -7
- data/CHANGELOG.md +8 -0
- data/Gemfile +3 -1
- data/README.md +8 -8
- data/Rakefile +1 -2
- data/docraptor.gemspec +5 -19
- data/docraptor.yaml +283 -284
- data/examples/async.rb +24 -30
- data/examples/hosted_async.rb +21 -33
- data/examples/hosted_sync.rb +19 -32
- data/examples/sync.rb +20 -26
- data/gemfiles/Gemfile.2.5.lock +70 -0
- data/gemfiles/Gemfile.2.6.lock +70 -0
- data/gemfiles/Gemfile.2.7.lock +70 -0
- data/gemfiles/Gemfile.3.0.lock +70 -0
- 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/{swagger-config.json → generator-config.json} +3 -2
- data/lib/docraptor/api/doc_api.rb +180 -85
- data/lib/docraptor/api_client.rb +91 -90
- data/lib/docraptor/api_error.rb +23 -3
- data/lib/docraptor/configuration.rb +101 -15
- data/lib/docraptor/models/async_doc.rb +53 -18
- data/lib/docraptor/models/doc.rb +80 -50
- data/lib/docraptor/models/doc_status.rb +58 -23
- data/lib/docraptor/models/prince_options.rb +149 -75
- data/lib/docraptor/version.rb +4 -4
- data/lib/docraptor.rb +3 -3
- data/script/clean +2 -2
- data/script/console +5 -0
- data/script/docker +56 -0
- data/script/fix_gemspec.rb +3 -18
- data/script/generate_language +43 -4
- data/script/inside_container/README.md +6 -0
- data/script/inside_container/test +87 -0
- data/script/post_generate_language +8 -2
- data/script/release +13 -0
- data/script/setup +25 -14
- data/script/swagger +6 -33
- data/script/test +30 -27
- data/test/async.rb +2 -2
- data/test/expire_hosted.rb +2 -2
- data/test/hosted_async.rb +7 -1
- data/test/hosted_sync.rb +2 -2
- 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/sync.rb +2 -2
- data/test/xlsx.rb +10 -3
- metadata +52 -214
- data/.swagger-codegen/VERSION +0 -1
- data/.swagger-revision +0 -1
@@ -3,14 +3,15 @@
|
|
3
3
|
|
4
4
|
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
7
|
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
require 'date'
|
14
|
+
require 'time'
|
14
15
|
|
15
16
|
module DocRaptor
|
16
17
|
class PrinceOptions
|
@@ -86,7 +87,7 @@ module DocRaptor
|
|
86
87
|
# Enable Prince debug mode.
|
87
88
|
attr_accessor :debug
|
88
89
|
|
89
|
-
# Specify the input format.
|
90
|
+
# Specify the input format, defaults to html.
|
90
91
|
attr_accessor :input
|
91
92
|
|
92
93
|
# Deprecated, use the appropriate `pipeline` version. Specify a specific verison of PrinceXML to use.
|
@@ -104,6 +105,15 @@ module DocRaptor
|
|
104
105
|
# Specify the PDF title, part of the document's metadata.
|
105
106
|
attr_accessor :pdf_title
|
106
107
|
|
108
|
+
# Enable loading of iframes.
|
109
|
+
attr_accessor :iframes
|
110
|
+
|
111
|
+
# Specify the page margin distance.
|
112
|
+
attr_accessor :page_margin
|
113
|
+
|
114
|
+
# Make form fields editable by default.
|
115
|
+
attr_accessor :pdf_forms
|
116
|
+
|
107
117
|
class EnumAttributeValidator
|
108
118
|
attr_reader :datatype
|
109
119
|
attr_reader :allowable_values
|
@@ -158,177 +168,210 @@ module DocRaptor
|
|
158
168
|
:'javascript' => :'javascript',
|
159
169
|
:'css_dpi' => :'css_dpi',
|
160
170
|
:'profile' => :'profile',
|
161
|
-
:'pdf_title' => :'pdf_title'
|
171
|
+
:'pdf_title' => :'pdf_title',
|
172
|
+
:'iframes' => :'iframes',
|
173
|
+
:'page_margin' => :'page_margin',
|
174
|
+
:'pdf_forms' => :'pdf_forms'
|
162
175
|
}
|
163
176
|
end
|
164
177
|
|
178
|
+
# Returns all the JSON keys this model knows about
|
179
|
+
def self.acceptable_attributes
|
180
|
+
attribute_map.values
|
181
|
+
end
|
182
|
+
|
165
183
|
# Attribute type mapping.
|
166
|
-
def self.
|
184
|
+
def self.openapi_types
|
167
185
|
{
|
168
186
|
:'baseurl' => :'String',
|
169
|
-
:'no_xinclude' => :'
|
170
|
-
:'no_network' => :'
|
171
|
-
:'no_parallel_downloads' => :'
|
187
|
+
:'no_xinclude' => :'Boolean',
|
188
|
+
:'no_network' => :'Boolean',
|
189
|
+
:'no_parallel_downloads' => :'Boolean',
|
172
190
|
:'http_user' => :'String',
|
173
191
|
:'http_password' => :'String',
|
174
192
|
:'http_proxy' => :'String',
|
175
193
|
:'http_timeout' => :'Integer',
|
176
|
-
:'insecure' => :'
|
194
|
+
:'insecure' => :'Boolean',
|
177
195
|
:'media' => :'String',
|
178
|
-
:'no_author_style' => :'
|
179
|
-
:'no_default_style' => :'
|
180
|
-
:'no_embed_fonts' => :'
|
181
|
-
:'no_subset_fonts' => :'
|
182
|
-
:'no_compress' => :'
|
183
|
-
:'encrypt' => :'
|
196
|
+
:'no_author_style' => :'Boolean',
|
197
|
+
:'no_default_style' => :'Boolean',
|
198
|
+
:'no_embed_fonts' => :'Boolean',
|
199
|
+
:'no_subset_fonts' => :'Boolean',
|
200
|
+
:'no_compress' => :'Boolean',
|
201
|
+
:'encrypt' => :'Boolean',
|
184
202
|
:'key_bits' => :'Integer',
|
185
203
|
:'user_password' => :'String',
|
186
204
|
:'owner_password' => :'String',
|
187
|
-
:'disallow_print' => :'
|
188
|
-
:'disallow_copy' => :'
|
189
|
-
:'disallow_annotate' => :'
|
190
|
-
:'disallow_modify' => :'
|
191
|
-
:'debug' => :'
|
205
|
+
:'disallow_print' => :'Boolean',
|
206
|
+
:'disallow_copy' => :'Boolean',
|
207
|
+
:'disallow_annotate' => :'Boolean',
|
208
|
+
:'disallow_modify' => :'Boolean',
|
209
|
+
:'debug' => :'Boolean',
|
192
210
|
:'input' => :'String',
|
193
211
|
:'version' => :'String',
|
194
|
-
:'javascript' => :'
|
212
|
+
:'javascript' => :'Boolean',
|
195
213
|
:'css_dpi' => :'Integer',
|
196
214
|
:'profile' => :'String',
|
197
|
-
:'pdf_title' => :'String'
|
215
|
+
:'pdf_title' => :'String',
|
216
|
+
:'iframes' => :'Boolean',
|
217
|
+
:'page_margin' => :'String',
|
218
|
+
:'pdf_forms' => :'Boolean'
|
198
219
|
}
|
199
220
|
end
|
200
221
|
|
222
|
+
# List of attributes with nullable: true
|
223
|
+
def self.openapi_nullable
|
224
|
+
Set.new([
|
225
|
+
:'iframes',
|
226
|
+
])
|
227
|
+
end
|
228
|
+
|
201
229
|
# Initializes the object
|
202
230
|
# @param [Hash] attributes Model attributes in the form of hash
|
203
231
|
def initialize(attributes = {})
|
204
|
-
|
232
|
+
if (!attributes.is_a?(Hash))
|
233
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DocRaptor::PrinceOptions` initialize method"
|
234
|
+
end
|
205
235
|
|
206
|
-
# convert string to symbol for hash key
|
207
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
236
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
237
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
238
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
239
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DocRaptor::PrinceOptions`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
240
|
+
end
|
241
|
+
h[k.to_sym] = v
|
242
|
+
}
|
208
243
|
|
209
|
-
if attributes.
|
244
|
+
if attributes.key?(:'baseurl')
|
210
245
|
self.baseurl = attributes[:'baseurl']
|
211
246
|
end
|
212
247
|
|
213
|
-
if attributes.
|
248
|
+
if attributes.key?(:'no_xinclude')
|
214
249
|
self.no_xinclude = attributes[:'no_xinclude']
|
215
250
|
end
|
216
251
|
|
217
|
-
if attributes.
|
252
|
+
if attributes.key?(:'no_network')
|
218
253
|
self.no_network = attributes[:'no_network']
|
219
254
|
end
|
220
255
|
|
221
|
-
if attributes.
|
256
|
+
if attributes.key?(:'no_parallel_downloads')
|
222
257
|
self.no_parallel_downloads = attributes[:'no_parallel_downloads']
|
223
258
|
end
|
224
259
|
|
225
|
-
if attributes.
|
260
|
+
if attributes.key?(:'http_user')
|
226
261
|
self.http_user = attributes[:'http_user']
|
227
262
|
end
|
228
263
|
|
229
|
-
if attributes.
|
264
|
+
if attributes.key?(:'http_password')
|
230
265
|
self.http_password = attributes[:'http_password']
|
231
266
|
end
|
232
267
|
|
233
|
-
if attributes.
|
268
|
+
if attributes.key?(:'http_proxy')
|
234
269
|
self.http_proxy = attributes[:'http_proxy']
|
235
270
|
end
|
236
271
|
|
237
|
-
if attributes.
|
272
|
+
if attributes.key?(:'http_timeout')
|
238
273
|
self.http_timeout = attributes[:'http_timeout']
|
239
274
|
end
|
240
275
|
|
241
|
-
if attributes.
|
276
|
+
if attributes.key?(:'insecure')
|
242
277
|
self.insecure = attributes[:'insecure']
|
243
278
|
end
|
244
279
|
|
245
|
-
if attributes.
|
280
|
+
if attributes.key?(:'media')
|
246
281
|
self.media = attributes[:'media']
|
247
|
-
else
|
248
|
-
self.media = 'print'
|
249
282
|
end
|
250
283
|
|
251
|
-
if attributes.
|
284
|
+
if attributes.key?(:'no_author_style')
|
252
285
|
self.no_author_style = attributes[:'no_author_style']
|
253
286
|
end
|
254
287
|
|
255
|
-
if attributes.
|
288
|
+
if attributes.key?(:'no_default_style')
|
256
289
|
self.no_default_style = attributes[:'no_default_style']
|
257
290
|
end
|
258
291
|
|
259
|
-
if attributes.
|
292
|
+
if attributes.key?(:'no_embed_fonts')
|
260
293
|
self.no_embed_fonts = attributes[:'no_embed_fonts']
|
261
294
|
end
|
262
295
|
|
263
|
-
if attributes.
|
296
|
+
if attributes.key?(:'no_subset_fonts')
|
264
297
|
self.no_subset_fonts = attributes[:'no_subset_fonts']
|
265
298
|
end
|
266
299
|
|
267
|
-
if attributes.
|
300
|
+
if attributes.key?(:'no_compress')
|
268
301
|
self.no_compress = attributes[:'no_compress']
|
269
302
|
end
|
270
303
|
|
271
|
-
if attributes.
|
304
|
+
if attributes.key?(:'encrypt')
|
272
305
|
self.encrypt = attributes[:'encrypt']
|
273
306
|
end
|
274
307
|
|
275
|
-
if attributes.
|
308
|
+
if attributes.key?(:'key_bits')
|
276
309
|
self.key_bits = attributes[:'key_bits']
|
277
310
|
end
|
278
311
|
|
279
|
-
if attributes.
|
312
|
+
if attributes.key?(:'user_password')
|
280
313
|
self.user_password = attributes[:'user_password']
|
281
314
|
end
|
282
315
|
|
283
|
-
if attributes.
|
316
|
+
if attributes.key?(:'owner_password')
|
284
317
|
self.owner_password = attributes[:'owner_password']
|
285
318
|
end
|
286
319
|
|
287
|
-
if attributes.
|
320
|
+
if attributes.key?(:'disallow_print')
|
288
321
|
self.disallow_print = attributes[:'disallow_print']
|
289
322
|
end
|
290
323
|
|
291
|
-
if attributes.
|
324
|
+
if attributes.key?(:'disallow_copy')
|
292
325
|
self.disallow_copy = attributes[:'disallow_copy']
|
293
326
|
end
|
294
327
|
|
295
|
-
if attributes.
|
328
|
+
if attributes.key?(:'disallow_annotate')
|
296
329
|
self.disallow_annotate = attributes[:'disallow_annotate']
|
297
330
|
end
|
298
331
|
|
299
|
-
if attributes.
|
332
|
+
if attributes.key?(:'disallow_modify')
|
300
333
|
self.disallow_modify = attributes[:'disallow_modify']
|
301
334
|
end
|
302
335
|
|
303
|
-
if attributes.
|
336
|
+
if attributes.key?(:'debug')
|
304
337
|
self.debug = attributes[:'debug']
|
305
338
|
end
|
306
339
|
|
307
|
-
if attributes.
|
340
|
+
if attributes.key?(:'input')
|
308
341
|
self.input = attributes[:'input']
|
309
|
-
else
|
310
|
-
self.input = 'html'
|
311
342
|
end
|
312
343
|
|
313
|
-
if attributes.
|
344
|
+
if attributes.key?(:'version')
|
314
345
|
self.version = attributes[:'version']
|
315
346
|
end
|
316
347
|
|
317
|
-
if attributes.
|
348
|
+
if attributes.key?(:'javascript')
|
318
349
|
self.javascript = attributes[:'javascript']
|
319
350
|
end
|
320
351
|
|
321
|
-
if attributes.
|
352
|
+
if attributes.key?(:'css_dpi')
|
322
353
|
self.css_dpi = attributes[:'css_dpi']
|
323
354
|
end
|
324
355
|
|
325
|
-
if attributes.
|
356
|
+
if attributes.key?(:'profile')
|
326
357
|
self.profile = attributes[:'profile']
|
327
358
|
end
|
328
359
|
|
329
|
-
if attributes.
|
360
|
+
if attributes.key?(:'pdf_title')
|
330
361
|
self.pdf_title = attributes[:'pdf_title']
|
331
362
|
end
|
363
|
+
|
364
|
+
if attributes.key?(:'iframes')
|
365
|
+
self.iframes = attributes[:'iframes']
|
366
|
+
end
|
367
|
+
|
368
|
+
if attributes.key?(:'page_margin')
|
369
|
+
self.page_margin = attributes[:'page_margin']
|
370
|
+
end
|
371
|
+
|
372
|
+
if attributes.key?(:'pdf_forms')
|
373
|
+
self.pdf_forms = attributes[:'pdf_forms']
|
374
|
+
end
|
332
375
|
end
|
333
376
|
|
334
377
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -341,17 +384,29 @@ module DocRaptor
|
|
341
384
|
# Check to see if the all the properties in the model are valid
|
342
385
|
# @return true if the model is valid
|
343
386
|
def valid?
|
344
|
-
|
387
|
+
key_bits_validator = EnumAttributeValidator.new('Integer', [40, 128])
|
388
|
+
return false unless key_bits_validator.valid?(@key_bits)
|
389
|
+
input_validator = EnumAttributeValidator.new('String', ["html", "xml", "auto"])
|
345
390
|
return false unless input_validator.valid?(@input)
|
346
391
|
true
|
347
392
|
end
|
348
393
|
|
394
|
+
# Custom attribute writer method checking allowed values (enum).
|
395
|
+
# @param [Object] key_bits Object to be assigned
|
396
|
+
def key_bits=(key_bits)
|
397
|
+
validator = EnumAttributeValidator.new('Integer', [40, 128])
|
398
|
+
unless validator.valid?(key_bits)
|
399
|
+
fail ArgumentError, "invalid value for \"key_bits\", must be one of #{validator.allowable_values}."
|
400
|
+
end
|
401
|
+
@key_bits = key_bits
|
402
|
+
end
|
403
|
+
|
349
404
|
# Custom attribute writer method checking allowed values (enum).
|
350
405
|
# @param [Object] input Object to be assigned
|
351
406
|
def input=(input)
|
352
|
-
validator = EnumAttributeValidator.new('String', [
|
407
|
+
validator = EnumAttributeValidator.new('String', ["html", "xml", "auto"])
|
353
408
|
unless validator.valid?(input)
|
354
|
-
fail ArgumentError,
|
409
|
+
fail ArgumentError, "invalid value for \"input\", must be one of #{validator.allowable_values}."
|
355
410
|
end
|
356
411
|
@input = input
|
357
412
|
end
|
@@ -390,7 +445,10 @@ module DocRaptor
|
|
390
445
|
javascript == o.javascript &&
|
391
446
|
css_dpi == o.css_dpi &&
|
392
447
|
profile == o.profile &&
|
393
|
-
pdf_title == o.pdf_title
|
448
|
+
pdf_title == o.pdf_title &&
|
449
|
+
iframes == o.iframes &&
|
450
|
+
page_margin == o.page_margin &&
|
451
|
+
pdf_forms == o.pdf_forms
|
394
452
|
end
|
395
453
|
|
396
454
|
# @see the `==` method
|
@@ -400,9 +458,16 @@ module DocRaptor
|
|
400
458
|
end
|
401
459
|
|
402
460
|
# Calculates hash code according to all attributes.
|
403
|
-
# @return [
|
461
|
+
# @return [Integer] Hash code
|
404
462
|
def hash
|
405
|
-
[baseurl, no_xinclude, no_network, no_parallel_downloads, http_user, http_password, http_proxy, http_timeout, insecure, media, no_author_style, no_default_style, no_embed_fonts, no_subset_fonts, no_compress, encrypt, key_bits, user_password, owner_password, disallow_print, disallow_copy, disallow_annotate, disallow_modify, debug, input, version, javascript, css_dpi, profile, pdf_title].hash
|
463
|
+
[baseurl, no_xinclude, no_network, no_parallel_downloads, http_user, http_password, http_proxy, http_timeout, insecure, media, no_author_style, no_default_style, no_embed_fonts, no_subset_fonts, no_compress, encrypt, key_bits, user_password, owner_password, disallow_print, disallow_copy, disallow_annotate, disallow_modify, debug, input, version, javascript, css_dpi, profile, pdf_title, iframes, page_margin, pdf_forms].hash
|
464
|
+
end
|
465
|
+
|
466
|
+
# Builds the object from hash
|
467
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
468
|
+
# @return [Object] Returns the model itself
|
469
|
+
def self.build_from_hash(attributes)
|
470
|
+
new.build_from_hash(attributes)
|
406
471
|
end
|
407
472
|
|
408
473
|
# Builds the object from hash
|
@@ -410,8 +475,11 @@ module DocRaptor
|
|
410
475
|
# @return [Object] Returns the model itself
|
411
476
|
def build_from_hash(attributes)
|
412
477
|
return nil unless attributes.is_a?(Hash)
|
413
|
-
|
414
|
-
|
478
|
+
attributes = attributes.transform_keys(&:to_sym)
|
479
|
+
self.class.openapi_types.each_pair do |key, type|
|
480
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
481
|
+
self.send("#{key}=", nil)
|
482
|
+
elsif type =~ /\AArray<(.*)>/i
|
415
483
|
# check to ensure the input is an array given that the attribute
|
416
484
|
# is documented as an array but the input is not
|
417
485
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -419,7 +487,7 @@ module DocRaptor
|
|
419
487
|
end
|
420
488
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
421
489
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
422
|
-
end
|
490
|
+
end
|
423
491
|
end
|
424
492
|
|
425
493
|
self
|
@@ -431,8 +499,8 @@ module DocRaptor
|
|
431
499
|
# @return [Object] Deserialized data
|
432
500
|
def _deserialize(type, value)
|
433
501
|
case type.to_sym
|
434
|
-
when :
|
435
|
-
|
502
|
+
when :Time
|
503
|
+
Time.parse(value)
|
436
504
|
when :Date
|
437
505
|
Date.parse(value)
|
438
506
|
when :String
|
@@ -441,7 +509,7 @@ module DocRaptor
|
|
441
509
|
value.to_i
|
442
510
|
when :Float
|
443
511
|
value.to_f
|
444
|
-
when :
|
512
|
+
when :Boolean
|
445
513
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
446
514
|
true
|
447
515
|
else
|
@@ -462,8 +530,9 @@ module DocRaptor
|
|
462
530
|
end
|
463
531
|
end
|
464
532
|
else # model
|
465
|
-
|
466
|
-
|
533
|
+
# models (e.g. Pet) or oneOf
|
534
|
+
klass = DocRaptor.const_get(type)
|
535
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
467
536
|
end
|
468
537
|
end
|
469
538
|
|
@@ -485,7 +554,11 @@ module DocRaptor
|
|
485
554
|
hash = {}
|
486
555
|
self.class.attribute_map.each_pair do |attr, param|
|
487
556
|
value = self.send(attr)
|
488
|
-
|
557
|
+
if value.nil?
|
558
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
559
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
560
|
+
end
|
561
|
+
|
489
562
|
hash[param] = _to_hash(value)
|
490
563
|
end
|
491
564
|
hash
|
@@ -510,4 +583,5 @@ module DocRaptor
|
|
510
583
|
end
|
511
584
|
|
512
585
|
end
|
586
|
+
|
513
587
|
end
|
data/lib/docraptor/version.rb
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
|
4
4
|
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
7
|
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
13
|
module DocRaptor
|
14
|
-
VERSION = '
|
14
|
+
VERSION = '3.1.0'
|
15
15
|
end
|
data/lib/docraptor.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
|
4
4
|
#A native client library for the DocRaptor HTML to PDF/XLS service.
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
7
7
|
|
8
|
-
Generated by: https://
|
9
|
-
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 6.6.0
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
data/script/clean
CHANGED
data/script/console
ADDED
data/script/docker
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
set -e
|
3
|
+
[[ "$TRACE" == "true" ]] && set -x
|
4
|
+
cd "$(dirname "$0")/.."
|
5
|
+
|
6
|
+
OPTIND=1
|
7
|
+
|
8
|
+
image=""
|
9
|
+
|
10
|
+
while getopts "h?i:" opt; do
|
11
|
+
case "$opt" in
|
12
|
+
h|\?)
|
13
|
+
show_help
|
14
|
+
exit 0
|
15
|
+
;;
|
16
|
+
i) image="$OPTARG"
|
17
|
+
;;
|
18
|
+
esac
|
19
|
+
done
|
20
|
+
|
21
|
+
shift $((OPTIND-1))
|
22
|
+
|
23
|
+
if [[ "$image" == "" ]]; then
|
24
|
+
image="$(cat .runtime-environments | grep -v '^#' | tail -n 1)"
|
25
|
+
echo "docker image (-i) unset, defaulting to: $image"
|
26
|
+
fi
|
27
|
+
|
28
|
+
if ! docker pull "$image"; then
|
29
|
+
echo "Pulling the latest version of ${image} failed, but we'll continue in"
|
30
|
+
echo "the hopes that there's a previous version of the container available."
|
31
|
+
echo "This probably isn't an issue unless you really want to verify"
|
32
|
+
echo "everything works with a :latest container image."
|
33
|
+
fi
|
34
|
+
|
35
|
+
command="$1"
|
36
|
+
|
37
|
+
mounts=()
|
38
|
+
while IFS=':' read -r source target; do
|
39
|
+
# Create the directory if it's not a special/magic path (like for ssh)
|
40
|
+
mkdir -p -m 700 "$source" &> /dev/null || true
|
41
|
+
|
42
|
+
mounts+=(--volume)
|
43
|
+
mounts+=("${source}:${target}")
|
44
|
+
|
45
|
+
# Can't pipe to the while loop because that causes a subshell, which means
|
46
|
+
# the variables set in the loop aren't available outside of it.
|
47
|
+
done < <(eval echo "\"$(grep -v '^#' .docker_mounts.list)\"")
|
48
|
+
|
49
|
+
set -x
|
50
|
+
docker run -it --rm \
|
51
|
+
--env-file .docker_env.list \
|
52
|
+
--env RUNTIME_ENV="${image}" \
|
53
|
+
--mount type=bind,source="$(pwd)",target=/app \
|
54
|
+
"${mounts[@]}" \
|
55
|
+
"$image" \
|
56
|
+
"$command"
|
data/script/fix_gemspec.rb
CHANGED
@@ -1,28 +1,16 @@
|
|
1
|
-
#
|
1
|
+
# These, at least the first two, significantly increase speed of a test run by
|
2
|
+
# limiting the filesystem interaction that occurs with bundler installing and
|
3
|
+
# requiring files.
|
2
4
|
bad_files = %q{s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }}
|
3
5
|
good_files = %q{s.files = `git ls-files`.split("\n").uniq.sort.select { |f| !f.empty? }}
|
4
6
|
bad_test_files = %q{s.test_files = `find spec/*`.split("\n")}
|
5
7
|
good_test_files = %q{s.test_files = `git ls-files spec test`.split("\n")}
|
6
|
-
bad_ruby_version = %q{s.required_ruby_version = ">= 1.9"}
|
7
|
-
good_ruby_version = %q{s.required_ruby_version = ">= 2.3"}
|
8
|
-
|
9
|
-
development_dependency_marker = %q{ s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'}
|
10
|
-
development_dependency_marker_plus_injection =
|
11
|
-
" s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
|
12
|
-
|
13
|
-
# added by script/fix_gemspec.rb.
|
14
|
-
s.add_development_dependency 'rake', '~>11.2', '>= 11.2.2'
|
15
|
-
s.add_development_dependency 'pry', '~>0.10', '>= 0.10.4'
|
16
|
-
# </added> : if the above lines are missing in the gemspec, then
|
17
|
-
# the matcher for autotest is probably broken"
|
18
8
|
|
19
9
|
filename = "docraptor.gemspec"
|
20
10
|
content = File.read(filename)
|
21
11
|
[
|
22
12
|
bad_files,
|
23
13
|
bad_test_files,
|
24
|
-
bad_ruby_version,
|
25
|
-
development_dependency_marker
|
26
14
|
].each do |bad_content_to_check|
|
27
15
|
unless content.include?(bad_content_to_check)
|
28
16
|
raise "Couldn't find content in docraptor.gemspec. Check matchers in there for: “#{bad_content_to_check}”"
|
@@ -31,9 +19,6 @@ end
|
|
31
19
|
updated_content = content.dup
|
32
20
|
updated_content.sub!(bad_files, good_files)
|
33
21
|
updated_content.sub!(bad_test_files, good_test_files)
|
34
|
-
updated_content.sub!(bad_ruby_version, good_ruby_version)
|
35
|
-
updated_content.sub!(development_dependency_marker,
|
36
|
-
development_dependency_marker_plus_injection)
|
37
22
|
|
38
23
|
File.open(filename, "w") do |file|
|
39
24
|
file.write(updated_content)
|
data/script/generate_language
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
#!/bin/
|
1
|
+
#!/bin/bash
|
2
2
|
set -e
|
3
|
+
[[ "$TRACE" == "true" ]] && set -x
|
3
4
|
cd "$(dirname "$0")/.."
|
4
5
|
|
5
|
-
LANGUAGE="$
|
6
|
-
CONFIG_FILE="
|
6
|
+
LANGUAGE="$(cat .generator-language-identifier)"
|
7
|
+
CONFIG_FILE="generator-config.json"
|
7
8
|
|
8
9
|
if [ "$LANGUAGE" = "" ]; then
|
9
10
|
./script/swagger # prints languages
|
@@ -18,12 +19,50 @@ fi
|
|
18
19
|
|
19
20
|
./script/clean
|
20
21
|
|
22
|
+
# See .review/README.md
|
23
|
+
echo "Facilitating generated content review"
|
24
|
+
tmp_dir=".review/tmp"
|
25
|
+
review_root=".review/generated_files"
|
26
|
+
# Clear the tmp_dir, where we'll temporarily store our files so they aren't
|
27
|
+
# overwritten by the generated files.
|
28
|
+
rm -rf "$tmp_dir"
|
29
|
+
(cd "$review_root" && find . -type f) | while read file_path; do
|
30
|
+
# Move our file out of the way so it doesn't get overwritten by the generated
|
31
|
+
# file, but only if the file exists. Some files, like the generated docs and
|
32
|
+
# tests, aren't useful to users to we generally remove them, but we still
|
33
|
+
# want to facilitate review of these generated files.
|
34
|
+
if [ -e "$file_path" ]; then
|
35
|
+
mkdir -p "$(dirname "${tmp_dir}/$file_path")"
|
36
|
+
mv -v "$file_path" "${tmp_dir}/$file_path"
|
37
|
+
fi
|
38
|
+
done
|
39
|
+
|
21
40
|
./script/swagger generate \
|
22
41
|
-i docraptor.yaml \
|
23
|
-
-
|
42
|
+
-g "$LANGUAGE" \
|
24
43
|
-c "$CONFIG_FILE"
|
25
44
|
|
26
45
|
# call a generator cleanup script
|
27
46
|
if [ -f "script/post_generate_language" ]; then
|
28
47
|
./script/post_generate_language
|
29
48
|
fi
|
49
|
+
|
50
|
+
# See .review/README.md
|
51
|
+
echo "Facilitating generated content review"
|
52
|
+
(cd "$review_root" && find . -type f) | while read file_path; do
|
53
|
+
# Update $review_root to match the generated files.
|
54
|
+
if [ -e "$file_path" ]; then
|
55
|
+
# Move the newly generated file into the review directory so we'll be able to
|
56
|
+
# see it in the diff.
|
57
|
+
mv -v "$file_path" "$review_root/$file_path"
|
58
|
+
else
|
59
|
+
# If the file doesn't exist, then it was removed by the generator, so we
|
60
|
+
# should remove it from the review directory as well.
|
61
|
+
rm -v "$review_root/$file_path"
|
62
|
+
fi
|
63
|
+
# If we temporarily stored a file (meaning it existed before the generation)
|
64
|
+
# then move it back into place.
|
65
|
+
if [ -e "${tmp_dir}/$file_path" ]; then
|
66
|
+
mv -v "${tmp_dir}/$file_path" "$file_path"
|
67
|
+
fi
|
68
|
+
done
|
@@ -0,0 +1,6 @@
|
|
1
|
+
This folder contains scripts that are only intended to be run inside
|
2
|
+
of a relevant docker container. For example, `script/test` may run
|
3
|
+
`script/inside_container/test` inside a container with particular
|
4
|
+
versions of libraries to make it easy to test the agent in multiple
|
5
|
+
settings. It's possible these scripts will work outside of any
|
6
|
+
particular container, but that may or may not mean anything.
|