templatefox 1.0.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 (75) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +21 -0
  4. data/README.md +206 -0
  5. data/Rakefile +10 -0
  6. data/docs/AccountApi.md +152 -0
  7. data/docs/AccountInfoResponse.md +20 -0
  8. data/docs/CreatePdfRequest.md +32 -0
  9. data/docs/CreatePdfResponse.md +24 -0
  10. data/docs/ExportType.md +15 -0
  11. data/docs/HTTPValidationError.md +18 -0
  12. data/docs/IntegrationsApi.md +286 -0
  13. data/docs/LocationInner.md +15 -0
  14. data/docs/PDFApi.md +79 -0
  15. data/docs/S3ConfigRequest.md +26 -0
  16. data/docs/S3ConfigResponse.md +28 -0
  17. data/docs/S3SuccessResponse.md +18 -0
  18. data/docs/S3TestResponse.md +20 -0
  19. data/docs/TemplateField.md +26 -0
  20. data/docs/TemplateListItem.md +24 -0
  21. data/docs/TemplatesApi.md +148 -0
  22. data/docs/TemplatesListResponse.md +18 -0
  23. data/docs/Transaction.md +28 -0
  24. data/docs/TransactionsResponse.md +24 -0
  25. data/docs/ValidationError.md +22 -0
  26. data/git_push.sh +57 -0
  27. data/lib/templatefox/api/account_api.rb +154 -0
  28. data/lib/templatefox/api/integrations_api.rb +261 -0
  29. data/lib/templatefox/api/pdf_api.rb +90 -0
  30. data/lib/templatefox/api/templates_api.rb +142 -0
  31. data/lib/templatefox/api_client.rb +397 -0
  32. data/lib/templatefox/api_error.rb +58 -0
  33. data/lib/templatefox/api_model_base.rb +88 -0
  34. data/lib/templatefox/configuration.rb +308 -0
  35. data/lib/templatefox/models/account_info_response.rb +176 -0
  36. data/lib/templatefox/models/create_pdf_request.rb +414 -0
  37. data/lib/templatefox/models/create_pdf_response.rb +247 -0
  38. data/lib/templatefox/models/export_type.rb +40 -0
  39. data/lib/templatefox/models/http_validation_error.rb +149 -0
  40. data/lib/templatefox/models/location_inner.rb +103 -0
  41. data/lib/templatefox/models/s3_config_request.rb +372 -0
  42. data/lib/templatefox/models/s3_config_response.rb +301 -0
  43. data/lib/templatefox/models/s3_success_response.rb +166 -0
  44. data/lib/templatefox/models/s3_test_response.rb +193 -0
  45. data/lib/templatefox/models/template_field.rb +227 -0
  46. data/lib/templatefox/models/template_list_item.rb +247 -0
  47. data/lib/templatefox/models/templates_list_response.rb +167 -0
  48. data/lib/templatefox/models/transaction.rb +267 -0
  49. data/lib/templatefox/models/transactions_response.rb +248 -0
  50. data/lib/templatefox/models/validation_error.rb +218 -0
  51. data/lib/templatefox/version.rb +15 -0
  52. data/lib/templatefox.rb +60 -0
  53. data/spec/api/account_api_spec.rb +59 -0
  54. data/spec/api/integrations_api_spec.rb +80 -0
  55. data/spec/api/pdf_api_spec.rb +47 -0
  56. data/spec/api/templates_api_spec.rb +58 -0
  57. data/spec/models/account_info_response_spec.rb +42 -0
  58. data/spec/models/create_pdf_request_spec.rb +78 -0
  59. data/spec/models/create_pdf_response_spec.rb +54 -0
  60. data/spec/models/export_type_spec.rb +30 -0
  61. data/spec/models/http_validation_error_spec.rb +36 -0
  62. data/spec/models/location_inner_spec.rb +21 -0
  63. data/spec/models/s3_config_request_spec.rb +60 -0
  64. data/spec/models/s3_config_response_spec.rb +66 -0
  65. data/spec/models/s3_success_response_spec.rb +36 -0
  66. data/spec/models/s3_test_response_spec.rb +42 -0
  67. data/spec/models/template_field_spec.rb +60 -0
  68. data/spec/models/template_list_item_spec.rb +54 -0
  69. data/spec/models/templates_list_response_spec.rb +36 -0
  70. data/spec/models/transaction_spec.rb +66 -0
  71. data/spec/models/transactions_response_spec.rb +54 -0
  72. data/spec/models/validation_error_spec.rb +48 -0
  73. data/spec/spec_helper.rb +111 -0
  74. data/templatefox.gemspec +39 -0
  75. metadata +177 -0
@@ -0,0 +1,414 @@
1
+ =begin
2
+ #TemplateFox API
3
+
4
+ #Generate PDFs from HTML templates via API. Design once, generate thousands.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TemplateFox
17
+ # Request model for PDF generation
18
+ class CreatePdfRequest < ApiModelBase
19
+ # **Required.** Template short ID (12 characters)
20
+ attr_accessor :template_id
21
+
22
+ # **Required.** Key-value data to render in the template. Keys must match template variables.
23
+ attr_accessor :data
24
+
25
+ # Export format: `url` uploads to CDN and returns URL, `binary` returns raw PDF bytes
26
+ attr_accessor :export_type
27
+
28
+ # URL expiration in seconds. Min: 60 (1 min), Max: 604800 (7 days). Only applies to `url` export type.
29
+ attr_accessor :expiration
30
+
31
+ attr_accessor :filename
32
+
33
+ # Upload to your configured S3 bucket instead of CDN
34
+ attr_accessor :store_s3
35
+
36
+ attr_accessor :s3_filepath
37
+
38
+ attr_accessor :s3_bucket
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'template_id' => :'template_id',
66
+ :'data' => :'data',
67
+ :'export_type' => :'export_type',
68
+ :'expiration' => :'expiration',
69
+ :'filename' => :'filename',
70
+ :'store_s3' => :'store_s3',
71
+ :'s3_filepath' => :'s3_filepath',
72
+ :'s3_bucket' => :'s3_bucket'
73
+ }
74
+ end
75
+
76
+ # Returns attribute mapping this model knows about
77
+ def self.acceptable_attribute_map
78
+ attribute_map
79
+ end
80
+
81
+ # Returns all the JSON keys this model knows about
82
+ def self.acceptable_attributes
83
+ acceptable_attribute_map.values
84
+ end
85
+
86
+ # Attribute type mapping.
87
+ def self.openapi_types
88
+ {
89
+ :'template_id' => :'String',
90
+ :'data' => :'Hash<String, Object>',
91
+ :'export_type' => :'ExportType',
92
+ :'expiration' => :'Integer',
93
+ :'filename' => :'String',
94
+ :'store_s3' => :'Boolean',
95
+ :'s3_filepath' => :'String',
96
+ :'s3_bucket' => :'String'
97
+ }
98
+ end
99
+
100
+ # List of attributes with nullable: true
101
+ def self.openapi_nullable
102
+ Set.new([
103
+ :'filename',
104
+ :'s3_filepath',
105
+ :'s3_bucket'
106
+ ])
107
+ end
108
+
109
+ # Initializes the object
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ def initialize(attributes = {})
112
+ if (!attributes.is_a?(Hash))
113
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TemplateFox::CreatePdfRequest` initialize method"
114
+ end
115
+
116
+ # check to see if the attribute exists and convert string to symbol for hash key
117
+ acceptable_attribute_map = self.class.acceptable_attribute_map
118
+ attributes = attributes.each_with_object({}) { |(k, v), h|
119
+ if (!acceptable_attribute_map.key?(k.to_sym))
120
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TemplateFox::CreatePdfRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
121
+ end
122
+ h[k.to_sym] = v
123
+ }
124
+
125
+ if attributes.key?(:'template_id')
126
+ self.template_id = attributes[:'template_id']
127
+ else
128
+ self.template_id = nil
129
+ end
130
+
131
+ if attributes.key?(:'data')
132
+ if (value = attributes[:'data']).is_a?(Hash)
133
+ self.data = value
134
+ end
135
+ else
136
+ self.data = nil
137
+ end
138
+
139
+ if attributes.key?(:'export_type')
140
+ self.export_type = attributes[:'export_type']
141
+ end
142
+
143
+ if attributes.key?(:'expiration')
144
+ self.expiration = attributes[:'expiration']
145
+ else
146
+ self.expiration = 86400
147
+ end
148
+
149
+ if attributes.key?(:'filename')
150
+ self.filename = attributes[:'filename']
151
+ end
152
+
153
+ if attributes.key?(:'store_s3')
154
+ self.store_s3 = attributes[:'store_s3']
155
+ else
156
+ self.store_s3 = false
157
+ end
158
+
159
+ if attributes.key?(:'s3_filepath')
160
+ self.s3_filepath = attributes[:'s3_filepath']
161
+ end
162
+
163
+ if attributes.key?(:'s3_bucket')
164
+ self.s3_bucket = attributes[:'s3_bucket']
165
+ end
166
+ end
167
+
168
+ # Show invalid properties with the reasons. Usually used together with valid?
169
+ # @return Array for valid properties with the reasons
170
+ def list_invalid_properties
171
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
172
+ invalid_properties = Array.new
173
+ if @template_id.nil?
174
+ invalid_properties.push('invalid value for "template_id", template_id cannot be nil.')
175
+ end
176
+
177
+ if @template_id.to_s.length > 12
178
+ invalid_properties.push('invalid value for "template_id", the character length must be smaller than or equal to 12.')
179
+ end
180
+
181
+ if @template_id.to_s.length < 12
182
+ invalid_properties.push('invalid value for "template_id", the character length must be greater than or equal to 12.')
183
+ end
184
+
185
+ if @data.nil?
186
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
187
+ end
188
+
189
+ if !@expiration.nil? && @expiration > 604800
190
+ invalid_properties.push('invalid value for "expiration", must be smaller than or equal to 604800.')
191
+ end
192
+
193
+ if !@expiration.nil? && @expiration < 60
194
+ invalid_properties.push('invalid value for "expiration", must be greater than or equal to 60.')
195
+ end
196
+
197
+ if !@filename.nil? && @filename.to_s.length > 100
198
+ invalid_properties.push('invalid value for "filename", the character length must be smaller than or equal to 100.')
199
+ end
200
+
201
+ pattern = Regexp.new(/^[a-zA-Z0-9_\-\.]+$/)
202
+ if !@filename.nil? && @filename !~ pattern
203
+ invalid_properties.push("invalid value for \"filename\", must conform to the pattern #{pattern}.")
204
+ end
205
+
206
+ if !@s3_filepath.nil? && @s3_filepath.to_s.length > 500
207
+ invalid_properties.push('invalid value for "s3_filepath", the character length must be smaller than or equal to 500.')
208
+ end
209
+
210
+ pattern = Regexp.new(/^[a-zA-Z0-9_\-\.\/]+$/)
211
+ if !@s3_filepath.nil? && @s3_filepath !~ pattern
212
+ invalid_properties.push("invalid value for \"s3_filepath\", must conform to the pattern #{pattern}.")
213
+ end
214
+
215
+ if !@s3_bucket.nil? && @s3_bucket.to_s.length > 63
216
+ invalid_properties.push('invalid value for "s3_bucket", the character length must be smaller than or equal to 63.')
217
+ end
218
+
219
+ if !@s3_bucket.nil? && @s3_bucket.to_s.length < 3
220
+ invalid_properties.push('invalid value for "s3_bucket", the character length must be greater than or equal to 3.')
221
+ end
222
+
223
+ pattern = Regexp.new(/^[a-z0-9][a-z0-9.\-]*[a-z0-9]$/)
224
+ if !@s3_bucket.nil? && @s3_bucket !~ pattern
225
+ invalid_properties.push("invalid value for \"s3_bucket\", must conform to the pattern #{pattern}.")
226
+ end
227
+
228
+ invalid_properties
229
+ end
230
+
231
+ # Check to see if the all the properties in the model are valid
232
+ # @return true if the model is valid
233
+ def valid?
234
+ warn '[DEPRECATED] the `valid?` method is obsolete'
235
+ return false if @template_id.nil?
236
+ return false if @template_id.to_s.length > 12
237
+ return false if @template_id.to_s.length < 12
238
+ return false if @data.nil?
239
+ return false if !@expiration.nil? && @expiration > 604800
240
+ return false if !@expiration.nil? && @expiration < 60
241
+ return false if !@filename.nil? && @filename.to_s.length > 100
242
+ return false if !@filename.nil? && @filename !~ Regexp.new(/^[a-zA-Z0-9_\-\.]+$/)
243
+ return false if !@s3_filepath.nil? && @s3_filepath.to_s.length > 500
244
+ return false if !@s3_filepath.nil? && @s3_filepath !~ Regexp.new(/^[a-zA-Z0-9_\-\.\/]+$/)
245
+ return false if !@s3_bucket.nil? && @s3_bucket.to_s.length > 63
246
+ return false if !@s3_bucket.nil? && @s3_bucket.to_s.length < 3
247
+ return false if !@s3_bucket.nil? && @s3_bucket !~ Regexp.new(/^[a-z0-9][a-z0-9.\-]*[a-z0-9]$/)
248
+ true
249
+ end
250
+
251
+ # Custom attribute writer method with validation
252
+ # @param [Object] template_id Value to be assigned
253
+ def template_id=(template_id)
254
+ if template_id.nil?
255
+ fail ArgumentError, 'template_id cannot be nil'
256
+ end
257
+
258
+ if template_id.to_s.length > 12
259
+ fail ArgumentError, 'invalid value for "template_id", the character length must be smaller than or equal to 12.'
260
+ end
261
+
262
+ if template_id.to_s.length < 12
263
+ fail ArgumentError, 'invalid value for "template_id", the character length must be greater than or equal to 12.'
264
+ end
265
+
266
+ @template_id = template_id
267
+ end
268
+
269
+ # Custom attribute writer method with validation
270
+ # @param [Object] data Value to be assigned
271
+ def data=(data)
272
+ if data.nil?
273
+ fail ArgumentError, 'data cannot be nil'
274
+ end
275
+
276
+ @data = data
277
+ end
278
+
279
+ # Custom attribute writer method with validation
280
+ # @param [Object] expiration Value to be assigned
281
+ def expiration=(expiration)
282
+ if expiration.nil?
283
+ fail ArgumentError, 'expiration cannot be nil'
284
+ end
285
+
286
+ if expiration > 604800
287
+ fail ArgumentError, 'invalid value for "expiration", must be smaller than or equal to 604800.'
288
+ end
289
+
290
+ if expiration < 60
291
+ fail ArgumentError, 'invalid value for "expiration", must be greater than or equal to 60.'
292
+ end
293
+
294
+ @expiration = expiration
295
+ end
296
+
297
+ # Custom attribute writer method with validation
298
+ # @param [Object] filename Value to be assigned
299
+ def filename=(filename)
300
+ if !filename.nil? && filename.to_s.length > 100
301
+ fail ArgumentError, 'invalid value for "filename", the character length must be smaller than or equal to 100.'
302
+ end
303
+
304
+ pattern = Regexp.new(/^[a-zA-Z0-9_\-\.]+$/)
305
+ if !filename.nil? && filename !~ pattern
306
+ fail ArgumentError, "invalid value for \"filename\", must conform to the pattern #{pattern}."
307
+ end
308
+
309
+ @filename = filename
310
+ end
311
+
312
+ # Custom attribute writer method with validation
313
+ # @param [Object] s3_filepath Value to be assigned
314
+ def s3_filepath=(s3_filepath)
315
+ if !s3_filepath.nil? && s3_filepath.to_s.length > 500
316
+ fail ArgumentError, 'invalid value for "s3_filepath", the character length must be smaller than or equal to 500.'
317
+ end
318
+
319
+ pattern = Regexp.new(/^[a-zA-Z0-9_\-\.\/]+$/)
320
+ if !s3_filepath.nil? && s3_filepath !~ pattern
321
+ fail ArgumentError, "invalid value for \"s3_filepath\", must conform to the pattern #{pattern}."
322
+ end
323
+
324
+ @s3_filepath = s3_filepath
325
+ end
326
+
327
+ # Custom attribute writer method with validation
328
+ # @param [Object] s3_bucket Value to be assigned
329
+ def s3_bucket=(s3_bucket)
330
+ if !s3_bucket.nil? && s3_bucket.to_s.length > 63
331
+ fail ArgumentError, 'invalid value for "s3_bucket", the character length must be smaller than or equal to 63.'
332
+ end
333
+
334
+ if !s3_bucket.nil? && s3_bucket.to_s.length < 3
335
+ fail ArgumentError, 'invalid value for "s3_bucket", the character length must be greater than or equal to 3.'
336
+ end
337
+
338
+ pattern = Regexp.new(/^[a-z0-9][a-z0-9.\-]*[a-z0-9]$/)
339
+ if !s3_bucket.nil? && s3_bucket !~ pattern
340
+ fail ArgumentError, "invalid value for \"s3_bucket\", must conform to the pattern #{pattern}."
341
+ end
342
+
343
+ @s3_bucket = s3_bucket
344
+ end
345
+
346
+ # Checks equality by comparing each attribute.
347
+ # @param [Object] Object to be compared
348
+ def ==(o)
349
+ return true if self.equal?(o)
350
+ self.class == o.class &&
351
+ template_id == o.template_id &&
352
+ data == o.data &&
353
+ export_type == o.export_type &&
354
+ expiration == o.expiration &&
355
+ filename == o.filename &&
356
+ store_s3 == o.store_s3 &&
357
+ s3_filepath == o.s3_filepath &&
358
+ s3_bucket == o.s3_bucket
359
+ end
360
+
361
+ # @see the `==` method
362
+ # @param [Object] Object to be compared
363
+ def eql?(o)
364
+ self == o
365
+ end
366
+
367
+ # Calculates hash code according to all attributes.
368
+ # @return [Integer] Hash code
369
+ def hash
370
+ [template_id, data, export_type, expiration, filename, store_s3, s3_filepath, s3_bucket].hash
371
+ end
372
+
373
+ # Builds the object from hash
374
+ # @param [Hash] attributes Model attributes in the form of hash
375
+ # @return [Object] Returns the model itself
376
+ def self.build_from_hash(attributes)
377
+ return nil unless attributes.is_a?(Hash)
378
+ attributes = attributes.transform_keys(&:to_sym)
379
+ transformed_hash = {}
380
+ openapi_types.each_pair do |key, type|
381
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
382
+ transformed_hash["#{key}"] = nil
383
+ elsif type =~ /\AArray<(.*)>/i
384
+ # check to ensure the input is an array given that the attribute
385
+ # is documented as an array but the input is not
386
+ if attributes[attribute_map[key]].is_a?(Array)
387
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
388
+ end
389
+ elsif !attributes[attribute_map[key]].nil?
390
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
391
+ end
392
+ end
393
+ new(transformed_hash)
394
+ end
395
+
396
+ # Returns the object in the form of hash
397
+ # @return [Hash] Returns the object in the form of hash
398
+ def to_hash
399
+ hash = {}
400
+ self.class.attribute_map.each_pair do |attr, param|
401
+ value = self.send(attr)
402
+ if value.nil?
403
+ is_nullable = self.class.openapi_nullable.include?(attr)
404
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
405
+ end
406
+
407
+ hash[param] = _to_hash(value)
408
+ end
409
+ hash
410
+ end
411
+
412
+ end
413
+
414
+ end
@@ -0,0 +1,247 @@
1
+ =begin
2
+ #TemplateFox API
3
+
4
+ #Generate PDFs from HTML templates via API. Design once, generate thousands.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TemplateFox
17
+ # Response for URL export type
18
+ class CreatePdfResponse < ApiModelBase
19
+ # Signed URL to download the PDF (expires after specified time)
20
+ attr_accessor :url
21
+
22
+ # Filename of the generated PDF
23
+ attr_accessor :filename
24
+
25
+ # Remaining credits after this request
26
+ attr_accessor :credits_remaining
27
+
28
+ # Seconds until URL expires
29
+ attr_accessor :expires_in
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'url' => :'url',
35
+ :'filename' => :'filename',
36
+ :'credits_remaining' => :'credits_remaining',
37
+ :'expires_in' => :'expires_in'
38
+ }
39
+ end
40
+
41
+ # Returns attribute mapping this model knows about
42
+ def self.acceptable_attribute_map
43
+ attribute_map
44
+ end
45
+
46
+ # Returns all the JSON keys this model knows about
47
+ def self.acceptable_attributes
48
+ acceptable_attribute_map.values
49
+ end
50
+
51
+ # Attribute type mapping.
52
+ def self.openapi_types
53
+ {
54
+ :'url' => :'String',
55
+ :'filename' => :'String',
56
+ :'credits_remaining' => :'Integer',
57
+ :'expires_in' => :'Integer'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TemplateFox::CreatePdfResponse` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ acceptable_attribute_map = self.class.acceptable_attribute_map
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!acceptable_attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TemplateFox::CreatePdfResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'url')
84
+ self.url = attributes[:'url']
85
+ else
86
+ self.url = nil
87
+ end
88
+
89
+ if attributes.key?(:'filename')
90
+ self.filename = attributes[:'filename']
91
+ else
92
+ self.filename = nil
93
+ end
94
+
95
+ if attributes.key?(:'credits_remaining')
96
+ self.credits_remaining = attributes[:'credits_remaining']
97
+ else
98
+ self.credits_remaining = nil
99
+ end
100
+
101
+ if attributes.key?(:'expires_in')
102
+ self.expires_in = attributes[:'expires_in']
103
+ else
104
+ self.expires_in = nil
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
112
+ invalid_properties = Array.new
113
+ if @url.nil?
114
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
115
+ end
116
+
117
+ if @filename.nil?
118
+ invalid_properties.push('invalid value for "filename", filename cannot be nil.')
119
+ end
120
+
121
+ if @credits_remaining.nil?
122
+ invalid_properties.push('invalid value for "credits_remaining", credits_remaining cannot be nil.')
123
+ end
124
+
125
+ if @expires_in.nil?
126
+ invalid_properties.push('invalid value for "expires_in", expires_in cannot be nil.')
127
+ end
128
+
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ warn '[DEPRECATED] the `valid?` method is obsolete'
136
+ return false if @url.nil?
137
+ return false if @filename.nil?
138
+ return false if @credits_remaining.nil?
139
+ return false if @expires_in.nil?
140
+ true
141
+ end
142
+
143
+ # Custom attribute writer method with validation
144
+ # @param [Object] url Value to be assigned
145
+ def url=(url)
146
+ if url.nil?
147
+ fail ArgumentError, 'url cannot be nil'
148
+ end
149
+
150
+ @url = url
151
+ end
152
+
153
+ # Custom attribute writer method with validation
154
+ # @param [Object] filename Value to be assigned
155
+ def filename=(filename)
156
+ if filename.nil?
157
+ fail ArgumentError, 'filename cannot be nil'
158
+ end
159
+
160
+ @filename = filename
161
+ end
162
+
163
+ # Custom attribute writer method with validation
164
+ # @param [Object] credits_remaining Value to be assigned
165
+ def credits_remaining=(credits_remaining)
166
+ if credits_remaining.nil?
167
+ fail ArgumentError, 'credits_remaining cannot be nil'
168
+ end
169
+
170
+ @credits_remaining = credits_remaining
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] expires_in Value to be assigned
175
+ def expires_in=(expires_in)
176
+ if expires_in.nil?
177
+ fail ArgumentError, 'expires_in cannot be nil'
178
+ end
179
+
180
+ @expires_in = expires_in
181
+ end
182
+
183
+ # Checks equality by comparing each attribute.
184
+ # @param [Object] Object to be compared
185
+ def ==(o)
186
+ return true if self.equal?(o)
187
+ self.class == o.class &&
188
+ url == o.url &&
189
+ filename == o.filename &&
190
+ credits_remaining == o.credits_remaining &&
191
+ expires_in == o.expires_in
192
+ end
193
+
194
+ # @see the `==` method
195
+ # @param [Object] Object to be compared
196
+ def eql?(o)
197
+ self == o
198
+ end
199
+
200
+ # Calculates hash code according to all attributes.
201
+ # @return [Integer] Hash code
202
+ def hash
203
+ [url, filename, credits_remaining, expires_in].hash
204
+ end
205
+
206
+ # Builds the object from hash
207
+ # @param [Hash] attributes Model attributes in the form of hash
208
+ # @return [Object] Returns the model itself
209
+ def self.build_from_hash(attributes)
210
+ return nil unless attributes.is_a?(Hash)
211
+ attributes = attributes.transform_keys(&:to_sym)
212
+ transformed_hash = {}
213
+ openapi_types.each_pair do |key, type|
214
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
215
+ transformed_hash["#{key}"] = nil
216
+ elsif type =~ /\AArray<(.*)>/i
217
+ # check to ensure the input is an array given that the attribute
218
+ # is documented as an array but the input is not
219
+ if attributes[attribute_map[key]].is_a?(Array)
220
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
221
+ end
222
+ elsif !attributes[attribute_map[key]].nil?
223
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
224
+ end
225
+ end
226
+ new(transformed_hash)
227
+ end
228
+
229
+ # Returns the object in the form of hash
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_hash
232
+ hash = {}
233
+ self.class.attribute_map.each_pair do |attr, param|
234
+ value = self.send(attr)
235
+ if value.nil?
236
+ is_nullable = self.class.openapi_nullable.include?(attr)
237
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
238
+ end
239
+
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ end
246
+
247
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+ #TemplateFox API
3
+
4
+ #Generate PDFs from HTML templates via API. Design once, generate thousands.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TemplateFox
17
+ class ExportType
18
+ URL = "url".freeze
19
+ BINARY = "binary".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [URL, BINARY].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if ExportType.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #ExportType"
38
+ end
39
+ end
40
+ end