aspose_pdf_cloud 19.10.0 → 19.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -4
- data/docs/ComboBoxField.md +32 -0
- data/docs/ComboBoxFieldResponse.md +11 -0
- data/docs/ComboBoxFields.md +10 -0
- data/docs/ComboBoxFieldsResponse.md +11 -0
- data/docs/PdfApi.md +130 -0
- data/lib/aspose_pdf_cloud.rb +4 -0
- data/lib/aspose_pdf_cloud/api/pdf_api.rb +388 -0
- data/lib/aspose_pdf_cloud/models/combo_box_field.rb +450 -0
- data/lib/aspose_pdf_cloud/models/combo_box_field_response.rb +224 -0
- data/lib/aspose_pdf_cloud/models/combo_box_fields.rb +213 -0
- data/lib/aspose_pdf_cloud/models/combo_box_fields_response.rb +224 -0
- data/lib/aspose_pdf_cloud/version.rb +1 -1
- data/test/pdf_tests.rb +103 -1
- metadata +10 -2
@@ -0,0 +1,450 @@
|
|
1
|
+
=begin
|
2
|
+
--------------------------------------------------------------------------------------------------------------------
|
3
|
+
Copyright (c) 2019 Aspose.PDF Cloud
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
18
|
+
SOFTWARE.
|
19
|
+
--------------------------------------------------------------------------------------------------------------------
|
20
|
+
=end
|
21
|
+
|
22
|
+
require 'date'
|
23
|
+
require 'time'
|
24
|
+
|
25
|
+
module AsposePdfCloud
|
26
|
+
# Provides ComboBoxField.
|
27
|
+
class ComboBoxField
|
28
|
+
# Link to the document.
|
29
|
+
attr_accessor :links
|
30
|
+
|
31
|
+
# Field name.
|
32
|
+
attr_accessor :partial_name
|
33
|
+
|
34
|
+
# Field rectangle.
|
35
|
+
attr_accessor :rect
|
36
|
+
|
37
|
+
# Field value.
|
38
|
+
attr_accessor :value
|
39
|
+
|
40
|
+
# Page index.
|
41
|
+
attr_accessor :page_index
|
42
|
+
|
43
|
+
# Gets or sets height of the field.
|
44
|
+
attr_accessor :height
|
45
|
+
|
46
|
+
# Gets or sets width of the field.
|
47
|
+
attr_accessor :width
|
48
|
+
|
49
|
+
# Z index.
|
50
|
+
attr_accessor :z_index
|
51
|
+
|
52
|
+
# Is group.
|
53
|
+
attr_accessor :is_group
|
54
|
+
|
55
|
+
# Gets field parent.
|
56
|
+
attr_accessor :parent
|
57
|
+
|
58
|
+
# Property for Generator support. Used when field is added to header or footer. If true, this field will created once and it's appearance will be visible on all pages of the document. If false, separated field will be created for every document page.
|
59
|
+
attr_accessor :is_shared_field
|
60
|
+
|
61
|
+
# Gets Flags of the field.
|
62
|
+
attr_accessor :flags
|
63
|
+
|
64
|
+
# Color of the annotation.
|
65
|
+
attr_accessor :color
|
66
|
+
|
67
|
+
# Get the field content.
|
68
|
+
attr_accessor :contents
|
69
|
+
|
70
|
+
# Gets or sets a outer margin for paragraph (for pdf generation)
|
71
|
+
attr_accessor :margin
|
72
|
+
|
73
|
+
# Field highlighting mode.
|
74
|
+
attr_accessor :highlighting
|
75
|
+
|
76
|
+
# Gets HorizontalAlignment of the field.
|
77
|
+
attr_accessor :horizontal_alignment
|
78
|
+
|
79
|
+
# Gets VerticalAlignment of the field.
|
80
|
+
attr_accessor :vertical_alignment
|
81
|
+
|
82
|
+
# Gets or sets multiselection flag.
|
83
|
+
attr_accessor :multi_select
|
84
|
+
|
85
|
+
# Gets collection of options of the combobox.
|
86
|
+
attr_accessor :options
|
87
|
+
|
88
|
+
# Gets or sets current annotation appearance state.
|
89
|
+
attr_accessor :active_state
|
90
|
+
|
91
|
+
# Gets or sets editable status of the field.
|
92
|
+
attr_accessor :editable
|
93
|
+
|
94
|
+
# Gets or sets spellchaeck activiity status.
|
95
|
+
attr_accessor :spell_check
|
96
|
+
|
97
|
+
# Gets or sets index of selected item. Numbering of items is started from 1.
|
98
|
+
attr_accessor :selected
|
99
|
+
|
100
|
+
|
101
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
102
|
+
def self.attribute_map
|
103
|
+
{
|
104
|
+
:'links' => :'Links',
|
105
|
+
:'partial_name' => :'PartialName',
|
106
|
+
:'rect' => :'Rect',
|
107
|
+
:'value' => :'Value',
|
108
|
+
:'page_index' => :'PageIndex',
|
109
|
+
:'height' => :'Height',
|
110
|
+
:'width' => :'Width',
|
111
|
+
:'z_index' => :'ZIndex',
|
112
|
+
:'is_group' => :'IsGroup',
|
113
|
+
:'parent' => :'Parent',
|
114
|
+
:'is_shared_field' => :'IsSharedField',
|
115
|
+
:'flags' => :'Flags',
|
116
|
+
:'color' => :'Color',
|
117
|
+
:'contents' => :'Contents',
|
118
|
+
:'margin' => :'Margin',
|
119
|
+
:'highlighting' => :'Highlighting',
|
120
|
+
:'horizontal_alignment' => :'HorizontalAlignment',
|
121
|
+
:'vertical_alignment' => :'VerticalAlignment',
|
122
|
+
:'multi_select' => :'MultiSelect',
|
123
|
+
:'options' => :'Options',
|
124
|
+
:'active_state' => :'ActiveState',
|
125
|
+
:'editable' => :'Editable',
|
126
|
+
:'spell_check' => :'SpellCheck',
|
127
|
+
:'selected' => :'Selected'
|
128
|
+
}
|
129
|
+
end
|
130
|
+
|
131
|
+
# Attribute type mapping.
|
132
|
+
def self.swagger_types
|
133
|
+
{
|
134
|
+
:'links' => :'Array<Link>',
|
135
|
+
:'partial_name' => :'String',
|
136
|
+
:'rect' => :'Rectangle',
|
137
|
+
:'value' => :'String',
|
138
|
+
:'page_index' => :'Integer',
|
139
|
+
:'height' => :'Float',
|
140
|
+
:'width' => :'Float',
|
141
|
+
:'z_index' => :'Integer',
|
142
|
+
:'is_group' => :'BOOLEAN',
|
143
|
+
:'parent' => :'FormField',
|
144
|
+
:'is_shared_field' => :'BOOLEAN',
|
145
|
+
:'flags' => :'Array<AnnotationFlags>',
|
146
|
+
:'color' => :'Color',
|
147
|
+
:'contents' => :'String',
|
148
|
+
:'margin' => :'MarginInfo',
|
149
|
+
:'highlighting' => :'LinkHighlightingMode',
|
150
|
+
:'horizontal_alignment' => :'HorizontalAlignment',
|
151
|
+
:'vertical_alignment' => :'VerticalAlignment',
|
152
|
+
:'multi_select' => :'BOOLEAN',
|
153
|
+
:'options' => :'Array<Option>',
|
154
|
+
:'active_state' => :'String',
|
155
|
+
:'editable' => :'BOOLEAN',
|
156
|
+
:'spell_check' => :'BOOLEAN',
|
157
|
+
:'selected' => :'Integer'
|
158
|
+
}
|
159
|
+
end
|
160
|
+
|
161
|
+
# Initializes the object
|
162
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
163
|
+
def initialize(attributes = {})
|
164
|
+
return unless attributes.is_a?(Hash)
|
165
|
+
|
166
|
+
# convert string to symbol for hash key
|
167
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
168
|
+
|
169
|
+
if attributes.has_key?(:'Links')
|
170
|
+
if (value = attributes[:'Links']).is_a?(Array)
|
171
|
+
self.links = value
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
if attributes.has_key?(:'PartialName')
|
176
|
+
self.partial_name = attributes[:'PartialName']
|
177
|
+
end
|
178
|
+
|
179
|
+
if attributes.has_key?(:'Rect')
|
180
|
+
self.rect = attributes[:'Rect']
|
181
|
+
end
|
182
|
+
|
183
|
+
if attributes.has_key?(:'Value')
|
184
|
+
self.value = attributes[:'Value']
|
185
|
+
end
|
186
|
+
|
187
|
+
if attributes.has_key?(:'PageIndex')
|
188
|
+
self.page_index = attributes[:'PageIndex']
|
189
|
+
end
|
190
|
+
|
191
|
+
if attributes.has_key?(:'Height')
|
192
|
+
self.height = attributes[:'Height']
|
193
|
+
end
|
194
|
+
|
195
|
+
if attributes.has_key?(:'Width')
|
196
|
+
self.width = attributes[:'Width']
|
197
|
+
end
|
198
|
+
|
199
|
+
if attributes.has_key?(:'ZIndex')
|
200
|
+
self.z_index = attributes[:'ZIndex']
|
201
|
+
end
|
202
|
+
|
203
|
+
if attributes.has_key?(:'IsGroup')
|
204
|
+
self.is_group = attributes[:'IsGroup']
|
205
|
+
end
|
206
|
+
|
207
|
+
if attributes.has_key?(:'Parent')
|
208
|
+
self.parent = attributes[:'Parent']
|
209
|
+
end
|
210
|
+
|
211
|
+
if attributes.has_key?(:'IsSharedField')
|
212
|
+
self.is_shared_field = attributes[:'IsSharedField']
|
213
|
+
end
|
214
|
+
|
215
|
+
if attributes.has_key?(:'Flags')
|
216
|
+
if (value = attributes[:'Flags']).is_a?(Array)
|
217
|
+
self.flags = value
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
if attributes.has_key?(:'Color')
|
222
|
+
self.color = attributes[:'Color']
|
223
|
+
end
|
224
|
+
|
225
|
+
if attributes.has_key?(:'Contents')
|
226
|
+
self.contents = attributes[:'Contents']
|
227
|
+
end
|
228
|
+
|
229
|
+
if attributes.has_key?(:'Margin')
|
230
|
+
self.margin = attributes[:'Margin']
|
231
|
+
end
|
232
|
+
|
233
|
+
if attributes.has_key?(:'Highlighting')
|
234
|
+
self.highlighting = attributes[:'Highlighting']
|
235
|
+
end
|
236
|
+
|
237
|
+
if attributes.has_key?(:'HorizontalAlignment')
|
238
|
+
self.horizontal_alignment = attributes[:'HorizontalAlignment']
|
239
|
+
end
|
240
|
+
|
241
|
+
if attributes.has_key?(:'VerticalAlignment')
|
242
|
+
self.vertical_alignment = attributes[:'VerticalAlignment']
|
243
|
+
end
|
244
|
+
|
245
|
+
if attributes.has_key?(:'MultiSelect')
|
246
|
+
self.multi_select = attributes[:'MultiSelect']
|
247
|
+
end
|
248
|
+
|
249
|
+
if attributes.has_key?(:'Options')
|
250
|
+
if (value = attributes[:'Options']).is_a?(Array)
|
251
|
+
self.options = value
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
if attributes.has_key?(:'ActiveState')
|
256
|
+
self.active_state = attributes[:'ActiveState']
|
257
|
+
end
|
258
|
+
|
259
|
+
if attributes.has_key?(:'Editable')
|
260
|
+
self.editable = attributes[:'Editable']
|
261
|
+
end
|
262
|
+
|
263
|
+
if attributes.has_key?(:'SpellCheck')
|
264
|
+
self.spell_check = attributes[:'SpellCheck']
|
265
|
+
end
|
266
|
+
|
267
|
+
if attributes.has_key?(:'Selected')
|
268
|
+
self.selected = attributes[:'Selected']
|
269
|
+
end
|
270
|
+
|
271
|
+
end
|
272
|
+
|
273
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
274
|
+
# @return Array for valid properies with the reasons
|
275
|
+
def list_invalid_properties
|
276
|
+
invalid_properties = Array.new
|
277
|
+
if @page_index.nil?
|
278
|
+
invalid_properties.push("invalid value for 'page_index', page_index cannot be nil.")
|
279
|
+
end
|
280
|
+
|
281
|
+
if @is_group.nil?
|
282
|
+
invalid_properties.push("invalid value for 'is_group', is_group cannot be nil.")
|
283
|
+
end
|
284
|
+
|
285
|
+
if @selected.nil?
|
286
|
+
invalid_properties.push("invalid value for 'selected', selected cannot be nil.")
|
287
|
+
end
|
288
|
+
|
289
|
+
return invalid_properties
|
290
|
+
end
|
291
|
+
|
292
|
+
# Check to see if the all the properties in the model are valid
|
293
|
+
# @return true if the model is valid
|
294
|
+
def valid?
|
295
|
+
return false if @page_index.nil?
|
296
|
+
return false if @is_group.nil?
|
297
|
+
return false if @selected.nil?
|
298
|
+
return true
|
299
|
+
end
|
300
|
+
|
301
|
+
# Checks equality by comparing each attribute.
|
302
|
+
# @param [Object] Object to be compared
|
303
|
+
def ==(o)
|
304
|
+
return true if self.equal?(o)
|
305
|
+
self.class == o.class &&
|
306
|
+
links == o.links &&
|
307
|
+
partial_name == o.partial_name &&
|
308
|
+
rect == o.rect &&
|
309
|
+
value == o.value &&
|
310
|
+
page_index == o.page_index &&
|
311
|
+
height == o.height &&
|
312
|
+
width == o.width &&
|
313
|
+
z_index == o.z_index &&
|
314
|
+
is_group == o.is_group &&
|
315
|
+
parent == o.parent &&
|
316
|
+
is_shared_field == o.is_shared_field &&
|
317
|
+
flags == o.flags &&
|
318
|
+
color == o.color &&
|
319
|
+
contents == o.contents &&
|
320
|
+
margin == o.margin &&
|
321
|
+
highlighting == o.highlighting &&
|
322
|
+
horizontal_alignment == o.horizontal_alignment &&
|
323
|
+
vertical_alignment == o.vertical_alignment &&
|
324
|
+
multi_select == o.multi_select &&
|
325
|
+
options == o.options &&
|
326
|
+
active_state == o.active_state &&
|
327
|
+
editable == o.editable &&
|
328
|
+
spell_check == o.spell_check &&
|
329
|
+
selected == o.selected
|
330
|
+
end
|
331
|
+
|
332
|
+
# @see the `==` method
|
333
|
+
# @param [Object] Object to be compared
|
334
|
+
def eql?(o)
|
335
|
+
self == o
|
336
|
+
end
|
337
|
+
|
338
|
+
# Calculates hash code according to all attributes.
|
339
|
+
# @return [Fixnum] Hash code
|
340
|
+
def hash
|
341
|
+
[links, partial_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment, multi_select, options, active_state, editable, spell_check, selected].hash
|
342
|
+
end
|
343
|
+
|
344
|
+
# Builds the object from hash
|
345
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
346
|
+
# @return [Object] Returns the model itself
|
347
|
+
def build_from_hash(attributes)
|
348
|
+
return nil unless attributes.is_a?(Hash)
|
349
|
+
self.class.swagger_types.each_pair do |key, type|
|
350
|
+
if type =~ /\AArray<(.*)>/i
|
351
|
+
# check to ensure the input is an array given that the the attribute
|
352
|
+
# is documented as an array but the input is not
|
353
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
354
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
355
|
+
end
|
356
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
357
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
358
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
359
|
+
end
|
360
|
+
|
361
|
+
self
|
362
|
+
end
|
363
|
+
|
364
|
+
# Deserializes the data based on type
|
365
|
+
# @param string type Data type
|
366
|
+
# @param string value Value to be deserialized
|
367
|
+
# @return [Object] Deserialized data
|
368
|
+
def _deserialize(type, value)
|
369
|
+
case type.to_sym
|
370
|
+
when :DateTime
|
371
|
+
DateTime.parse(value)
|
372
|
+
when :Date
|
373
|
+
Date.parse(value)
|
374
|
+
when :String
|
375
|
+
value.to_s
|
376
|
+
when :Integer
|
377
|
+
value.to_i
|
378
|
+
when :Float
|
379
|
+
value.to_f
|
380
|
+
when :BOOLEAN
|
381
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
382
|
+
true
|
383
|
+
else
|
384
|
+
false
|
385
|
+
end
|
386
|
+
when :Object
|
387
|
+
# generic object (usually a Hash), return directly
|
388
|
+
value
|
389
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
390
|
+
inner_type = Regexp.last_match[:inner_type]
|
391
|
+
value.map { |v| _deserialize(inner_type, v) }
|
392
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
393
|
+
k_type = Regexp.last_match[:k_type]
|
394
|
+
v_type = Regexp.last_match[:v_type]
|
395
|
+
{}.tap do |hash|
|
396
|
+
value.each do |k, v|
|
397
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
398
|
+
end
|
399
|
+
end
|
400
|
+
else # model
|
401
|
+
temp_model = AsposePdfCloud.const_get(type).new
|
402
|
+
temp_model.build_from_hash(value)
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
# Returns the string representation of the object
|
407
|
+
# @return [String] String presentation of the object
|
408
|
+
def to_s
|
409
|
+
to_hash.to_s
|
410
|
+
end
|
411
|
+
|
412
|
+
# to_body is an alias to to_hash (backward compatibility)
|
413
|
+
# @return [Hash] Returns the object in the form of hash
|
414
|
+
def to_body
|
415
|
+
to_hash
|
416
|
+
end
|
417
|
+
|
418
|
+
# Returns the object in the form of hash
|
419
|
+
# @return [Hash] Returns the object in the form of hash
|
420
|
+
def to_hash
|
421
|
+
hash = {}
|
422
|
+
self.class.attribute_map.each_pair do |attr, param|
|
423
|
+
value = self.send(attr)
|
424
|
+
next if value.nil?
|
425
|
+
hash[param] = _to_hash(value)
|
426
|
+
end
|
427
|
+
hash
|
428
|
+
end
|
429
|
+
|
430
|
+
# Outputs non-array value in the form of hash
|
431
|
+
# For object, use to_hash. Otherwise, just return the value
|
432
|
+
# @param [Object] value Any valid value
|
433
|
+
# @return [Hash] Returns the value in the form of hash
|
434
|
+
def _to_hash(value)
|
435
|
+
if value.is_a?(Array)
|
436
|
+
value.compact.map{ |v| _to_hash(v) }
|
437
|
+
elsif value.is_a?(Hash)
|
438
|
+
{}.tap do |hash|
|
439
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
440
|
+
end
|
441
|
+
elsif value.respond_to? :to_hash
|
442
|
+
value.to_hash
|
443
|
+
else
|
444
|
+
value
|
445
|
+
end
|
446
|
+
end
|
447
|
+
|
448
|
+
end
|
449
|
+
|
450
|
+
end
|
@@ -0,0 +1,224 @@
|
|
1
|
+
=begin
|
2
|
+
--------------------------------------------------------------------------------------------------------------------
|
3
|
+
Copyright (c) 2019 Aspose.PDF Cloud
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
13
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
14
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
15
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
16
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
18
|
+
SOFTWARE.
|
19
|
+
--------------------------------------------------------------------------------------------------------------------
|
20
|
+
=end
|
21
|
+
|
22
|
+
require 'date'
|
23
|
+
require 'time'
|
24
|
+
|
25
|
+
module AsposePdfCloud
|
26
|
+
# Represents response containing single combobox field object
|
27
|
+
class ComboBoxFieldResponse
|
28
|
+
# Response status code.
|
29
|
+
attr_accessor :code
|
30
|
+
|
31
|
+
# Response status.
|
32
|
+
attr_accessor :status
|
33
|
+
|
34
|
+
# Combobox field object
|
35
|
+
attr_accessor :field
|
36
|
+
|
37
|
+
|
38
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
39
|
+
def self.attribute_map
|
40
|
+
{
|
41
|
+
:'code' => :'Code',
|
42
|
+
:'status' => :'Status',
|
43
|
+
:'field' => :'Field'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# Attribute type mapping.
|
48
|
+
def self.swagger_types
|
49
|
+
{
|
50
|
+
:'code' => :'Integer',
|
51
|
+
:'status' => :'String',
|
52
|
+
:'field' => :'ComboBoxField'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Initializes the object
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
+
def initialize(attributes = {})
|
59
|
+
return unless attributes.is_a?(Hash)
|
60
|
+
|
61
|
+
# convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
63
|
+
|
64
|
+
if attributes.has_key?(:'Code')
|
65
|
+
self.code = attributes[:'Code']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'Status')
|
69
|
+
self.status = attributes[:'Status']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.has_key?(:'Field')
|
73
|
+
self.field = attributes[:'Field']
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
79
|
+
# @return Array for valid properies with the reasons
|
80
|
+
def list_invalid_properties
|
81
|
+
invalid_properties = Array.new
|
82
|
+
if @code.nil?
|
83
|
+
invalid_properties.push("invalid value for 'code', code cannot be nil.")
|
84
|
+
end
|
85
|
+
|
86
|
+
return invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
return false if @code.nil?
|
93
|
+
return true
|
94
|
+
end
|
95
|
+
|
96
|
+
# Checks equality by comparing each attribute.
|
97
|
+
# @param [Object] Object to be compared
|
98
|
+
def ==(o)
|
99
|
+
return true if self.equal?(o)
|
100
|
+
self.class == o.class &&
|
101
|
+
code == o.code &&
|
102
|
+
status == o.status &&
|
103
|
+
field == o.field
|
104
|
+
end
|
105
|
+
|
106
|
+
# @see the `==` method
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def eql?(o)
|
109
|
+
self == o
|
110
|
+
end
|
111
|
+
|
112
|
+
# Calculates hash code according to all attributes.
|
113
|
+
# @return [Fixnum] Hash code
|
114
|
+
def hash
|
115
|
+
[code, status, field].hash
|
116
|
+
end
|
117
|
+
|
118
|
+
# Builds the object from hash
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
+
# @return [Object] Returns the model itself
|
121
|
+
def build_from_hash(attributes)
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
123
|
+
self.class.swagger_types.each_pair do |key, type|
|
124
|
+
if type =~ /\AArray<(.*)>/i
|
125
|
+
# check to ensure the input is an array given that the the attribute
|
126
|
+
# is documented as an array but the input is not
|
127
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
128
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
129
|
+
end
|
130
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
131
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
132
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
133
|
+
end
|
134
|
+
|
135
|
+
self
|
136
|
+
end
|
137
|
+
|
138
|
+
# Deserializes the data based on type
|
139
|
+
# @param string type Data type
|
140
|
+
# @param string value Value to be deserialized
|
141
|
+
# @return [Object] Deserialized data
|
142
|
+
def _deserialize(type, value)
|
143
|
+
case type.to_sym
|
144
|
+
when :DateTime
|
145
|
+
DateTime.parse(value)
|
146
|
+
when :Date
|
147
|
+
Date.parse(value)
|
148
|
+
when :String
|
149
|
+
value.to_s
|
150
|
+
when :Integer
|
151
|
+
value.to_i
|
152
|
+
when :Float
|
153
|
+
value.to_f
|
154
|
+
when :BOOLEAN
|
155
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
156
|
+
true
|
157
|
+
else
|
158
|
+
false
|
159
|
+
end
|
160
|
+
when :Object
|
161
|
+
# generic object (usually a Hash), return directly
|
162
|
+
value
|
163
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
164
|
+
inner_type = Regexp.last_match[:inner_type]
|
165
|
+
value.map { |v| _deserialize(inner_type, v) }
|
166
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
167
|
+
k_type = Regexp.last_match[:k_type]
|
168
|
+
v_type = Regexp.last_match[:v_type]
|
169
|
+
{}.tap do |hash|
|
170
|
+
value.each do |k, v|
|
171
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
else # model
|
175
|
+
temp_model = AsposePdfCloud.const_get(type).new
|
176
|
+
temp_model.build_from_hash(value)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the string representation of the object
|
181
|
+
# @return [String] String presentation of the object
|
182
|
+
def to_s
|
183
|
+
to_hash.to_s
|
184
|
+
end
|
185
|
+
|
186
|
+
# to_body is an alias to to_hash (backward compatibility)
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
188
|
+
def to_body
|
189
|
+
to_hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns the object in the form of hash
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_hash
|
195
|
+
hash = {}
|
196
|
+
self.class.attribute_map.each_pair do |attr, param|
|
197
|
+
value = self.send(attr)
|
198
|
+
next if value.nil?
|
199
|
+
hash[param] = _to_hash(value)
|
200
|
+
end
|
201
|
+
hash
|
202
|
+
end
|
203
|
+
|
204
|
+
# Outputs non-array value in the form of hash
|
205
|
+
# For object, use to_hash. Otherwise, just return the value
|
206
|
+
# @param [Object] value Any valid value
|
207
|
+
# @return [Hash] Returns the value in the form of hash
|
208
|
+
def _to_hash(value)
|
209
|
+
if value.is_a?(Array)
|
210
|
+
value.compact.map{ |v| _to_hash(v) }
|
211
|
+
elsif value.is_a?(Hash)
|
212
|
+
{}.tap do |hash|
|
213
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
214
|
+
end
|
215
|
+
elsif value.respond_to? :to_hash
|
216
|
+
value.to_hash
|
217
|
+
else
|
218
|
+
value
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|