templatefox 1.10.0 → 1.11.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.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/lib/templatefox/api/account_api.rb +1 -1
  3. data/lib/templatefox/api/image_api.rb +90 -0
  4. data/lib/templatefox/api/integrations_api.rb +1 -1
  5. data/lib/templatefox/api/pdf_api.rb +1 -1
  6. data/lib/templatefox/api/pdf_async_api.rb +1 -1
  7. data/lib/templatefox/api/pdf_tools_api.rb +1 -1
  8. data/lib/templatefox/api/templates_api.rb +9 -1
  9. data/lib/templatefox/api_client.rb +1 -1
  10. data/lib/templatefox/api_error.rb +1 -1
  11. data/lib/templatefox/api_model_base.rb +1 -1
  12. data/lib/templatefox/configuration.rb +1 -1
  13. data/lib/templatefox/models/account_info_response.rb +1 -1
  14. data/lib/templatefox/models/{app_routers_v1_pdf_export_type.rb → app_routers_v1_delivery_export_type.rb} +4 -4
  15. data/lib/templatefox/models/app_routers_v1_pdf_async_export_type.rb +1 -1
  16. data/lib/templatefox/models/app_routers_v1_pdf_tools_export_type.rb +1 -1
  17. data/lib/templatefox/models/create_async_pdf_request.rb +1 -1
  18. data/lib/templatefox/models/create_async_pdf_response.rb +1 -1
  19. data/lib/templatefox/models/create_image_request.rb +533 -0
  20. data/lib/templatefox/models/create_image_response.rb +259 -0
  21. data/lib/templatefox/models/create_pdf_request.rb +2 -2
  22. data/lib/templatefox/models/create_pdf_response.rb +1 -1
  23. data/lib/templatefox/models/create_version_request.rb +1 -1
  24. data/lib/templatefox/models/extract_pdf_pages_request.rb +1 -1
  25. data/lib/templatefox/models/http_validation_error.rb +1 -1
  26. data/lib/templatefox/models/image_format.rb +41 -0
  27. data/lib/templatefox/models/job_list_response.rb +1 -1
  28. data/lib/templatefox/models/job_status.rb +1 -1
  29. data/lib/templatefox/models/job_status_response.rb +1 -1
  30. data/lib/templatefox/models/location_inner.rb +1 -1
  31. data/lib/templatefox/models/merge_pdf_request.rb +1 -1
  32. data/lib/templatefox/models/modification.rb +305 -0
  33. data/lib/templatefox/models/pdf_input.rb +1 -1
  34. data/lib/templatefox/models/pdf_tools_response.rb +1 -1
  35. data/lib/templatefox/models/pdf_variant.rb +1 -1
  36. data/lib/templatefox/models/rotate_pdf_request.rb +1 -1
  37. data/lib/templatefox/models/s3_config_request.rb +1 -1
  38. data/lib/templatefox/models/s3_config_response.rb +1 -1
  39. data/lib/templatefox/models/s3_success_response.rb +1 -1
  40. data/lib/templatefox/models/s3_test_response.rb +1 -1
  41. data/lib/templatefox/models/template_field.rb +1 -1
  42. data/lib/templatefox/models/template_field_spec.rb +1 -1
  43. data/lib/templatefox/models/template_list_item.rb +14 -2
  44. data/lib/templatefox/models/templates_list_response.rb +1 -1
  45. data/lib/templatefox/models/transaction.rb +1 -1
  46. data/lib/templatefox/models/transactions_response.rb +1 -1
  47. data/lib/templatefox/models/update_version_request.rb +1 -1
  48. data/lib/templatefox/models/validation_error.rb +1 -1
  49. data/lib/templatefox/models/version_item.rb +1 -1
  50. data/lib/templatefox/models/versions_list_response.rb +1 -1
  51. data/lib/templatefox/version.rb +2 -2
  52. data/lib/templatefox.rb +7 -2
  53. data/spec/api/account_api_spec.rb +1 -1
  54. data/spec/api/image_api_spec.rb +47 -0
  55. data/spec/api/integrations_api_spec.rb +1 -1
  56. data/spec/api/pdf_api_spec.rb +1 -1
  57. data/spec/api/pdf_async_api_spec.rb +1 -1
  58. data/spec/api/pdf_tools_api_spec.rb +1 -1
  59. data/spec/api/templates_api_spec.rb +2 -1
  60. data/spec/models/account_info_response_spec.rb +1 -1
  61. data/spec/models/{app_routers_v1_pdf_export_type_spec.rb → app_routers_v1_delivery_export_type_spec.rb} +7 -7
  62. data/spec/models/app_routers_v1_pdf_async_export_type_spec.rb +1 -1
  63. data/spec/models/app_routers_v1_pdf_tools_export_type_spec.rb +1 -1
  64. data/spec/models/create_async_pdf_request_spec.rb +1 -1
  65. data/spec/models/create_async_pdf_response_spec.rb +1 -1
  66. data/spec/models/create_image_request_spec.rb +108 -0
  67. data/spec/models/create_image_response_spec.rb +60 -0
  68. data/spec/models/create_pdf_request_spec.rb +1 -1
  69. data/spec/models/create_pdf_response_spec.rb +1 -1
  70. data/spec/models/create_version_request_spec.rb +1 -1
  71. data/spec/models/extract_pdf_pages_request_spec.rb +1 -1
  72. data/spec/models/http_validation_error_spec.rb +1 -1
  73. data/spec/models/image_format_spec.rb +30 -0
  74. data/spec/models/job_list_response_spec.rb +1 -1
  75. data/spec/models/job_status_response_spec.rb +1 -1
  76. data/spec/models/job_status_spec.rb +1 -1
  77. data/spec/models/location_inner_spec.rb +1 -1
  78. data/spec/models/merge_pdf_request_spec.rb +1 -1
  79. data/spec/models/modification_spec.rb +66 -0
  80. data/spec/models/pdf_input_spec.rb +1 -1
  81. data/spec/models/pdf_tools_response_spec.rb +1 -1
  82. data/spec/models/pdf_variant_spec.rb +1 -1
  83. data/spec/models/rotate_pdf_request_spec.rb +1 -1
  84. data/spec/models/s3_config_request_spec.rb +1 -1
  85. data/spec/models/s3_config_response_spec.rb +1 -1
  86. data/spec/models/s3_success_response_spec.rb +1 -1
  87. data/spec/models/s3_test_response_spec.rb +1 -1
  88. data/spec/models/template_field_spec.rb +1 -1
  89. data/spec/models/template_field_spec_spec.rb +1 -1
  90. data/spec/models/template_list_item_spec.rb +7 -1
  91. data/spec/models/templates_list_response_spec.rb +1 -1
  92. data/spec/models/transaction_spec.rb +1 -1
  93. data/spec/models/transactions_response_spec.rb +1 -1
  94. data/spec/models/update_version_request_spec.rb +1 -1
  95. data/spec/models/validation_error_spec.rb +1 -1
  96. data/spec/models/version_item_spec.rb +1 -1
  97. data/spec/models/versions_list_response_spec.rb +1 -1
  98. data/spec/spec_helper.rb +1 -1
  99. data/templatefox.gemspec +1 -1
  100. metadata +46 -31
@@ -0,0 +1,533 @@
1
+ =begin
2
+ #TemplateFox API
3
+
4
+ #Generate beautiful PDFs from HTML/CSS templates with Jinja2 via API. Design once, generate thousands.
5
+
6
+ The version of the OpenAPI document: 1.11.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.21.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TemplateFox
17
+ # Request model for image generation
18
+ class CreateImageRequest < ApiModelBase
19
+ # Template short ID (12 characters)
20
+ attr_accessor :template_id
21
+
22
+ attr_accessor :modifications
23
+
24
+ # Optional key-value data merged into `{{ }}` template variables. For most image templates, prefer `modifications` instead.
25
+ attr_accessor :data
26
+
27
+ # Output image format: `png` (default), `jpeg` or `webp`.
28
+ attr_accessor :format
29
+
30
+ attr_accessor :width
31
+
32
+ # Compression quality for `jpeg`/`webp` (1-100). Ignored for `png`.
33
+ attr_accessor :quality
34
+
35
+ # Export format: `url` uploads to CDN and returns URL, `binary` returns raw image bytes
36
+ attr_accessor :export_type
37
+
38
+ # URL expiration in seconds. Min: 60 (1 min), Max: 604800 (7 days). Only applies to `url` export type.
39
+ attr_accessor :expiration
40
+
41
+ attr_accessor :filename
42
+
43
+ # Upload to your configured S3 bucket instead of CDN
44
+ attr_accessor :store_s3
45
+
46
+ attr_accessor :s3_filepath
47
+
48
+ attr_accessor :s3_bucket
49
+
50
+ attr_accessor :version
51
+
52
+ class EnumAttributeValidator
53
+ attr_reader :datatype
54
+ attr_reader :allowable_values
55
+
56
+ def initialize(datatype, allowable_values)
57
+ @allowable_values = allowable_values.map do |value|
58
+ case datatype.to_s
59
+ when /Integer/i
60
+ value.to_i
61
+ when /Float/i
62
+ value.to_f
63
+ else
64
+ value
65
+ end
66
+ end
67
+ end
68
+
69
+ def valid?(value)
70
+ !value || allowable_values.include?(value)
71
+ end
72
+ end
73
+
74
+ # Attribute mapping from ruby-style variable name to JSON key.
75
+ def self.attribute_map
76
+ {
77
+ :'template_id' => :'template_id',
78
+ :'modifications' => :'modifications',
79
+ :'data' => :'data',
80
+ :'format' => :'format',
81
+ :'width' => :'width',
82
+ :'quality' => :'quality',
83
+ :'export_type' => :'export_type',
84
+ :'expiration' => :'expiration',
85
+ :'filename' => :'filename',
86
+ :'store_s3' => :'store_s3',
87
+ :'s3_filepath' => :'s3_filepath',
88
+ :'s3_bucket' => :'s3_bucket',
89
+ :'version' => :'version'
90
+ }
91
+ end
92
+
93
+ # Returns attribute mapping this model knows about
94
+ def self.acceptable_attribute_map
95
+ attribute_map
96
+ end
97
+
98
+ # Returns all the JSON keys this model knows about
99
+ def self.acceptable_attributes
100
+ acceptable_attribute_map.values
101
+ end
102
+
103
+ # Attribute type mapping.
104
+ def self.openapi_types
105
+ {
106
+ :'template_id' => :'String',
107
+ :'modifications' => :'Array<Modification>',
108
+ :'data' => :'Hash<String, Object>',
109
+ :'format' => :'ImageFormat',
110
+ :'width' => :'Integer',
111
+ :'quality' => :'Integer',
112
+ :'export_type' => :'AppRoutersV1DeliveryExportType',
113
+ :'expiration' => :'Integer',
114
+ :'filename' => :'String',
115
+ :'store_s3' => :'Boolean',
116
+ :'s3_filepath' => :'String',
117
+ :'s3_bucket' => :'String',
118
+ :'version' => :'String'
119
+ }
120
+ end
121
+
122
+ # List of attributes with nullable: true
123
+ def self.openapi_nullable
124
+ Set.new([
125
+ :'modifications',
126
+ :'width',
127
+ :'filename',
128
+ :'s3_filepath',
129
+ :'s3_bucket',
130
+ :'version'
131
+ ])
132
+ end
133
+
134
+ # Initializes the object
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ def initialize(attributes = {})
137
+ if (!attributes.is_a?(Hash))
138
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TemplateFox::CreateImageRequest` initialize method"
139
+ end
140
+
141
+ # check to see if the attribute exists and convert string to symbol for hash key
142
+ acceptable_attribute_map = self.class.acceptable_attribute_map
143
+ attributes = attributes.each_with_object({}) { |(k, v), h|
144
+ if (!acceptable_attribute_map.key?(k.to_sym))
145
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TemplateFox::CreateImageRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
146
+ end
147
+ h[k.to_sym] = v
148
+ }
149
+
150
+ if attributes.key?(:'template_id')
151
+ self.template_id = attributes[:'template_id']
152
+ else
153
+ self.template_id = nil
154
+ end
155
+
156
+ if attributes.key?(:'modifications')
157
+ if (value = attributes[:'modifications']).is_a?(Array)
158
+ self.modifications = value
159
+ end
160
+ end
161
+
162
+ if attributes.key?(:'data')
163
+ if (value = attributes[:'data']).is_a?(Hash)
164
+ self.data = value
165
+ end
166
+ end
167
+
168
+ if attributes.key?(:'format')
169
+ self.format = attributes[:'format']
170
+ end
171
+
172
+ if attributes.key?(:'width')
173
+ self.width = attributes[:'width']
174
+ end
175
+
176
+ if attributes.key?(:'quality')
177
+ self.quality = attributes[:'quality']
178
+ else
179
+ self.quality = 85
180
+ end
181
+
182
+ if attributes.key?(:'export_type')
183
+ self.export_type = attributes[:'export_type']
184
+ end
185
+
186
+ if attributes.key?(:'expiration')
187
+ self.expiration = attributes[:'expiration']
188
+ else
189
+ self.expiration = 86400
190
+ end
191
+
192
+ if attributes.key?(:'filename')
193
+ self.filename = attributes[:'filename']
194
+ end
195
+
196
+ if attributes.key?(:'store_s3')
197
+ self.store_s3 = attributes[:'store_s3']
198
+ else
199
+ self.store_s3 = false
200
+ end
201
+
202
+ if attributes.key?(:'s3_filepath')
203
+ self.s3_filepath = attributes[:'s3_filepath']
204
+ end
205
+
206
+ if attributes.key?(:'s3_bucket')
207
+ self.s3_bucket = attributes[:'s3_bucket']
208
+ end
209
+
210
+ if attributes.key?(:'version')
211
+ self.version = attributes[:'version']
212
+ end
213
+ end
214
+
215
+ # Show invalid properties with the reasons. Usually used together with valid?
216
+ # @return Array for valid properties with the reasons
217
+ def list_invalid_properties
218
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
219
+ invalid_properties = Array.new
220
+ if @template_id.nil?
221
+ invalid_properties.push('invalid value for "template_id", template_id cannot be nil.')
222
+ end
223
+
224
+ if @template_id.to_s.length > 12
225
+ invalid_properties.push('invalid value for "template_id", the character length must be smaller than or equal to 12.')
226
+ end
227
+
228
+ if @template_id.to_s.length < 12
229
+ invalid_properties.push('invalid value for "template_id", the character length must be greater than or equal to 12.')
230
+ end
231
+
232
+ if !@modifications.nil? && @modifications.length > 100
233
+ invalid_properties.push('invalid value for "modifications", number of items must be less than or equal to 100.')
234
+ end
235
+
236
+ if !@width.nil? && @width > 4000
237
+ invalid_properties.push('invalid value for "width", must be smaller than or equal to 4000.')
238
+ end
239
+
240
+ if !@width.nil? && @width < 100
241
+ invalid_properties.push('invalid value for "width", must be greater than or equal to 100.')
242
+ end
243
+
244
+ if !@quality.nil? && @quality > 100
245
+ invalid_properties.push('invalid value for "quality", must be smaller than or equal to 100.')
246
+ end
247
+
248
+ if !@quality.nil? && @quality < 1
249
+ invalid_properties.push('invalid value for "quality", must be greater than or equal to 1.')
250
+ end
251
+
252
+ if !@expiration.nil? && @expiration > 604800
253
+ invalid_properties.push('invalid value for "expiration", must be smaller than or equal to 604800.')
254
+ end
255
+
256
+ if !@expiration.nil? && @expiration < 60
257
+ invalid_properties.push('invalid value for "expiration", must be greater than or equal to 60.')
258
+ end
259
+
260
+ if !@filename.nil? && @filename.to_s.length > 100
261
+ invalid_properties.push('invalid value for "filename", the character length must be smaller than or equal to 100.')
262
+ end
263
+
264
+ pattern = Regexp.new(/^[a-zA-Z0-9_\-\.]+$/)
265
+ if !@filename.nil? && @filename !~ pattern
266
+ invalid_properties.push("invalid value for \"filename\", must conform to the pattern #{pattern}.")
267
+ end
268
+
269
+ if !@s3_filepath.nil? && @s3_filepath.to_s.length > 500
270
+ invalid_properties.push('invalid value for "s3_filepath", the character length must be smaller than or equal to 500.')
271
+ end
272
+
273
+ pattern = Regexp.new(/^[a-zA-Z0-9_\-\.\/]+$/)
274
+ if !@s3_filepath.nil? && @s3_filepath !~ pattern
275
+ invalid_properties.push("invalid value for \"s3_filepath\", must conform to the pattern #{pattern}.")
276
+ end
277
+
278
+ if !@s3_bucket.nil? && @s3_bucket.to_s.length > 63
279
+ invalid_properties.push('invalid value for "s3_bucket", the character length must be smaller than or equal to 63.')
280
+ end
281
+
282
+ if !@s3_bucket.nil? && @s3_bucket.to_s.length < 3
283
+ invalid_properties.push('invalid value for "s3_bucket", the character length must be greater than or equal to 3.')
284
+ end
285
+
286
+ pattern = Regexp.new(/^[a-z0-9][a-z0-9.\-]*[a-z0-9]$/)
287
+ if !@s3_bucket.nil? && @s3_bucket !~ pattern
288
+ invalid_properties.push("invalid value for \"s3_bucket\", must conform to the pattern #{pattern}.")
289
+ end
290
+
291
+ if !@version.nil? && @version.to_s.length > 50
292
+ invalid_properties.push('invalid value for "version", the character length must be smaller than or equal to 50.')
293
+ end
294
+
295
+ invalid_properties
296
+ end
297
+
298
+ # Check to see if the all the properties in the model are valid
299
+ # @return true if the model is valid
300
+ def valid?
301
+ warn '[DEPRECATED] the `valid?` method is obsolete'
302
+ return false if @template_id.nil?
303
+ return false if @template_id.to_s.length > 12
304
+ return false if @template_id.to_s.length < 12
305
+ return false if !@modifications.nil? && @modifications.length > 100
306
+ return false if !@width.nil? && @width > 4000
307
+ return false if !@width.nil? && @width < 100
308
+ return false if !@quality.nil? && @quality > 100
309
+ return false if !@quality.nil? && @quality < 1
310
+ return false if !@expiration.nil? && @expiration > 604800
311
+ return false if !@expiration.nil? && @expiration < 60
312
+ return false if !@filename.nil? && @filename.to_s.length > 100
313
+ return false if !@filename.nil? && @filename !~ Regexp.new(/^[a-zA-Z0-9_\-\.]+$/)
314
+ return false if !@s3_filepath.nil? && @s3_filepath.to_s.length > 500
315
+ return false if !@s3_filepath.nil? && @s3_filepath !~ Regexp.new(/^[a-zA-Z0-9_\-\.\/]+$/)
316
+ return false if !@s3_bucket.nil? && @s3_bucket.to_s.length > 63
317
+ return false if !@s3_bucket.nil? && @s3_bucket.to_s.length < 3
318
+ return false if !@s3_bucket.nil? && @s3_bucket !~ Regexp.new(/^[a-z0-9][a-z0-9.\-]*[a-z0-9]$/)
319
+ return false if !@version.nil? && @version.to_s.length > 50
320
+ true
321
+ end
322
+
323
+ # Custom attribute writer method with validation
324
+ # @param [Object] template_id Value to be assigned
325
+ def template_id=(template_id)
326
+ if template_id.nil?
327
+ fail ArgumentError, 'template_id cannot be nil'
328
+ end
329
+
330
+ if template_id.to_s.length > 12
331
+ fail ArgumentError, 'invalid value for "template_id", the character length must be smaller than or equal to 12.'
332
+ end
333
+
334
+ if template_id.to_s.length < 12
335
+ fail ArgumentError, 'invalid value for "template_id", the character length must be greater than or equal to 12.'
336
+ end
337
+
338
+ @template_id = template_id
339
+ end
340
+
341
+ # Custom attribute writer method with validation
342
+ # @param [Object] modifications Value to be assigned
343
+ def modifications=(modifications)
344
+ if !modifications.nil? && modifications.length > 100
345
+ fail ArgumentError, 'invalid value for "modifications", number of items must be less than or equal to 100.'
346
+ end
347
+
348
+ @modifications = modifications
349
+ end
350
+
351
+ # Custom attribute writer method with validation
352
+ # @param [Object] width Value to be assigned
353
+ def width=(width)
354
+ if !width.nil? && width > 4000
355
+ fail ArgumentError, 'invalid value for "width", must be smaller than or equal to 4000.'
356
+ end
357
+
358
+ if !width.nil? && width < 100
359
+ fail ArgumentError, 'invalid value for "width", must be greater than or equal to 100.'
360
+ end
361
+
362
+ @width = width
363
+ end
364
+
365
+ # Custom attribute writer method with validation
366
+ # @param [Object] quality Value to be assigned
367
+ def quality=(quality)
368
+ if quality.nil?
369
+ fail ArgumentError, 'quality cannot be nil'
370
+ end
371
+
372
+ if quality > 100
373
+ fail ArgumentError, 'invalid value for "quality", must be smaller than or equal to 100.'
374
+ end
375
+
376
+ if quality < 1
377
+ fail ArgumentError, 'invalid value for "quality", must be greater than or equal to 1.'
378
+ end
379
+
380
+ @quality = quality
381
+ end
382
+
383
+ # Custom attribute writer method with validation
384
+ # @param [Object] expiration Value to be assigned
385
+ def expiration=(expiration)
386
+ if expiration.nil?
387
+ fail ArgumentError, 'expiration cannot be nil'
388
+ end
389
+
390
+ if expiration > 604800
391
+ fail ArgumentError, 'invalid value for "expiration", must be smaller than or equal to 604800.'
392
+ end
393
+
394
+ if expiration < 60
395
+ fail ArgumentError, 'invalid value for "expiration", must be greater than or equal to 60.'
396
+ end
397
+
398
+ @expiration = expiration
399
+ end
400
+
401
+ # Custom attribute writer method with validation
402
+ # @param [Object] filename Value to be assigned
403
+ def filename=(filename)
404
+ if !filename.nil? && filename.to_s.length > 100
405
+ fail ArgumentError, 'invalid value for "filename", the character length must be smaller than or equal to 100.'
406
+ end
407
+
408
+ pattern = Regexp.new(/^[a-zA-Z0-9_\-\.]+$/)
409
+ if !filename.nil? && filename !~ pattern
410
+ fail ArgumentError, "invalid value for \"filename\", must conform to the pattern #{pattern}."
411
+ end
412
+
413
+ @filename = filename
414
+ end
415
+
416
+ # Custom attribute writer method with validation
417
+ # @param [Object] s3_filepath Value to be assigned
418
+ def s3_filepath=(s3_filepath)
419
+ if !s3_filepath.nil? && s3_filepath.to_s.length > 500
420
+ fail ArgumentError, 'invalid value for "s3_filepath", the character length must be smaller than or equal to 500.'
421
+ end
422
+
423
+ pattern = Regexp.new(/^[a-zA-Z0-9_\-\.\/]+$/)
424
+ if !s3_filepath.nil? && s3_filepath !~ pattern
425
+ fail ArgumentError, "invalid value for \"s3_filepath\", must conform to the pattern #{pattern}."
426
+ end
427
+
428
+ @s3_filepath = s3_filepath
429
+ end
430
+
431
+ # Custom attribute writer method with validation
432
+ # @param [Object] s3_bucket Value to be assigned
433
+ def s3_bucket=(s3_bucket)
434
+ if !s3_bucket.nil? && s3_bucket.to_s.length > 63
435
+ fail ArgumentError, 'invalid value for "s3_bucket", the character length must be smaller than or equal to 63.'
436
+ end
437
+
438
+ if !s3_bucket.nil? && s3_bucket.to_s.length < 3
439
+ fail ArgumentError, 'invalid value for "s3_bucket", the character length must be greater than or equal to 3.'
440
+ end
441
+
442
+ pattern = Regexp.new(/^[a-z0-9][a-z0-9.\-]*[a-z0-9]$/)
443
+ if !s3_bucket.nil? && s3_bucket !~ pattern
444
+ fail ArgumentError, "invalid value for \"s3_bucket\", must conform to the pattern #{pattern}."
445
+ end
446
+
447
+ @s3_bucket = s3_bucket
448
+ end
449
+
450
+ # Custom attribute writer method with validation
451
+ # @param [Object] version Value to be assigned
452
+ def version=(version)
453
+ if !version.nil? && version.to_s.length > 50
454
+ fail ArgumentError, 'invalid value for "version", the character length must be smaller than or equal to 50.'
455
+ end
456
+
457
+ @version = version
458
+ end
459
+
460
+ # Checks equality by comparing each attribute.
461
+ # @param [Object] Object to be compared
462
+ def ==(o)
463
+ return true if self.equal?(o)
464
+ self.class == o.class &&
465
+ template_id == o.template_id &&
466
+ modifications == o.modifications &&
467
+ data == o.data &&
468
+ format == o.format &&
469
+ width == o.width &&
470
+ quality == o.quality &&
471
+ export_type == o.export_type &&
472
+ expiration == o.expiration &&
473
+ filename == o.filename &&
474
+ store_s3 == o.store_s3 &&
475
+ s3_filepath == o.s3_filepath &&
476
+ s3_bucket == o.s3_bucket &&
477
+ version == o.version
478
+ end
479
+
480
+ # @see the `==` method
481
+ # @param [Object] Object to be compared
482
+ def eql?(o)
483
+ self == o
484
+ end
485
+
486
+ # Calculates hash code according to all attributes.
487
+ # @return [Integer] Hash code
488
+ def hash
489
+ [template_id, modifications, data, format, width, quality, export_type, expiration, filename, store_s3, s3_filepath, s3_bucket, version].hash
490
+ end
491
+
492
+ # Builds the object from hash
493
+ # @param [Hash] attributes Model attributes in the form of hash
494
+ # @return [Object] Returns the model itself
495
+ def self.build_from_hash(attributes)
496
+ return nil unless attributes.is_a?(Hash)
497
+ attributes = attributes.transform_keys(&:to_sym)
498
+ transformed_hash = {}
499
+ openapi_types.each_pair do |key, type|
500
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
501
+ transformed_hash["#{key}"] = nil
502
+ elsif type =~ /\AArray<(.*)>/i
503
+ # check to ensure the input is an array given that the attribute
504
+ # is documented as an array but the input is not
505
+ if attributes[attribute_map[key]].is_a?(Array)
506
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
507
+ end
508
+ elsif !attributes[attribute_map[key]].nil?
509
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
510
+ end
511
+ end
512
+ new(transformed_hash)
513
+ end
514
+
515
+ # Returns the object in the form of hash
516
+ # @return [Hash] Returns the object in the form of hash
517
+ def to_hash
518
+ hash = {}
519
+ self.class.attribute_map.each_pair do |attr, param|
520
+ value = self.send(attr)
521
+ if value.nil?
522
+ is_nullable = self.class.openapi_nullable.include?(attr)
523
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
524
+ end
525
+
526
+ hash[param] = _to_hash(value)
527
+ end
528
+ hash
529
+ end
530
+
531
+ end
532
+
533
+ end