templatefox 1.9.6 → 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.
- checksums.yaml +4 -4
- data/lib/templatefox/api/account_api.rb +1 -1
- data/lib/templatefox/api/image_api.rb +90 -0
- data/lib/templatefox/api/integrations_api.rb +1 -1
- data/lib/templatefox/api/pdf_api.rb +1 -1
- data/lib/templatefox/api/pdf_async_api.rb +1 -1
- data/lib/templatefox/api/pdf_tools_api.rb +226 -0
- data/lib/templatefox/api/templates_api.rb +9 -1
- data/lib/templatefox/api_client.rb +1 -1
- data/lib/templatefox/api_error.rb +1 -1
- data/lib/templatefox/api_model_base.rb +1 -1
- data/lib/templatefox/configuration.rb +1 -1
- data/lib/templatefox/models/account_info_response.rb +1 -1
- data/lib/templatefox/models/{app_routers_v1_pdf_export_type.rb → app_routers_v1_delivery_export_type.rb} +4 -4
- data/lib/templatefox/models/app_routers_v1_pdf_async_export_type.rb +1 -1
- data/lib/templatefox/models/app_routers_v1_pdf_tools_export_type.rb +40 -0
- data/lib/templatefox/models/create_async_pdf_request.rb +1 -1
- data/lib/templatefox/models/create_async_pdf_response.rb +1 -1
- data/lib/templatefox/models/create_image_request.rb +533 -0
- data/lib/templatefox/models/create_image_response.rb +259 -0
- data/lib/templatefox/models/create_pdf_request.rb +2 -2
- data/lib/templatefox/models/create_pdf_response.rb +1 -1
- data/lib/templatefox/models/create_version_request.rb +1 -1
- data/lib/templatefox/models/extract_pdf_pages_request.rb +293 -0
- data/lib/templatefox/models/http_validation_error.rb +1 -1
- data/lib/templatefox/models/image_format.rb +41 -0
- data/lib/templatefox/models/job_list_response.rb +1 -1
- data/lib/templatefox/models/job_status.rb +1 -1
- data/lib/templatefox/models/job_status_response.rb +1 -1
- data/lib/templatefox/models/location_inner.rb +1 -1
- data/lib/templatefox/models/merge_pdf_request.rb +284 -0
- data/lib/templatefox/models/modification.rb +305 -0
- data/lib/templatefox/models/pdf_input.rb +159 -0
- data/lib/templatefox/models/pdf_tools_response.rb +246 -0
- data/lib/templatefox/models/pdf_variant.rb +1 -1
- data/lib/templatefox/models/rotate_pdf_request.rb +288 -0
- data/lib/templatefox/models/s3_config_request.rb +1 -1
- data/lib/templatefox/models/s3_config_response.rb +1 -1
- data/lib/templatefox/models/s3_success_response.rb +1 -1
- data/lib/templatefox/models/s3_test_response.rb +1 -1
- data/lib/templatefox/models/template_field.rb +1 -1
- data/lib/templatefox/models/template_field_spec.rb +1 -1
- data/lib/templatefox/models/template_list_item.rb +14 -2
- data/lib/templatefox/models/templates_list_response.rb +1 -1
- data/lib/templatefox/models/transaction.rb +1 -1
- data/lib/templatefox/models/transactions_response.rb +1 -1
- data/lib/templatefox/models/update_version_request.rb +1 -1
- data/lib/templatefox/models/validation_error.rb +1 -1
- data/lib/templatefox/models/version_item.rb +1 -1
- data/lib/templatefox/models/versions_list_response.rb +1 -1
- data/lib/templatefox/version.rb +2 -2
- data/lib/templatefox.rb +14 -2
- data/spec/api/account_api_spec.rb +1 -1
- data/spec/api/image_api_spec.rb +47 -0
- data/spec/api/integrations_api_spec.rb +1 -1
- data/spec/api/pdf_api_spec.rb +1 -1
- data/spec/api/pdf_async_api_spec.rb +1 -1
- data/spec/api/pdf_tools_api_spec.rb +71 -0
- data/spec/api/templates_api_spec.rb +2 -1
- data/spec/models/account_info_response_spec.rb +1 -1
- data/spec/models/{app_routers_v1_pdf_export_type_spec.rb → app_routers_v1_delivery_export_type_spec.rb} +7 -7
- data/spec/models/app_routers_v1_pdf_async_export_type_spec.rb +1 -1
- data/spec/models/app_routers_v1_pdf_tools_export_type_spec.rb +30 -0
- data/spec/models/create_async_pdf_request_spec.rb +1 -1
- data/spec/models/create_async_pdf_response_spec.rb +1 -1
- data/spec/models/create_image_request_spec.rb +108 -0
- data/spec/models/create_image_response_spec.rb +60 -0
- data/spec/models/create_pdf_request_spec.rb +1 -1
- data/spec/models/create_pdf_response_spec.rb +1 -1
- data/spec/models/create_version_request_spec.rb +1 -1
- data/spec/models/extract_pdf_pages_request_spec.rb +66 -0
- data/spec/models/http_validation_error_spec.rb +1 -1
- data/spec/models/image_format_spec.rb +30 -0
- data/spec/models/job_list_response_spec.rb +1 -1
- data/spec/models/job_status_response_spec.rb +1 -1
- data/spec/models/job_status_spec.rb +1 -1
- data/spec/models/location_inner_spec.rb +1 -1
- data/spec/models/merge_pdf_request_spec.rb +54 -0
- data/spec/models/modification_spec.rb +66 -0
- data/spec/models/pdf_input_spec.rb +42 -0
- data/spec/models/pdf_tools_response_spec.rb +54 -0
- data/spec/models/pdf_variant_spec.rb +1 -1
- data/spec/models/rotate_pdf_request_spec.rb +72 -0
- data/spec/models/s3_config_request_spec.rb +1 -1
- data/spec/models/s3_config_response_spec.rb +1 -1
- data/spec/models/s3_success_response_spec.rb +1 -1
- data/spec/models/s3_test_response_spec.rb +1 -1
- data/spec/models/template_field_spec.rb +1 -1
- data/spec/models/template_field_spec_spec.rb +1 -1
- data/spec/models/template_list_item_spec.rb +7 -1
- data/spec/models/templates_list_response_spec.rb +1 -1
- data/spec/models/transaction_spec.rb +1 -1
- data/spec/models/transactions_response_spec.rb +1 -1
- data/spec/models/update_version_request_spec.rb +1 -1
- data/spec/models/validation_error_spec.rb +1 -1
- data/spec/models/version_item_spec.rb +1 -1
- data/spec/models/versions_list_response_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/templatefox.gemspec +1 -1
- metadata +61 -25
|
@@ -0,0 +1,284 @@
|
|
|
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
|
+
class MergePdfRequest < ApiModelBase
|
|
18
|
+
# `url` uploads to CDN and returns URL, `binary` returns raw PDF bytes
|
|
19
|
+
attr_accessor :export_type
|
|
20
|
+
|
|
21
|
+
# URL expiration in seconds. Min 60, max 604800. Only applies to `url` export type.
|
|
22
|
+
attr_accessor :expiration
|
|
23
|
+
|
|
24
|
+
attr_accessor :filename
|
|
25
|
+
|
|
26
|
+
# Ordered list of PDFs to merge. Each entry has either `pdf_url` or `pdf_base64`. Minimum 2.
|
|
27
|
+
attr_accessor :pdfs
|
|
28
|
+
|
|
29
|
+
class EnumAttributeValidator
|
|
30
|
+
attr_reader :datatype
|
|
31
|
+
attr_reader :allowable_values
|
|
32
|
+
|
|
33
|
+
def initialize(datatype, allowable_values)
|
|
34
|
+
@allowable_values = allowable_values.map do |value|
|
|
35
|
+
case datatype.to_s
|
|
36
|
+
when /Integer/i
|
|
37
|
+
value.to_i
|
|
38
|
+
when /Float/i
|
|
39
|
+
value.to_f
|
|
40
|
+
else
|
|
41
|
+
value
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def valid?(value)
|
|
47
|
+
!value || allowable_values.include?(value)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
52
|
+
def self.attribute_map
|
|
53
|
+
{
|
|
54
|
+
:'export_type' => :'export_type',
|
|
55
|
+
:'expiration' => :'expiration',
|
|
56
|
+
:'filename' => :'filename',
|
|
57
|
+
:'pdfs' => :'pdfs'
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Returns attribute mapping this model knows about
|
|
62
|
+
def self.acceptable_attribute_map
|
|
63
|
+
attribute_map
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Returns all the JSON keys this model knows about
|
|
67
|
+
def self.acceptable_attributes
|
|
68
|
+
acceptable_attribute_map.values
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Attribute type mapping.
|
|
72
|
+
def self.openapi_types
|
|
73
|
+
{
|
|
74
|
+
:'export_type' => :'AppRoutersV1PdfToolsExportType',
|
|
75
|
+
:'expiration' => :'Integer',
|
|
76
|
+
:'filename' => :'String',
|
|
77
|
+
:'pdfs' => :'Array<PdfInput>'
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# List of attributes with nullable: true
|
|
82
|
+
def self.openapi_nullable
|
|
83
|
+
Set.new([
|
|
84
|
+
:'filename',
|
|
85
|
+
])
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Initializes the object
|
|
89
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
90
|
+
def initialize(attributes = {})
|
|
91
|
+
if (!attributes.is_a?(Hash))
|
|
92
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TemplateFox::MergePdfRequest` initialize method"
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
96
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
97
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
98
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
99
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TemplateFox::MergePdfRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
100
|
+
end
|
|
101
|
+
h[k.to_sym] = v
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'export_type')
|
|
105
|
+
self.export_type = attributes[:'export_type']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'expiration')
|
|
109
|
+
self.expiration = attributes[:'expiration']
|
|
110
|
+
else
|
|
111
|
+
self.expiration = 86400
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'filename')
|
|
115
|
+
self.filename = attributes[:'filename']
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'pdfs')
|
|
119
|
+
if (value = attributes[:'pdfs']).is_a?(Array)
|
|
120
|
+
self.pdfs = value
|
|
121
|
+
end
|
|
122
|
+
else
|
|
123
|
+
self.pdfs = nil
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
128
|
+
# @return Array for valid properties with the reasons
|
|
129
|
+
def list_invalid_properties
|
|
130
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
131
|
+
invalid_properties = Array.new
|
|
132
|
+
if !@expiration.nil? && @expiration > 604800
|
|
133
|
+
invalid_properties.push('invalid value for "expiration", must be smaller than or equal to 604800.')
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if !@expiration.nil? && @expiration < 60
|
|
137
|
+
invalid_properties.push('invalid value for "expiration", must be greater than or equal to 60.')
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if !@filename.nil? && @filename.to_s.length > 100
|
|
141
|
+
invalid_properties.push('invalid value for "filename", the character length must be smaller than or equal to 100.')
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
pattern = Regexp.new(/^[a-zA-Z0-9_\-\.]+$/)
|
|
145
|
+
if !@filename.nil? && @filename !~ pattern
|
|
146
|
+
invalid_properties.push("invalid value for \"filename\", must conform to the pattern #{pattern}.")
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if @pdfs.nil?
|
|
150
|
+
invalid_properties.push('invalid value for "pdfs", pdfs cannot be nil.')
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if @pdfs.length < 2
|
|
154
|
+
invalid_properties.push('invalid value for "pdfs", number of items must be greater than or equal to 2.')
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
invalid_properties
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Check to see if the all the properties in the model are valid
|
|
161
|
+
# @return true if the model is valid
|
|
162
|
+
def valid?
|
|
163
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
164
|
+
return false if !@expiration.nil? && @expiration > 604800
|
|
165
|
+
return false if !@expiration.nil? && @expiration < 60
|
|
166
|
+
return false if !@filename.nil? && @filename.to_s.length > 100
|
|
167
|
+
return false if !@filename.nil? && @filename !~ Regexp.new(/^[a-zA-Z0-9_\-\.]+$/)
|
|
168
|
+
return false if @pdfs.nil?
|
|
169
|
+
return false if @pdfs.length < 2
|
|
170
|
+
true
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Custom attribute writer method with validation
|
|
174
|
+
# @param [Object] expiration Value to be assigned
|
|
175
|
+
def expiration=(expiration)
|
|
176
|
+
if expiration.nil?
|
|
177
|
+
fail ArgumentError, 'expiration cannot be nil'
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
if expiration > 604800
|
|
181
|
+
fail ArgumentError, 'invalid value for "expiration", must be smaller than or equal to 604800.'
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
if expiration < 60
|
|
185
|
+
fail ArgumentError, 'invalid value for "expiration", must be greater than or equal to 60.'
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
@expiration = expiration
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Custom attribute writer method with validation
|
|
192
|
+
# @param [Object] filename Value to be assigned
|
|
193
|
+
def filename=(filename)
|
|
194
|
+
if !filename.nil? && filename.to_s.length > 100
|
|
195
|
+
fail ArgumentError, 'invalid value for "filename", the character length must be smaller than or equal to 100.'
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
pattern = Regexp.new(/^[a-zA-Z0-9_\-\.]+$/)
|
|
199
|
+
if !filename.nil? && filename !~ pattern
|
|
200
|
+
fail ArgumentError, "invalid value for \"filename\", must conform to the pattern #{pattern}."
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
@filename = filename
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Custom attribute writer method with validation
|
|
207
|
+
# @param [Object] pdfs Value to be assigned
|
|
208
|
+
def pdfs=(pdfs)
|
|
209
|
+
if pdfs.nil?
|
|
210
|
+
fail ArgumentError, 'pdfs cannot be nil'
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
if pdfs.length < 2
|
|
214
|
+
fail ArgumentError, 'invalid value for "pdfs", number of items must be greater than or equal to 2.'
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
@pdfs = pdfs
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Checks equality by comparing each attribute.
|
|
221
|
+
# @param [Object] Object to be compared
|
|
222
|
+
def ==(o)
|
|
223
|
+
return true if self.equal?(o)
|
|
224
|
+
self.class == o.class &&
|
|
225
|
+
export_type == o.export_type &&
|
|
226
|
+
expiration == o.expiration &&
|
|
227
|
+
filename == o.filename &&
|
|
228
|
+
pdfs == o.pdfs
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# @see the `==` method
|
|
232
|
+
# @param [Object] Object to be compared
|
|
233
|
+
def eql?(o)
|
|
234
|
+
self == o
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Calculates hash code according to all attributes.
|
|
238
|
+
# @return [Integer] Hash code
|
|
239
|
+
def hash
|
|
240
|
+
[export_type, expiration, filename, pdfs].hash
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Builds the object from hash
|
|
244
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
245
|
+
# @return [Object] Returns the model itself
|
|
246
|
+
def self.build_from_hash(attributes)
|
|
247
|
+
return nil unless attributes.is_a?(Hash)
|
|
248
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
249
|
+
transformed_hash = {}
|
|
250
|
+
openapi_types.each_pair do |key, type|
|
|
251
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
252
|
+
transformed_hash["#{key}"] = nil
|
|
253
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
254
|
+
# check to ensure the input is an array given that the attribute
|
|
255
|
+
# is documented as an array but the input is not
|
|
256
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
257
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
258
|
+
end
|
|
259
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
260
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
new(transformed_hash)
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Returns the object in the form of hash
|
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
|
268
|
+
def to_hash
|
|
269
|
+
hash = {}
|
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
271
|
+
value = self.send(attr)
|
|
272
|
+
if value.nil?
|
|
273
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
274
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
hash[param] = _to_hash(value)
|
|
278
|
+
end
|
|
279
|
+
hash
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
end
|
|
@@ -0,0 +1,305 @@
|
|
|
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
|
+
# A single element modification, addressed by layer name.
|
|
18
|
+
class Modification < ApiModelBase
|
|
19
|
+
# Name of the layer to modify (set via the editor's Layers panel). Matched against the element's `data-layer-name`, falling back to its `id`.
|
|
20
|
+
attr_accessor :name
|
|
21
|
+
|
|
22
|
+
attr_accessor :text
|
|
23
|
+
|
|
24
|
+
attr_accessor :image_url
|
|
25
|
+
|
|
26
|
+
attr_accessor :color
|
|
27
|
+
|
|
28
|
+
attr_accessor :background
|
|
29
|
+
|
|
30
|
+
attr_accessor :hidden
|
|
31
|
+
|
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
33
|
+
def self.attribute_map
|
|
34
|
+
{
|
|
35
|
+
:'name' => :'name',
|
|
36
|
+
:'text' => :'text',
|
|
37
|
+
:'image_url' => :'image_url',
|
|
38
|
+
:'color' => :'color',
|
|
39
|
+
:'background' => :'background',
|
|
40
|
+
:'hidden' => :'hidden'
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Returns attribute mapping this model knows about
|
|
45
|
+
def self.acceptable_attribute_map
|
|
46
|
+
attribute_map
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Returns all the JSON keys this model knows about
|
|
50
|
+
def self.acceptable_attributes
|
|
51
|
+
acceptable_attribute_map.values
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Attribute type mapping.
|
|
55
|
+
def self.openapi_types
|
|
56
|
+
{
|
|
57
|
+
:'name' => :'String',
|
|
58
|
+
:'text' => :'String',
|
|
59
|
+
:'image_url' => :'String',
|
|
60
|
+
:'color' => :'String',
|
|
61
|
+
:'background' => :'String',
|
|
62
|
+
:'hidden' => :'Boolean'
|
|
63
|
+
}
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# List of attributes with nullable: true
|
|
67
|
+
def self.openapi_nullable
|
|
68
|
+
Set.new([
|
|
69
|
+
:'text',
|
|
70
|
+
:'image_url',
|
|
71
|
+
:'color',
|
|
72
|
+
:'background',
|
|
73
|
+
:'hidden'
|
|
74
|
+
])
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Initializes the object
|
|
78
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
79
|
+
def initialize(attributes = {})
|
|
80
|
+
if (!attributes.is_a?(Hash))
|
|
81
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TemplateFox::Modification` initialize method"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
85
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
86
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
87
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
88
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TemplateFox::Modification`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
89
|
+
end
|
|
90
|
+
h[k.to_sym] = v
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if attributes.key?(:'name')
|
|
94
|
+
self.name = attributes[:'name']
|
|
95
|
+
else
|
|
96
|
+
self.name = nil
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if attributes.key?(:'text')
|
|
100
|
+
self.text = attributes[:'text']
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if attributes.key?(:'image_url')
|
|
104
|
+
self.image_url = attributes[:'image_url']
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
if attributes.key?(:'color')
|
|
108
|
+
self.color = attributes[:'color']
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'background')
|
|
112
|
+
self.background = attributes[:'background']
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'hidden')
|
|
116
|
+
self.hidden = attributes[:'hidden']
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
121
|
+
# @return Array for valid properties with the reasons
|
|
122
|
+
def list_invalid_properties
|
|
123
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
124
|
+
invalid_properties = Array.new
|
|
125
|
+
if @name.nil?
|
|
126
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if @name.to_s.length > 200
|
|
130
|
+
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 200.')
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if @name.to_s.length < 1
|
|
134
|
+
invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.')
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if !@text.nil? && @text.to_s.length > 10000
|
|
138
|
+
invalid_properties.push('invalid value for "text", the character length must be smaller than or equal to 10000.')
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if !@image_url.nil? && @image_url.to_s.length > 2000
|
|
142
|
+
invalid_properties.push('invalid value for "image_url", the character length must be smaller than or equal to 2000.')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
pattern = Regexp.new(/^https?:\/\//)
|
|
146
|
+
if !@image_url.nil? && @image_url !~ pattern
|
|
147
|
+
invalid_properties.push("invalid value for \"image_url\", must conform to the pattern #{pattern}.")
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if !@color.nil? && @color.to_s.length > 100
|
|
151
|
+
invalid_properties.push('invalid value for "color", the character length must be smaller than or equal to 100.')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if !@background.nil? && @background.to_s.length > 100
|
|
155
|
+
invalid_properties.push('invalid value for "background", the character length must be smaller than or equal to 100.')
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
invalid_properties
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Check to see if the all the properties in the model are valid
|
|
162
|
+
# @return true if the model is valid
|
|
163
|
+
def valid?
|
|
164
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
165
|
+
return false if @name.nil?
|
|
166
|
+
return false if @name.to_s.length > 200
|
|
167
|
+
return false if @name.to_s.length < 1
|
|
168
|
+
return false if !@text.nil? && @text.to_s.length > 10000
|
|
169
|
+
return false if !@image_url.nil? && @image_url.to_s.length > 2000
|
|
170
|
+
return false if !@image_url.nil? && @image_url !~ Regexp.new(/^https?:\/\//)
|
|
171
|
+
return false if !@color.nil? && @color.to_s.length > 100
|
|
172
|
+
return false if !@background.nil? && @background.to_s.length > 100
|
|
173
|
+
true
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Custom attribute writer method with validation
|
|
177
|
+
# @param [Object] name Value to be assigned
|
|
178
|
+
def name=(name)
|
|
179
|
+
if name.nil?
|
|
180
|
+
fail ArgumentError, 'name cannot be nil'
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
if name.to_s.length > 200
|
|
184
|
+
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 200.'
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if name.to_s.length < 1
|
|
188
|
+
fail ArgumentError, 'invalid value for "name", the character length must be greater than or equal to 1.'
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
@name = name
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Custom attribute writer method with validation
|
|
195
|
+
# @param [Object] text Value to be assigned
|
|
196
|
+
def text=(text)
|
|
197
|
+
if !text.nil? && text.to_s.length > 10000
|
|
198
|
+
fail ArgumentError, 'invalid value for "text", the character length must be smaller than or equal to 10000.'
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
@text = text
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Custom attribute writer method with validation
|
|
205
|
+
# @param [Object] image_url Value to be assigned
|
|
206
|
+
def image_url=(image_url)
|
|
207
|
+
if !image_url.nil? && image_url.to_s.length > 2000
|
|
208
|
+
fail ArgumentError, 'invalid value for "image_url", the character length must be smaller than or equal to 2000.'
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
pattern = Regexp.new(/^https?:\/\//)
|
|
212
|
+
if !image_url.nil? && image_url !~ pattern
|
|
213
|
+
fail ArgumentError, "invalid value for \"image_url\", must conform to the pattern #{pattern}."
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
@image_url = image_url
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Custom attribute writer method with validation
|
|
220
|
+
# @param [Object] color Value to be assigned
|
|
221
|
+
def color=(color)
|
|
222
|
+
if !color.nil? && color.to_s.length > 100
|
|
223
|
+
fail ArgumentError, 'invalid value for "color", the character length must be smaller than or equal to 100.'
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
@color = color
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Custom attribute writer method with validation
|
|
230
|
+
# @param [Object] background Value to be assigned
|
|
231
|
+
def background=(background)
|
|
232
|
+
if !background.nil? && background.to_s.length > 100
|
|
233
|
+
fail ArgumentError, 'invalid value for "background", the character length must be smaller than or equal to 100.'
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
@background = background
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Checks equality by comparing each attribute.
|
|
240
|
+
# @param [Object] Object to be compared
|
|
241
|
+
def ==(o)
|
|
242
|
+
return true if self.equal?(o)
|
|
243
|
+
self.class == o.class &&
|
|
244
|
+
name == o.name &&
|
|
245
|
+
text == o.text &&
|
|
246
|
+
image_url == o.image_url &&
|
|
247
|
+
color == o.color &&
|
|
248
|
+
background == o.background &&
|
|
249
|
+
hidden == o.hidden
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# @see the `==` method
|
|
253
|
+
# @param [Object] Object to be compared
|
|
254
|
+
def eql?(o)
|
|
255
|
+
self == o
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Calculates hash code according to all attributes.
|
|
259
|
+
# @return [Integer] Hash code
|
|
260
|
+
def hash
|
|
261
|
+
[name, text, image_url, color, background, hidden].hash
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Builds the object from hash
|
|
265
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
266
|
+
# @return [Object] Returns the model itself
|
|
267
|
+
def self.build_from_hash(attributes)
|
|
268
|
+
return nil unless attributes.is_a?(Hash)
|
|
269
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
270
|
+
transformed_hash = {}
|
|
271
|
+
openapi_types.each_pair do |key, type|
|
|
272
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
273
|
+
transformed_hash["#{key}"] = nil
|
|
274
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
275
|
+
# check to ensure the input is an array given that the attribute
|
|
276
|
+
# is documented as an array but the input is not
|
|
277
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
278
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
279
|
+
end
|
|
280
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
281
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
new(transformed_hash)
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Returns the object in the form of hash
|
|
288
|
+
# @return [Hash] Returns the object in the form of hash
|
|
289
|
+
def to_hash
|
|
290
|
+
hash = {}
|
|
291
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
292
|
+
value = self.send(attr)
|
|
293
|
+
if value.nil?
|
|
294
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
295
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
hash[param] = _to_hash(value)
|
|
299
|
+
end
|
|
300
|
+
hash
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
end
|