templatefox 1.10.0 → 1.12.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 (104) 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 +72 -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_layer.rb +259 -0
  44. data/lib/templatefox/models/template_layers_response.rb +179 -0
  45. data/lib/templatefox/models/template_list_item.rb +14 -2
  46. data/lib/templatefox/models/templates_list_response.rb +1 -1
  47. data/lib/templatefox/models/transaction.rb +1 -1
  48. data/lib/templatefox/models/transactions_response.rb +1 -1
  49. data/lib/templatefox/models/update_version_request.rb +1 -1
  50. data/lib/templatefox/models/validation_error.rb +1 -1
  51. data/lib/templatefox/models/version_item.rb +1 -1
  52. data/lib/templatefox/models/versions_list_response.rb +1 -1
  53. data/lib/templatefox/version.rb +2 -2
  54. data/lib/templatefox.rb +9 -2
  55. data/spec/api/account_api_spec.rb +1 -1
  56. data/spec/api/image_api_spec.rb +47 -0
  57. data/spec/api/integrations_api_spec.rb +1 -1
  58. data/spec/api/pdf_api_spec.rb +1 -1
  59. data/spec/api/pdf_async_api_spec.rb +1 -1
  60. data/spec/api/pdf_tools_api_spec.rb +1 -1
  61. data/spec/api/templates_api_spec.rb +14 -1
  62. data/spec/models/account_info_response_spec.rb +1 -1
  63. data/spec/models/{app_routers_v1_pdf_export_type_spec.rb → app_routers_v1_delivery_export_type_spec.rb} +7 -7
  64. data/spec/models/app_routers_v1_pdf_async_export_type_spec.rb +1 -1
  65. data/spec/models/app_routers_v1_pdf_tools_export_type_spec.rb +1 -1
  66. data/spec/models/create_async_pdf_request_spec.rb +1 -1
  67. data/spec/models/create_async_pdf_response_spec.rb +1 -1
  68. data/spec/models/create_image_request_spec.rb +108 -0
  69. data/spec/models/create_image_response_spec.rb +60 -0
  70. data/spec/models/create_pdf_request_spec.rb +1 -1
  71. data/spec/models/create_pdf_response_spec.rb +1 -1
  72. data/spec/models/create_version_request_spec.rb +1 -1
  73. data/spec/models/extract_pdf_pages_request_spec.rb +1 -1
  74. data/spec/models/http_validation_error_spec.rb +1 -1
  75. data/spec/models/image_format_spec.rb +30 -0
  76. data/spec/models/job_list_response_spec.rb +1 -1
  77. data/spec/models/job_status_response_spec.rb +1 -1
  78. data/spec/models/job_status_spec.rb +1 -1
  79. data/spec/models/location_inner_spec.rb +1 -1
  80. data/spec/models/merge_pdf_request_spec.rb +1 -1
  81. data/spec/models/modification_spec.rb +66 -0
  82. data/spec/models/pdf_input_spec.rb +1 -1
  83. data/spec/models/pdf_tools_response_spec.rb +1 -1
  84. data/spec/models/pdf_variant_spec.rb +1 -1
  85. data/spec/models/rotate_pdf_request_spec.rb +1 -1
  86. data/spec/models/s3_config_request_spec.rb +1 -1
  87. data/spec/models/s3_config_response_spec.rb +1 -1
  88. data/spec/models/s3_success_response_spec.rb +1 -1
  89. data/spec/models/s3_test_response_spec.rb +1 -1
  90. data/spec/models/template_field_spec.rb +1 -1
  91. data/spec/models/template_field_spec_spec.rb +1 -1
  92. data/spec/models/template_layer_spec.rb +60 -0
  93. data/spec/models/template_layers_response_spec.rb +42 -0
  94. data/spec/models/template_list_item_spec.rb +7 -1
  95. data/spec/models/templates_list_response_spec.rb +1 -1
  96. data/spec/models/transaction_spec.rb +1 -1
  97. data/spec/models/transactions_response_spec.rb +1 -1
  98. data/spec/models/update_version_request_spec.rb +1 -1
  99. data/spec/models/validation_error_spec.rb +1 -1
  100. data/spec/models/version_item_spec.rb +1 -1
  101. data/spec/models/versions_list_response_spec.rb +1 -1
  102. data/spec/spec_helper.rb +1 -1
  103. data/templatefox.gemspec +1 -1
  104. metadata +53 -32
@@ -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.12.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
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate beautiful PDFs from HTML/CSS templates with Jinja2 via API. Design once, generate thousands.
5
5
 
6
- The version of the OpenAPI document: 1.10.0
6
+ The version of the OpenAPI document: 1.12.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.21.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate beautiful PDFs from HTML/CSS templates with Jinja2 via API. Design once, generate thousands.
5
5
 
6
- The version of the OpenAPI document: 1.10.0
6
+ The version of the OpenAPI document: 1.12.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.21.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate beautiful PDFs from HTML/CSS templates with Jinja2 via API. Design once, generate thousands.
5
5
 
6
- The version of the OpenAPI document: 1.10.0
6
+ The version of the OpenAPI document: 1.12.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.21.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate beautiful PDFs from HTML/CSS templates with Jinja2 via API. Design once, generate thousands.
5
5
 
6
- The version of the OpenAPI document: 1.10.0
6
+ The version of the OpenAPI document: 1.12.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.21.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate beautiful PDFs from HTML/CSS templates with Jinja2 via API. Design once, generate thousands.
5
5
 
6
- The version of the OpenAPI document: 1.10.0
6
+ The version of the OpenAPI document: 1.12.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.21.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate beautiful PDFs from HTML/CSS templates with Jinja2 via API. Design once, generate thousands.
5
5
 
6
- The version of the OpenAPI document: 1.10.0
6
+ The version of the OpenAPI document: 1.12.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.21.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate beautiful PDFs from HTML/CSS templates with Jinja2 via API. Design once, generate thousands.
5
5
 
6
- The version of the OpenAPI document: 1.10.0
6
+ The version of the OpenAPI document: 1.12.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.21.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate beautiful PDFs from HTML/CSS templates with Jinja2 via API. Design once, generate thousands.
5
5
 
6
- The version of the OpenAPI document: 1.10.0
6
+ The version of the OpenAPI document: 1.12.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.21.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate beautiful PDFs from HTML/CSS templates with Jinja2 via API. Design once, generate thousands.
5
5
 
6
- The version of the OpenAPI document: 1.10.0
6
+ The version of the OpenAPI document: 1.12.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.21.0
@@ -3,7 +3,7 @@
3
3
 
4
4
  #Generate beautiful PDFs from HTML/CSS templates with Jinja2 via API. Design once, generate thousands.
5
5
 
6
- The version of the OpenAPI document: 1.10.0
6
+ The version of the OpenAPI document: 1.12.0
7
7
 
8
8
  Generated by: https://openapi-generator.tech
9
9
  Generator version: 7.21.0
@@ -0,0 +1,259 @@
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.12.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
+ # An addressable layer of a template (modifications API)
18
+ class TemplateLayer < ApiModelBase
19
+ # Layer name — the value to use in `modifications[].name`
20
+ attr_accessor :name
21
+
22
+ # HTML tag of the element
23
+ attr_accessor :tag
24
+
25
+ # Layer type: `background`, `image`, `text` or `shape`
26
+ attr_accessor :type
27
+
28
+ attr_accessor :current_text
29
+
30
+ # Modification fields that apply to this layer
31
+ attr_accessor :modifiable
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'name' => :'name',
37
+ :'tag' => :'tag',
38
+ :'type' => :'type',
39
+ :'current_text' => :'current_text',
40
+ :'modifiable' => :'modifiable'
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
+ :'tag' => :'String',
59
+ :'type' => :'String',
60
+ :'current_text' => :'String',
61
+ :'modifiable' => :'Array<String>'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ :'current_text',
69
+ ])
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ if (!attributes.is_a?(Hash))
76
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TemplateFox::TemplateLayer` initialize method"
77
+ end
78
+
79
+ # check to see if the attribute exists and convert string to symbol for hash key
80
+ acceptable_attribute_map = self.class.acceptable_attribute_map
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!acceptable_attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TemplateFox::TemplateLayer`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'name')
89
+ self.name = attributes[:'name']
90
+ else
91
+ self.name = nil
92
+ end
93
+
94
+ if attributes.key?(:'tag')
95
+ self.tag = attributes[:'tag']
96
+ else
97
+ self.tag = nil
98
+ end
99
+
100
+ if attributes.key?(:'type')
101
+ self.type = attributes[:'type']
102
+ else
103
+ self.type = nil
104
+ end
105
+
106
+ if attributes.key?(:'current_text')
107
+ self.current_text = attributes[:'current_text']
108
+ end
109
+
110
+ if attributes.key?(:'modifiable')
111
+ if (value = attributes[:'modifiable']).is_a?(Array)
112
+ self.modifiable = value
113
+ end
114
+ else
115
+ self.modifiable = nil
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
123
+ invalid_properties = Array.new
124
+ if @name.nil?
125
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
126
+ end
127
+
128
+ if @tag.nil?
129
+ invalid_properties.push('invalid value for "tag", tag cannot be nil.')
130
+ end
131
+
132
+ if @type.nil?
133
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
134
+ end
135
+
136
+ if @modifiable.nil?
137
+ invalid_properties.push('invalid value for "modifiable", modifiable cannot be nil.')
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ warn '[DEPRECATED] the `valid?` method is obsolete'
147
+ return false if @name.nil?
148
+ return false if @tag.nil?
149
+ return false if @type.nil?
150
+ return false if @modifiable.nil?
151
+ true
152
+ end
153
+
154
+ # Custom attribute writer method with validation
155
+ # @param [Object] name Value to be assigned
156
+ def name=(name)
157
+ if name.nil?
158
+ fail ArgumentError, 'name cannot be nil'
159
+ end
160
+
161
+ @name = name
162
+ end
163
+
164
+ # Custom attribute writer method with validation
165
+ # @param [Object] tag Value to be assigned
166
+ def tag=(tag)
167
+ if tag.nil?
168
+ fail ArgumentError, 'tag cannot be nil'
169
+ end
170
+
171
+ @tag = tag
172
+ end
173
+
174
+ # Custom attribute writer method with validation
175
+ # @param [Object] type Value to be assigned
176
+ def type=(type)
177
+ if type.nil?
178
+ fail ArgumentError, 'type cannot be nil'
179
+ end
180
+
181
+ @type = type
182
+ end
183
+
184
+ # Custom attribute writer method with validation
185
+ # @param [Object] modifiable Value to be assigned
186
+ def modifiable=(modifiable)
187
+ if modifiable.nil?
188
+ fail ArgumentError, 'modifiable cannot be nil'
189
+ end
190
+
191
+ @modifiable = modifiable
192
+ end
193
+
194
+ # Checks equality by comparing each attribute.
195
+ # @param [Object] Object to be compared
196
+ def ==(o)
197
+ return true if self.equal?(o)
198
+ self.class == o.class &&
199
+ name == o.name &&
200
+ tag == o.tag &&
201
+ type == o.type &&
202
+ current_text == o.current_text &&
203
+ modifiable == o.modifiable
204
+ end
205
+
206
+ # @see the `==` method
207
+ # @param [Object] Object to be compared
208
+ def eql?(o)
209
+ self == o
210
+ end
211
+
212
+ # Calculates hash code according to all attributes.
213
+ # @return [Integer] Hash code
214
+ def hash
215
+ [name, tag, type, current_text, modifiable].hash
216
+ end
217
+
218
+ # Builds the object from hash
219
+ # @param [Hash] attributes Model attributes in the form of hash
220
+ # @return [Object] Returns the model itself
221
+ def self.build_from_hash(attributes)
222
+ return nil unless attributes.is_a?(Hash)
223
+ attributes = attributes.transform_keys(&:to_sym)
224
+ transformed_hash = {}
225
+ openapi_types.each_pair do |key, type|
226
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
227
+ transformed_hash["#{key}"] = nil
228
+ elsif type =~ /\AArray<(.*)>/i
229
+ # check to ensure the input is an array given that the attribute
230
+ # is documented as an array but the input is not
231
+ if attributes[attribute_map[key]].is_a?(Array)
232
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
233
+ end
234
+ elsif !attributes[attribute_map[key]].nil?
235
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
236
+ end
237
+ end
238
+ new(transformed_hash)
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ self.class.attribute_map.each_pair do |attr, param|
246
+ value = self.send(attr)
247
+ if value.nil?
248
+ is_nullable = self.class.openapi_nullable.include?(attr)
249
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
250
+ end
251
+
252
+ hash[param] = _to_hash(value)
253
+ end
254
+ hash
255
+ end
256
+
257
+ end
258
+
259
+ end