aspose_pdf_cloud 19.9.0 → 19.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,442 @@
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 RadioButtonField.
27
+ class RadioButtonField
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 radio button.
86
+ attr_accessor :options
87
+
88
+ # Gets collection of radio button options field.
89
+ attr_accessor :radio_button_options_field
90
+
91
+ # Style of field box.
92
+ attr_accessor :style
93
+
94
+ # Gets or sets index of selected item. Numbering of items is started from 1.
95
+ attr_accessor :selected
96
+
97
+
98
+ # Attribute mapping from ruby-style variable name to JSON key.
99
+ def self.attribute_map
100
+ {
101
+ :'links' => :'Links',
102
+ :'partial_name' => :'PartialName',
103
+ :'rect' => :'Rect',
104
+ :'value' => :'Value',
105
+ :'page_index' => :'PageIndex',
106
+ :'height' => :'Height',
107
+ :'width' => :'Width',
108
+ :'z_index' => :'ZIndex',
109
+ :'is_group' => :'IsGroup',
110
+ :'parent' => :'Parent',
111
+ :'is_shared_field' => :'IsSharedField',
112
+ :'flags' => :'Flags',
113
+ :'color' => :'Color',
114
+ :'contents' => :'Contents',
115
+ :'margin' => :'Margin',
116
+ :'highlighting' => :'Highlighting',
117
+ :'horizontal_alignment' => :'HorizontalAlignment',
118
+ :'vertical_alignment' => :'VerticalAlignment',
119
+ :'multi_select' => :'MultiSelect',
120
+ :'options' => :'Options',
121
+ :'radio_button_options_field' => :'RadioButtonOptionsField',
122
+ :'style' => :'Style',
123
+ :'selected' => :'Selected'
124
+ }
125
+ end
126
+
127
+ # Attribute type mapping.
128
+ def self.swagger_types
129
+ {
130
+ :'links' => :'Array<Link>',
131
+ :'partial_name' => :'String',
132
+ :'rect' => :'Rectangle',
133
+ :'value' => :'String',
134
+ :'page_index' => :'Integer',
135
+ :'height' => :'Float',
136
+ :'width' => :'Float',
137
+ :'z_index' => :'Integer',
138
+ :'is_group' => :'BOOLEAN',
139
+ :'parent' => :'FormField',
140
+ :'is_shared_field' => :'BOOLEAN',
141
+ :'flags' => :'Array<AnnotationFlags>',
142
+ :'color' => :'Color',
143
+ :'contents' => :'String',
144
+ :'margin' => :'MarginInfo',
145
+ :'highlighting' => :'LinkHighlightingMode',
146
+ :'horizontal_alignment' => :'HorizontalAlignment',
147
+ :'vertical_alignment' => :'VerticalAlignment',
148
+ :'multi_select' => :'BOOLEAN',
149
+ :'options' => :'Array<Option>',
150
+ :'radio_button_options_field' => :'Array<RadioButtonOptionField>',
151
+ :'style' => :'BoxStyle',
152
+ :'selected' => :'Integer'
153
+ }
154
+ end
155
+
156
+ # Initializes the object
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ def initialize(attributes = {})
159
+ return unless attributes.is_a?(Hash)
160
+
161
+ # convert string to symbol for hash key
162
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
163
+
164
+ if attributes.has_key?(:'Links')
165
+ if (value = attributes[:'Links']).is_a?(Array)
166
+ self.links = value
167
+ end
168
+ end
169
+
170
+ if attributes.has_key?(:'PartialName')
171
+ self.partial_name = attributes[:'PartialName']
172
+ end
173
+
174
+ if attributes.has_key?(:'Rect')
175
+ self.rect = attributes[:'Rect']
176
+ end
177
+
178
+ if attributes.has_key?(:'Value')
179
+ self.value = attributes[:'Value']
180
+ end
181
+
182
+ if attributes.has_key?(:'PageIndex')
183
+ self.page_index = attributes[:'PageIndex']
184
+ end
185
+
186
+ if attributes.has_key?(:'Height')
187
+ self.height = attributes[:'Height']
188
+ end
189
+
190
+ if attributes.has_key?(:'Width')
191
+ self.width = attributes[:'Width']
192
+ end
193
+
194
+ if attributes.has_key?(:'ZIndex')
195
+ self.z_index = attributes[:'ZIndex']
196
+ end
197
+
198
+ if attributes.has_key?(:'IsGroup')
199
+ self.is_group = attributes[:'IsGroup']
200
+ end
201
+
202
+ if attributes.has_key?(:'Parent')
203
+ self.parent = attributes[:'Parent']
204
+ end
205
+
206
+ if attributes.has_key?(:'IsSharedField')
207
+ self.is_shared_field = attributes[:'IsSharedField']
208
+ end
209
+
210
+ if attributes.has_key?(:'Flags')
211
+ if (value = attributes[:'Flags']).is_a?(Array)
212
+ self.flags = value
213
+ end
214
+ end
215
+
216
+ if attributes.has_key?(:'Color')
217
+ self.color = attributes[:'Color']
218
+ end
219
+
220
+ if attributes.has_key?(:'Contents')
221
+ self.contents = attributes[:'Contents']
222
+ end
223
+
224
+ if attributes.has_key?(:'Margin')
225
+ self.margin = attributes[:'Margin']
226
+ end
227
+
228
+ if attributes.has_key?(:'Highlighting')
229
+ self.highlighting = attributes[:'Highlighting']
230
+ end
231
+
232
+ if attributes.has_key?(:'HorizontalAlignment')
233
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
234
+ end
235
+
236
+ if attributes.has_key?(:'VerticalAlignment')
237
+ self.vertical_alignment = attributes[:'VerticalAlignment']
238
+ end
239
+
240
+ if attributes.has_key?(:'MultiSelect')
241
+ self.multi_select = attributes[:'MultiSelect']
242
+ end
243
+
244
+ if attributes.has_key?(:'Options')
245
+ if (value = attributes[:'Options']).is_a?(Array)
246
+ self.options = value
247
+ end
248
+ end
249
+
250
+ if attributes.has_key?(:'RadioButtonOptionsField')
251
+ if (value = attributes[:'RadioButtonOptionsField']).is_a?(Array)
252
+ self.radio_button_options_field = value
253
+ end
254
+ end
255
+
256
+ if attributes.has_key?(:'Style')
257
+ self.style = attributes[:'Style']
258
+ end
259
+
260
+ if attributes.has_key?(:'Selected')
261
+ self.selected = attributes[:'Selected']
262
+ end
263
+
264
+ end
265
+
266
+ # Show invalid properties with the reasons. Usually used together with valid?
267
+ # @return Array for valid properies with the reasons
268
+ def list_invalid_properties
269
+ invalid_properties = Array.new
270
+ if @page_index.nil?
271
+ invalid_properties.push("invalid value for 'page_index', page_index cannot be nil.")
272
+ end
273
+
274
+ if @is_group.nil?
275
+ invalid_properties.push("invalid value for 'is_group', is_group cannot be nil.")
276
+ end
277
+
278
+ if @selected.nil?
279
+ invalid_properties.push("invalid value for 'selected', selected cannot be nil.")
280
+ end
281
+
282
+ return invalid_properties
283
+ end
284
+
285
+ # Check to see if the all the properties in the model are valid
286
+ # @return true if the model is valid
287
+ def valid?
288
+ return false if @page_index.nil?
289
+ return false if @is_group.nil?
290
+ return false if @selected.nil?
291
+ return true
292
+ end
293
+
294
+ # Checks equality by comparing each attribute.
295
+ # @param [Object] Object to be compared
296
+ def ==(o)
297
+ return true if self.equal?(o)
298
+ self.class == o.class &&
299
+ links == o.links &&
300
+ partial_name == o.partial_name &&
301
+ rect == o.rect &&
302
+ value == o.value &&
303
+ page_index == o.page_index &&
304
+ height == o.height &&
305
+ width == o.width &&
306
+ z_index == o.z_index &&
307
+ is_group == o.is_group &&
308
+ parent == o.parent &&
309
+ is_shared_field == o.is_shared_field &&
310
+ flags == o.flags &&
311
+ color == o.color &&
312
+ contents == o.contents &&
313
+ margin == o.margin &&
314
+ highlighting == o.highlighting &&
315
+ horizontal_alignment == o.horizontal_alignment &&
316
+ vertical_alignment == o.vertical_alignment &&
317
+ multi_select == o.multi_select &&
318
+ options == o.options &&
319
+ radio_button_options_field == o.radio_button_options_field &&
320
+ style == o.style &&
321
+ selected == o.selected
322
+ end
323
+
324
+ # @see the `==` method
325
+ # @param [Object] Object to be compared
326
+ def eql?(o)
327
+ self == o
328
+ end
329
+
330
+ # Calculates hash code according to all attributes.
331
+ # @return [Fixnum] Hash code
332
+ def hash
333
+ [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, radio_button_options_field, style, selected].hash
334
+ end
335
+
336
+ # Builds the object from hash
337
+ # @param [Hash] attributes Model attributes in the form of hash
338
+ # @return [Object] Returns the model itself
339
+ def build_from_hash(attributes)
340
+ return nil unless attributes.is_a?(Hash)
341
+ self.class.swagger_types.each_pair do |key, type|
342
+ if type =~ /\AArray<(.*)>/i
343
+ # check to ensure the input is an array given that the the attribute
344
+ # is documented as an array but the input is not
345
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
346
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
347
+ end
348
+ elsif !attributes[self.class.attribute_map[key]].nil?
349
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
350
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
351
+ end
352
+
353
+ self
354
+ end
355
+
356
+ # Deserializes the data based on type
357
+ # @param string type Data type
358
+ # @param string value Value to be deserialized
359
+ # @return [Object] Deserialized data
360
+ def _deserialize(type, value)
361
+ case type.to_sym
362
+ when :DateTime
363
+ DateTime.parse(value)
364
+ when :Date
365
+ Date.parse(value)
366
+ when :String
367
+ value.to_s
368
+ when :Integer
369
+ value.to_i
370
+ when :Float
371
+ value.to_f
372
+ when :BOOLEAN
373
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
374
+ true
375
+ else
376
+ false
377
+ end
378
+ when :Object
379
+ # generic object (usually a Hash), return directly
380
+ value
381
+ when /\AArray<(?<inner_type>.+)>\z/
382
+ inner_type = Regexp.last_match[:inner_type]
383
+ value.map { |v| _deserialize(inner_type, v) }
384
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
385
+ k_type = Regexp.last_match[:k_type]
386
+ v_type = Regexp.last_match[:v_type]
387
+ {}.tap do |hash|
388
+ value.each do |k, v|
389
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
390
+ end
391
+ end
392
+ else # model
393
+ temp_model = AsposePdfCloud.const_get(type).new
394
+ temp_model.build_from_hash(value)
395
+ end
396
+ end
397
+
398
+ # Returns the string representation of the object
399
+ # @return [String] String presentation of the object
400
+ def to_s
401
+ to_hash.to_s
402
+ end
403
+
404
+ # to_body is an alias to to_hash (backward compatibility)
405
+ # @return [Hash] Returns the object in the form of hash
406
+ def to_body
407
+ to_hash
408
+ end
409
+
410
+ # Returns the object in the form of hash
411
+ # @return [Hash] Returns the object in the form of hash
412
+ def to_hash
413
+ hash = {}
414
+ self.class.attribute_map.each_pair do |attr, param|
415
+ value = self.send(attr)
416
+ next if value.nil?
417
+ hash[param] = _to_hash(value)
418
+ end
419
+ hash
420
+ end
421
+
422
+ # Outputs non-array value in the form of hash
423
+ # For object, use to_hash. Otherwise, just return the value
424
+ # @param [Object] value Any valid value
425
+ # @return [Hash] Returns the value in the form of hash
426
+ def _to_hash(value)
427
+ if value.is_a?(Array)
428
+ value.compact.map{ |v| _to_hash(v) }
429
+ elsif value.is_a?(Hash)
430
+ {}.tap do |hash|
431
+ value.each { |k, v| hash[k] = _to_hash(v) }
432
+ end
433
+ elsif value.respond_to? :to_hash
434
+ value.to_hash
435
+ else
436
+ value
437
+ end
438
+ end
439
+
440
+ end
441
+
442
+ 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 RadioButton field object
27
+ class RadioButtonFieldResponse
28
+ # Response status code.
29
+ attr_accessor :code
30
+
31
+ # Response status.
32
+ attr_accessor :status
33
+
34
+ # RadioButton 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' => :'RadioButtonField'
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