docraptor 1.1.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,15 @@
1
+ =begin
2
+ #DocRaptor
3
+
4
+ #A native client library for the DocRaptor HTML to PDF/XLS service.
5
+
6
+ OpenAPI spec version: 1.4.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
1
13
  require 'date'
2
14
 
3
15
  module DocRaptor
@@ -77,7 +89,7 @@ module DocRaptor
77
89
  # Specify the input format.
78
90
  attr_accessor :input
79
91
 
80
- # Specify a specific verison of PrinceXML to use.
92
+ # Deprecated, use the appropriate `pipeline` version. Specify a specific verison of PrinceXML to use.
81
93
  attr_accessor :version
82
94
 
83
95
  # Enable PrinceXML JavaScript. DocRaptor JavaScript parsing is also available elsewhere.
@@ -89,68 +101,64 @@ module DocRaptor
89
101
  # In Prince 9.0 and up you can set the PDF profile.
90
102
  attr_accessor :profile
91
103
 
104
+ # Specify the PDF title, part of the document's metadata.
105
+ attr_accessor :pdf_title
106
+
107
+ class EnumAttributeValidator
108
+ attr_reader :datatype
109
+ attr_reader :allowable_values
110
+
111
+ def initialize(datatype, allowable_values)
112
+ @allowable_values = allowable_values.map do |value|
113
+ case datatype.to_s
114
+ when /Integer/i
115
+ value.to_i
116
+ when /Float/i
117
+ value.to_f
118
+ else
119
+ value
120
+ end
121
+ end
122
+ end
123
+
124
+ def valid?(value)
125
+ !value || allowable_values.include?(value)
126
+ end
127
+ end
128
+
92
129
  # Attribute mapping from ruby-style variable name to JSON key.
93
130
  def self.attribute_map
94
131
  {
95
-
96
132
  :'baseurl' => :'baseurl',
97
-
98
133
  :'no_xinclude' => :'no_xinclude',
99
-
100
134
  :'no_network' => :'no_network',
101
-
102
135
  :'no_parallel_downloads' => :'no_parallel_downloads',
103
-
104
136
  :'http_user' => :'http_user',
105
-
106
137
  :'http_password' => :'http_password',
107
-
108
138
  :'http_proxy' => :'http_proxy',
109
-
110
139
  :'http_timeout' => :'http_timeout',
111
-
112
140
  :'insecure' => :'insecure',
113
-
114
141
  :'media' => :'media',
115
-
116
142
  :'no_author_style' => :'no_author_style',
117
-
118
143
  :'no_default_style' => :'no_default_style',
119
-
120
144
  :'no_embed_fonts' => :'no_embed_fonts',
121
-
122
145
  :'no_subset_fonts' => :'no_subset_fonts',
123
-
124
146
  :'no_compress' => :'no_compress',
125
-
126
147
  :'encrypt' => :'encrypt',
127
-
128
148
  :'key_bits' => :'key_bits',
129
-
130
149
  :'user_password' => :'user_password',
131
-
132
150
  :'owner_password' => :'owner_password',
133
-
134
151
  :'disallow_print' => :'disallow_print',
135
-
136
152
  :'disallow_copy' => :'disallow_copy',
137
-
138
153
  :'disallow_annotate' => :'disallow_annotate',
139
-
140
154
  :'disallow_modify' => :'disallow_modify',
141
-
142
155
  :'debug' => :'debug',
143
-
144
156
  :'input' => :'input',
145
-
146
157
  :'version' => :'version',
147
-
148
158
  :'javascript' => :'javascript',
149
-
150
159
  :'css_dpi' => :'css_dpi',
151
-
152
- :'profile' => :'profile'
153
-
160
+ :'profile' => :'profile',
161
+ :'pdf_title' => :'pdf_title'
154
162
  }
155
163
  end
156
164
 
@@ -185,150 +193,171 @@ module DocRaptor
185
193
  :'version' => :'String',
186
194
  :'javascript' => :'BOOLEAN',
187
195
  :'css_dpi' => :'Integer',
188
- :'profile' => :'String'
189
-
196
+ :'profile' => :'String',
197
+ :'pdf_title' => :'String'
190
198
  }
191
199
  end
192
200
 
201
+ # Initializes the object
202
+ # @param [Hash] attributes Model attributes in the form of hash
193
203
  def initialize(attributes = {})
194
204
  return unless attributes.is_a?(Hash)
195
205
 
196
206
  # convert string to symbol for hash key
197
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
207
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
198
208
 
199
-
200
- if attributes[:'baseurl']
209
+ if attributes.has_key?(:'baseurl')
201
210
  self.baseurl = attributes[:'baseurl']
202
211
  end
203
212
 
204
- if attributes[:'no_xinclude']
213
+ if attributes.has_key?(:'no_xinclude')
205
214
  self.no_xinclude = attributes[:'no_xinclude']
206
215
  end
207
216
 
208
- if attributes[:'no_network']
217
+ if attributes.has_key?(:'no_network')
209
218
  self.no_network = attributes[:'no_network']
210
219
  end
211
220
 
212
- if attributes[:'no_parallel_downloads']
221
+ if attributes.has_key?(:'no_parallel_downloads')
213
222
  self.no_parallel_downloads = attributes[:'no_parallel_downloads']
214
223
  end
215
224
 
216
- if attributes[:'http_user']
225
+ if attributes.has_key?(:'http_user')
217
226
  self.http_user = attributes[:'http_user']
218
227
  end
219
228
 
220
- if attributes[:'http_password']
229
+ if attributes.has_key?(:'http_password')
221
230
  self.http_password = attributes[:'http_password']
222
231
  end
223
232
 
224
- if attributes[:'http_proxy']
233
+ if attributes.has_key?(:'http_proxy')
225
234
  self.http_proxy = attributes[:'http_proxy']
226
235
  end
227
236
 
228
- if attributes[:'http_timeout']
237
+ if attributes.has_key?(:'http_timeout')
229
238
  self.http_timeout = attributes[:'http_timeout']
230
239
  end
231
240
 
232
- if attributes[:'insecure']
241
+ if attributes.has_key?(:'insecure')
233
242
  self.insecure = attributes[:'insecure']
234
243
  end
235
244
 
236
- if attributes[:'media']
245
+ if attributes.has_key?(:'media')
237
246
  self.media = attributes[:'media']
238
247
  else
239
- self.media = "print"
248
+ self.media = 'print'
240
249
  end
241
250
 
242
- if attributes[:'no_author_style']
251
+ if attributes.has_key?(:'no_author_style')
243
252
  self.no_author_style = attributes[:'no_author_style']
244
253
  end
245
254
 
246
- if attributes[:'no_default_style']
255
+ if attributes.has_key?(:'no_default_style')
247
256
  self.no_default_style = attributes[:'no_default_style']
248
257
  end
249
258
 
250
- if attributes[:'no_embed_fonts']
259
+ if attributes.has_key?(:'no_embed_fonts')
251
260
  self.no_embed_fonts = attributes[:'no_embed_fonts']
252
261
  end
253
262
 
254
- if attributes[:'no_subset_fonts']
263
+ if attributes.has_key?(:'no_subset_fonts')
255
264
  self.no_subset_fonts = attributes[:'no_subset_fonts']
256
265
  end
257
266
 
258
- if attributes[:'no_compress']
267
+ if attributes.has_key?(:'no_compress')
259
268
  self.no_compress = attributes[:'no_compress']
260
269
  end
261
270
 
262
- if attributes[:'encrypt']
271
+ if attributes.has_key?(:'encrypt')
263
272
  self.encrypt = attributes[:'encrypt']
264
273
  end
265
274
 
266
- if attributes[:'key_bits']
275
+ if attributes.has_key?(:'key_bits')
267
276
  self.key_bits = attributes[:'key_bits']
268
277
  end
269
278
 
270
- if attributes[:'user_password']
279
+ if attributes.has_key?(:'user_password')
271
280
  self.user_password = attributes[:'user_password']
272
281
  end
273
282
 
274
- if attributes[:'owner_password']
283
+ if attributes.has_key?(:'owner_password')
275
284
  self.owner_password = attributes[:'owner_password']
276
285
  end
277
286
 
278
- if attributes[:'disallow_print']
287
+ if attributes.has_key?(:'disallow_print')
279
288
  self.disallow_print = attributes[:'disallow_print']
280
289
  end
281
290
 
282
- if attributes[:'disallow_copy']
291
+ if attributes.has_key?(:'disallow_copy')
283
292
  self.disallow_copy = attributes[:'disallow_copy']
284
293
  end
285
294
 
286
- if attributes[:'disallow_annotate']
295
+ if attributes.has_key?(:'disallow_annotate')
287
296
  self.disallow_annotate = attributes[:'disallow_annotate']
288
297
  end
289
298
 
290
- if attributes[:'disallow_modify']
299
+ if attributes.has_key?(:'disallow_modify')
291
300
  self.disallow_modify = attributes[:'disallow_modify']
292
301
  end
293
302
 
294
- if attributes[:'debug']
303
+ if attributes.has_key?(:'debug')
295
304
  self.debug = attributes[:'debug']
296
305
  end
297
306
 
298
- if attributes[:'input']
307
+ if attributes.has_key?(:'input')
299
308
  self.input = attributes[:'input']
300
309
  else
301
- self.input = "html"
310
+ self.input = 'html'
302
311
  end
303
312
 
304
- if attributes[:'version']
313
+ if attributes.has_key?(:'version')
305
314
  self.version = attributes[:'version']
306
315
  end
307
316
 
308
- if attributes[:'javascript']
317
+ if attributes.has_key?(:'javascript')
309
318
  self.javascript = attributes[:'javascript']
310
319
  end
311
320
 
312
- if attributes[:'css_dpi']
321
+ if attributes.has_key?(:'css_dpi')
313
322
  self.css_dpi = attributes[:'css_dpi']
314
323
  end
315
324
 
316
- if attributes[:'profile']
325
+ if attributes.has_key?(:'profile')
317
326
  self.profile = attributes[:'profile']
318
327
  end
319
328
 
329
+ if attributes.has_key?(:'pdf_title')
330
+ self.pdf_title = attributes[:'pdf_title']
331
+ end
332
+ end
333
+
334
+ # Show invalid properties with the reasons. Usually used together with valid?
335
+ # @return Array for valid properties with the reasons
336
+ def list_invalid_properties
337
+ invalid_properties = Array.new
338
+ invalid_properties
339
+ end
340
+
341
+ # Check to see if the all the properties in the model are valid
342
+ # @return true if the model is valid
343
+ def valid?
344
+ input_validator = EnumAttributeValidator.new('String', ['html', 'xml', 'auto'])
345
+ return false unless input_validator.valid?(@input)
346
+ true
320
347
  end
321
348
 
322
349
  # Custom attribute writer method checking allowed values (enum).
350
+ # @param [Object] input Object to be assigned
323
351
  def input=(input)
324
- allowed_values = ["html", "xml", "auto"]
325
- if input && !allowed_values.include?(input)
326
- fail "invalid value for 'input', must be one of #{allowed_values}"
352
+ validator = EnumAttributeValidator.new('String', ['html', 'xml', 'auto'])
353
+ unless validator.valid?(input)
354
+ fail ArgumentError, 'invalid value for "input", must be one of #{validator.allowable_values}.'
327
355
  end
328
356
  @input = input
329
357
  end
330
358
 
331
- # Check equality by comparing each attribute.
359
+ # Checks equality by comparing each attribute.
360
+ # @param [Object] Object to be compared
332
361
  def ==(o)
333
362
  return true if self.equal?(o)
334
363
  self.class == o.class &&
@@ -360,39 +389,46 @@ module DocRaptor
360
389
  version == o.version &&
361
390
  javascript == o.javascript &&
362
391
  css_dpi == o.css_dpi &&
363
- profile == o.profile
392
+ profile == o.profile &&
393
+ pdf_title == o.pdf_title
364
394
  end
365
395
 
366
396
  # @see the `==` method
397
+ # @param [Object] Object to be compared
367
398
  def eql?(o)
368
399
  self == o
369
400
  end
370
401
 
371
- # Calculate hash code according to all attributes.
402
+ # Calculates hash code according to all attributes.
403
+ # @return [Fixnum] Hash code
372
404
  def hash
373
- [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].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
374
406
  end
375
407
 
376
- # build the object from hash
408
+ # Builds the object from hash
409
+ # @param [Hash] attributes Model attributes in the form of hash
410
+ # @return [Object] Returns the model itself
377
411
  def build_from_hash(attributes)
378
412
  return nil unless attributes.is_a?(Hash)
379
413
  self.class.swagger_types.each_pair do |key, type|
380
- if type =~ /^Array<(.*)>/i
414
+ if type =~ /\AArray<(.*)>/i
415
+ # check to ensure the input is an array given that the attribute
416
+ # is documented as an array but the input is not
381
417
  if attributes[self.class.attribute_map[key]].is_a?(Array)
382
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
383
- else
384
- #TODO show warning in debug mode
418
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
385
419
  end
386
420
  elsif !attributes[self.class.attribute_map[key]].nil?
387
421
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
388
- else
389
- # data not found in attributes(hash), not an issue as the data can be optional
390
- end
422
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
391
423
  end
392
424
 
393
425
  self
394
426
  end
395
427
 
428
+ # Deserializes the data based on type
429
+ # @param string type Data type
430
+ # @param string value Value to be deserialized
431
+ # @return [Object] Deserialized data
396
432
  def _deserialize(type, value)
397
433
  case type.to_sym
398
434
  when :DateTime
@@ -406,7 +442,7 @@ module DocRaptor
406
442
  when :Float
407
443
  value.to_f
408
444
  when :BOOLEAN
409
- if value.to_s =~ /^(true|t|yes|y|1)$/i
445
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
410
446
  true
411
447
  else
412
448
  false
@@ -417,7 +453,7 @@ module DocRaptor
417
453
  when /\AArray<(?<inner_type>.+)>\z/
418
454
  inner_type = Regexp.last_match[:inner_type]
419
455
  value.map { |v| _deserialize(inner_type, v) }
420
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
456
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
421
457
  k_type = Regexp.last_match[:k_type]
422
458
  v_type = Regexp.last_match[:v_type]
423
459
  {}.tap do |hash|
@@ -426,21 +462,25 @@ module DocRaptor
426
462
  end
427
463
  end
428
464
  else # model
429
- _model = DocRaptor.const_get(type).new
430
- _model.build_from_hash(value)
465
+ temp_model = DocRaptor.const_get(type).new
466
+ temp_model.build_from_hash(value)
431
467
  end
432
468
  end
433
469
 
470
+ # Returns the string representation of the object
471
+ # @return [String] String presentation of the object
434
472
  def to_s
435
473
  to_hash.to_s
436
474
  end
437
475
 
438
- # to_body is an alias to to_body (backward compatibility))
476
+ # to_body is an alias to to_hash (backward compatibility)
477
+ # @return [Hash] Returns the object in the form of hash
439
478
  def to_body
440
479
  to_hash
441
480
  end
442
481
 
443
- # return the object in the form of hash
482
+ # Returns the object in the form of hash
483
+ # @return [Hash] Returns the object in the form of hash
444
484
  def to_hash
445
485
  hash = {}
446
486
  self.class.attribute_map.each_pair do |attr, param|
@@ -451,11 +491,13 @@ module DocRaptor
451
491
  hash
452
492
  end
453
493
 
454
- # Method to output non-array value in the form of hash
494
+ # Outputs non-array value in the form of hash
455
495
  # For object, use to_hash. Otherwise, just return the value
496
+ # @param [Object] value Any valid value
497
+ # @return [Hash] Returns the value in the form of hash
456
498
  def _to_hash(value)
457
499
  if value.is_a?(Array)
458
- value.compact.map{ |v| _to_hash(v) }
500
+ value.compact.map { |v| _to_hash(v) }
459
501
  elsif value.is_a?(Hash)
460
502
  {}.tap do |hash|
461
503
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -1,3 +1,15 @@
1
+ =begin
2
+ #DocRaptor
3
+
4
+ #A native client library for the DocRaptor HTML to PDF/XLS service.
5
+
6
+ OpenAPI spec version: 1.4.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.19
10
+
11
+ =end
12
+
1
13
  module DocRaptor
2
- VERSION = "1.1.0"
14
+ VERSION = '2.0.0'
3
15
  end