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