aspose_pdf_cloud 19.3.0 → 19.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -5
  3. data/docs/BorderCornerStyle.md +11 -0
  4. data/docs/BorderInfo.md +13 -0
  5. data/docs/Cell.md +21 -0
  6. data/docs/ColumnAdjustment.md +12 -0
  7. data/docs/CryptoAlgorithm.md +14 -0
  8. data/docs/GraphInfo.md +19 -0
  9. data/docs/ImageFooter.md +23 -0
  10. data/docs/ImageHeader.md +23 -0
  11. data/docs/ImageStamp.md +5 -5
  12. data/docs/MarginInfo.md +5 -5
  13. data/docs/PageNumberStamp.md +24 -0
  14. data/docs/PdfApi.md +451 -27
  15. data/docs/PdfPageStamp.md +5 -5
  16. data/docs/PermissionsFlags.md +17 -0
  17. data/docs/Row.md +19 -0
  18. data/docs/StampBase.md +0 -5
  19. data/docs/Table.md +31 -0
  20. data/docs/TableBroken.md +12 -0
  21. data/docs/TextFooter.md +23 -0
  22. data/docs/TextHeader.md +23 -0
  23. data/docs/TextStamp.md +5 -5
  24. data/lib/aspose_pdf_cloud.rb +15 -0
  25. data/lib/aspose_pdf_cloud/api/pdf_api.rb +1530 -215
  26. data/lib/aspose_pdf_cloud/models/border_corner_style.rb +44 -0
  27. data/lib/aspose_pdf_cloud/models/border_info.rb +241 -0
  28. data/lib/aspose_pdf_cloud/models/cell.rb +323 -0
  29. data/lib/aspose_pdf_cloud/models/column_adjustment.rb +45 -0
  30. data/lib/aspose_pdf_cloud/models/crypto_algorithm.rb +46 -0
  31. data/lib/aspose_pdf_cloud/models/graph_info.rb +303 -0
  32. data/lib/aspose_pdf_cloud/models/image_footer.rb +343 -0
  33. data/lib/aspose_pdf_cloud/models/image_header.rb +343 -0
  34. data/lib/aspose_pdf_cloud/models/image_stamp.rb +54 -54
  35. data/lib/aspose_pdf_cloud/models/margin_info.rb +5 -21
  36. data/lib/aspose_pdf_cloud/models/page_number_stamp.rb +353 -0
  37. data/lib/aspose_pdf_cloud/models/pdf_page_stamp.rb +54 -54
  38. data/lib/aspose_pdf_cloud/models/permissions_flags.rb +50 -0
  39. data/lib/aspose_pdf_cloud/models/row.rb +308 -0
  40. data/lib/aspose_pdf_cloud/models/stamp_base.rb +1 -51
  41. data/lib/aspose_pdf_cloud/models/table.rb +425 -0
  42. data/lib/aspose_pdf_cloud/models/table_broken.rb +45 -0
  43. data/lib/aspose_pdf_cloud/models/text_footer.rb +343 -0
  44. data/lib/aspose_pdf_cloud/models/text_header.rb +343 -0
  45. data/lib/aspose_pdf_cloud/models/text_stamp.rb +54 -54
  46. data/lib/aspose_pdf_cloud/version.rb +1 -1
  47. data/test/pdf_tests.rb +407 -5
  48. data/test_data/4pagesEncrypted.pdf +0 -0
  49. metadata +33 -2
@@ -0,0 +1,343 @@
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 Pdf text header.
27
+ class TextFooter
28
+ # Link to the document.
29
+ attr_accessor :links
30
+
31
+ # Sets or gets a bool value that indicates the content is stamped as background. If the value is true, the stamp content is layed at the bottom. By defalt, the value is false, the stamp content is layed at the top.
32
+ attr_accessor :background
33
+
34
+ # Gets or sets Horizontal alignment of stamp on the page.
35
+ attr_accessor :horizontal_alignment
36
+
37
+ # Gets or sets a value to indicate the stamp opacity. The value is from 0.0 to 1.0. By default the value is 1.0.
38
+ attr_accessor :opacity
39
+
40
+ # Sets or gets the rotation of stamp content according values. Note. This property is for set angles which are multiples of 90 degrees (0, 90, 180, 270 degrees). To set arbitrary angle use RotateAngle property. If angle set by ArbitraryAngle is not multiple of 90 then Rotate property returns Rotation.None.
41
+ attr_accessor :rotate
42
+
43
+ # Gets or sets rotate angle of stamp in degrees. This property allows to set arbitrary rotate angle.
44
+ attr_accessor :rotate_angle
45
+
46
+ # Horizontal stamp coordinate, starting from the left.
47
+ attr_accessor :x_indent
48
+
49
+ # Vertical stamp coordinate, starting from the bottom.
50
+ attr_accessor :y_indent
51
+
52
+ # Zooming factor of the stamp. Allows to scale stamp.
53
+ attr_accessor :zoom
54
+
55
+ # Alignment of the text inside the stamp.
56
+ attr_accessor :text_alignment
57
+
58
+ # Gets or sets string value which is used as stamp on the page.
59
+ attr_accessor :value
60
+
61
+ # Gets text properties of the stamp. See for details.
62
+ attr_accessor :text_state
63
+
64
+ # Gets or sets bottom margin of stamp.
65
+ attr_accessor :bottom_margin
66
+
67
+ # Gets or sets left margin of stamp.
68
+ attr_accessor :left_margin
69
+
70
+ # Gets or sets right margin of stamp.
71
+ attr_accessor :right_margin
72
+
73
+
74
+ # Attribute mapping from ruby-style variable name to JSON key.
75
+ def self.attribute_map
76
+ {
77
+ :'links' => :'Links',
78
+ :'background' => :'Background',
79
+ :'horizontal_alignment' => :'HorizontalAlignment',
80
+ :'opacity' => :'Opacity',
81
+ :'rotate' => :'Rotate',
82
+ :'rotate_angle' => :'RotateAngle',
83
+ :'x_indent' => :'XIndent',
84
+ :'y_indent' => :'YIndent',
85
+ :'zoom' => :'Zoom',
86
+ :'text_alignment' => :'TextAlignment',
87
+ :'value' => :'Value',
88
+ :'text_state' => :'TextState',
89
+ :'bottom_margin' => :'BottomMargin',
90
+ :'left_margin' => :'LeftMargin',
91
+ :'right_margin' => :'RightMargin'
92
+ }
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.swagger_types
97
+ {
98
+ :'links' => :'Array<Link>',
99
+ :'background' => :'BOOLEAN',
100
+ :'horizontal_alignment' => :'HorizontalAlignment',
101
+ :'opacity' => :'Float',
102
+ :'rotate' => :'Rotation',
103
+ :'rotate_angle' => :'Float',
104
+ :'x_indent' => :'Float',
105
+ :'y_indent' => :'Float',
106
+ :'zoom' => :'Float',
107
+ :'text_alignment' => :'HorizontalAlignment',
108
+ :'value' => :'String',
109
+ :'text_state' => :'TextState',
110
+ :'bottom_margin' => :'Float',
111
+ :'left_margin' => :'Float',
112
+ :'right_margin' => :'Float'
113
+ }
114
+ end
115
+
116
+ # Initializes the object
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ def initialize(attributes = {})
119
+ return unless attributes.is_a?(Hash)
120
+
121
+ # convert string to symbol for hash key
122
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
123
+
124
+ if attributes.has_key?(:'Links')
125
+ if (value = attributes[:'Links']).is_a?(Array)
126
+ self.links = value
127
+ end
128
+ end
129
+
130
+ if attributes.has_key?(:'Background')
131
+ self.background = attributes[:'Background']
132
+ end
133
+
134
+ if attributes.has_key?(:'HorizontalAlignment')
135
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
136
+ end
137
+
138
+ if attributes.has_key?(:'Opacity')
139
+ self.opacity = attributes[:'Opacity']
140
+ end
141
+
142
+ if attributes.has_key?(:'Rotate')
143
+ self.rotate = attributes[:'Rotate']
144
+ end
145
+
146
+ if attributes.has_key?(:'RotateAngle')
147
+ self.rotate_angle = attributes[:'RotateAngle']
148
+ end
149
+
150
+ if attributes.has_key?(:'XIndent')
151
+ self.x_indent = attributes[:'XIndent']
152
+ end
153
+
154
+ if attributes.has_key?(:'YIndent')
155
+ self.y_indent = attributes[:'YIndent']
156
+ end
157
+
158
+ if attributes.has_key?(:'Zoom')
159
+ self.zoom = attributes[:'Zoom']
160
+ end
161
+
162
+ if attributes.has_key?(:'TextAlignment')
163
+ self.text_alignment = attributes[:'TextAlignment']
164
+ end
165
+
166
+ if attributes.has_key?(:'Value')
167
+ self.value = attributes[:'Value']
168
+ end
169
+
170
+ if attributes.has_key?(:'TextState')
171
+ self.text_state = attributes[:'TextState']
172
+ end
173
+
174
+ if attributes.has_key?(:'BottomMargin')
175
+ self.bottom_margin = attributes[:'BottomMargin']
176
+ end
177
+
178
+ if attributes.has_key?(:'LeftMargin')
179
+ self.left_margin = attributes[:'LeftMargin']
180
+ end
181
+
182
+ if attributes.has_key?(:'RightMargin')
183
+ self.right_margin = attributes[:'RightMargin']
184
+ end
185
+
186
+ end
187
+
188
+ # Show invalid properties with the reasons. Usually used together with valid?
189
+ # @return Array for valid properies with the reasons
190
+ def list_invalid_properties
191
+ invalid_properties = Array.new
192
+ return invalid_properties
193
+ end
194
+
195
+ # Check to see if the all the properties in the model are valid
196
+ # @return true if the model is valid
197
+ def valid?
198
+ return true
199
+ end
200
+
201
+ # Checks equality by comparing each attribute.
202
+ # @param [Object] Object to be compared
203
+ def ==(o)
204
+ return true if self.equal?(o)
205
+ self.class == o.class &&
206
+ links == o.links &&
207
+ background == o.background &&
208
+ horizontal_alignment == o.horizontal_alignment &&
209
+ opacity == o.opacity &&
210
+ rotate == o.rotate &&
211
+ rotate_angle == o.rotate_angle &&
212
+ x_indent == o.x_indent &&
213
+ y_indent == o.y_indent &&
214
+ zoom == o.zoom &&
215
+ text_alignment == o.text_alignment &&
216
+ value == o.value &&
217
+ text_state == o.text_state &&
218
+ bottom_margin == o.bottom_margin &&
219
+ left_margin == o.left_margin &&
220
+ right_margin == o.right_margin
221
+ end
222
+
223
+ # @see the `==` method
224
+ # @param [Object] Object to be compared
225
+ def eql?(o)
226
+ self == o
227
+ end
228
+
229
+ # Calculates hash code according to all attributes.
230
+ # @return [Fixnum] Hash code
231
+ def hash
232
+ [links, background, horizontal_alignment, opacity, rotate, rotate_angle, x_indent, y_indent, zoom, text_alignment, value, text_state, bottom_margin, left_margin, right_margin].hash
233
+ end
234
+
235
+ # Builds the object from hash
236
+ # @param [Hash] attributes Model attributes in the form of hash
237
+ # @return [Object] Returns the model itself
238
+ def build_from_hash(attributes)
239
+ return nil unless attributes.is_a?(Hash)
240
+ self.class.swagger_types.each_pair do |key, type|
241
+ if type =~ /\AArray<(.*)>/i
242
+ # check to ensure the input is an array given that the the attribute
243
+ # is documented as an array but the input is not
244
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
245
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
246
+ end
247
+ elsif !attributes[self.class.attribute_map[key]].nil?
248
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
249
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
250
+ end
251
+
252
+ self
253
+ end
254
+
255
+ # Deserializes the data based on type
256
+ # @param string type Data type
257
+ # @param string value Value to be deserialized
258
+ # @return [Object] Deserialized data
259
+ def _deserialize(type, value)
260
+ case type.to_sym
261
+ when :DateTime
262
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
263
+ Time.strptime(value, format).utc.to_datetime
264
+ when :Date
265
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
266
+ Time.strptime(value, format).utc.to_datetime.to_date
267
+ when :String
268
+ value.to_s
269
+ when :Integer
270
+ value.to_i
271
+ when :Float
272
+ value.to_f
273
+ when :BOOLEAN
274
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
275
+ true
276
+ else
277
+ false
278
+ end
279
+ when :Object
280
+ # generic object (usually a Hash), return directly
281
+ value
282
+ when /\AArray<(?<inner_type>.+)>\z/
283
+ inner_type = Regexp.last_match[:inner_type]
284
+ value.map { |v| _deserialize(inner_type, v) }
285
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
286
+ k_type = Regexp.last_match[:k_type]
287
+ v_type = Regexp.last_match[:v_type]
288
+ {}.tap do |hash|
289
+ value.each do |k, v|
290
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
291
+ end
292
+ end
293
+ else # model
294
+ temp_model = AsposePdfCloud.const_get(type).new
295
+ temp_model.build_from_hash(value)
296
+ end
297
+ end
298
+
299
+ # Returns the string representation of the object
300
+ # @return [String] String presentation of the object
301
+ def to_s
302
+ to_hash.to_s
303
+ end
304
+
305
+ # to_body is an alias to to_hash (backward compatibility)
306
+ # @return [Hash] Returns the object in the form of hash
307
+ def to_body
308
+ to_hash
309
+ end
310
+
311
+ # Returns the object in the form of hash
312
+ # @return [Hash] Returns the object in the form of hash
313
+ def to_hash
314
+ hash = {}
315
+ self.class.attribute_map.each_pair do |attr, param|
316
+ value = self.send(attr)
317
+ next if value.nil?
318
+ hash[param] = _to_hash(value)
319
+ end
320
+ hash
321
+ end
322
+
323
+ # Outputs non-array value in the form of hash
324
+ # For object, use to_hash. Otherwise, just return the value
325
+ # @param [Object] value Any valid value
326
+ # @return [Hash] Returns the value in the form of hash
327
+ def _to_hash(value)
328
+ if value.is_a?(Array)
329
+ value.compact.map{ |v| _to_hash(v) }
330
+ elsif value.is_a?(Hash)
331
+ {}.tap do |hash|
332
+ value.each { |k, v| hash[k] = _to_hash(v) }
333
+ end
334
+ elsif value.respond_to? :to_hash
335
+ value.to_hash
336
+ else
337
+ value
338
+ end
339
+ end
340
+
341
+ end
342
+
343
+ end
@@ -0,0 +1,343 @@
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 Pdf text header.
27
+ class TextHeader
28
+ # Link to the document.
29
+ attr_accessor :links
30
+
31
+ # Sets or gets a bool value that indicates the content is stamped as background. If the value is true, the stamp content is layed at the bottom. By defalt, the value is false, the stamp content is layed at the top.
32
+ attr_accessor :background
33
+
34
+ # Gets or sets Horizontal alignment of stamp on the page.
35
+ attr_accessor :horizontal_alignment
36
+
37
+ # Gets or sets a value to indicate the stamp opacity. The value is from 0.0 to 1.0. By default the value is 1.0.
38
+ attr_accessor :opacity
39
+
40
+ # Sets or gets the rotation of stamp content according values. Note. This property is for set angles which are multiples of 90 degrees (0, 90, 180, 270 degrees). To set arbitrary angle use RotateAngle property. If angle set by ArbitraryAngle is not multiple of 90 then Rotate property returns Rotation.None.
41
+ attr_accessor :rotate
42
+
43
+ # Gets or sets rotate angle of stamp in degrees. This property allows to set arbitrary rotate angle.
44
+ attr_accessor :rotate_angle
45
+
46
+ # Horizontal stamp coordinate, starting from the left.
47
+ attr_accessor :x_indent
48
+
49
+ # Vertical stamp coordinate, starting from the bottom.
50
+ attr_accessor :y_indent
51
+
52
+ # Zooming factor of the stamp. Allows to scale stamp.
53
+ attr_accessor :zoom
54
+
55
+ # Alignment of the text inside the stamp.
56
+ attr_accessor :text_alignment
57
+
58
+ # Gets or sets string value which is used as stamp on the page.
59
+ attr_accessor :value
60
+
61
+ # Gets text properties of the stamp. See for details.
62
+ attr_accessor :text_state
63
+
64
+ # Gets or sets left margin of stamp.
65
+ attr_accessor :left_margin
66
+
67
+ # Gets or sets top margin of stamp.
68
+ attr_accessor :top_margin
69
+
70
+ # Gets or sets right margin of stamp.
71
+ attr_accessor :right_margin
72
+
73
+
74
+ # Attribute mapping from ruby-style variable name to JSON key.
75
+ def self.attribute_map
76
+ {
77
+ :'links' => :'Links',
78
+ :'background' => :'Background',
79
+ :'horizontal_alignment' => :'HorizontalAlignment',
80
+ :'opacity' => :'Opacity',
81
+ :'rotate' => :'Rotate',
82
+ :'rotate_angle' => :'RotateAngle',
83
+ :'x_indent' => :'XIndent',
84
+ :'y_indent' => :'YIndent',
85
+ :'zoom' => :'Zoom',
86
+ :'text_alignment' => :'TextAlignment',
87
+ :'value' => :'Value',
88
+ :'text_state' => :'TextState',
89
+ :'left_margin' => :'LeftMargin',
90
+ :'top_margin' => :'TopMargin',
91
+ :'right_margin' => :'RightMargin'
92
+ }
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.swagger_types
97
+ {
98
+ :'links' => :'Array<Link>',
99
+ :'background' => :'BOOLEAN',
100
+ :'horizontal_alignment' => :'HorizontalAlignment',
101
+ :'opacity' => :'Float',
102
+ :'rotate' => :'Rotation',
103
+ :'rotate_angle' => :'Float',
104
+ :'x_indent' => :'Float',
105
+ :'y_indent' => :'Float',
106
+ :'zoom' => :'Float',
107
+ :'text_alignment' => :'HorizontalAlignment',
108
+ :'value' => :'String',
109
+ :'text_state' => :'TextState',
110
+ :'left_margin' => :'Float',
111
+ :'top_margin' => :'Float',
112
+ :'right_margin' => :'Float'
113
+ }
114
+ end
115
+
116
+ # Initializes the object
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ def initialize(attributes = {})
119
+ return unless attributes.is_a?(Hash)
120
+
121
+ # convert string to symbol for hash key
122
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
123
+
124
+ if attributes.has_key?(:'Links')
125
+ if (value = attributes[:'Links']).is_a?(Array)
126
+ self.links = value
127
+ end
128
+ end
129
+
130
+ if attributes.has_key?(:'Background')
131
+ self.background = attributes[:'Background']
132
+ end
133
+
134
+ if attributes.has_key?(:'HorizontalAlignment')
135
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
136
+ end
137
+
138
+ if attributes.has_key?(:'Opacity')
139
+ self.opacity = attributes[:'Opacity']
140
+ end
141
+
142
+ if attributes.has_key?(:'Rotate')
143
+ self.rotate = attributes[:'Rotate']
144
+ end
145
+
146
+ if attributes.has_key?(:'RotateAngle')
147
+ self.rotate_angle = attributes[:'RotateAngle']
148
+ end
149
+
150
+ if attributes.has_key?(:'XIndent')
151
+ self.x_indent = attributes[:'XIndent']
152
+ end
153
+
154
+ if attributes.has_key?(:'YIndent')
155
+ self.y_indent = attributes[:'YIndent']
156
+ end
157
+
158
+ if attributes.has_key?(:'Zoom')
159
+ self.zoom = attributes[:'Zoom']
160
+ end
161
+
162
+ if attributes.has_key?(:'TextAlignment')
163
+ self.text_alignment = attributes[:'TextAlignment']
164
+ end
165
+
166
+ if attributes.has_key?(:'Value')
167
+ self.value = attributes[:'Value']
168
+ end
169
+
170
+ if attributes.has_key?(:'TextState')
171
+ self.text_state = attributes[:'TextState']
172
+ end
173
+
174
+ if attributes.has_key?(:'LeftMargin')
175
+ self.left_margin = attributes[:'LeftMargin']
176
+ end
177
+
178
+ if attributes.has_key?(:'TopMargin')
179
+ self.top_margin = attributes[:'TopMargin']
180
+ end
181
+
182
+ if attributes.has_key?(:'RightMargin')
183
+ self.right_margin = attributes[:'RightMargin']
184
+ end
185
+
186
+ end
187
+
188
+ # Show invalid properties with the reasons. Usually used together with valid?
189
+ # @return Array for valid properies with the reasons
190
+ def list_invalid_properties
191
+ invalid_properties = Array.new
192
+ return invalid_properties
193
+ end
194
+
195
+ # Check to see if the all the properties in the model are valid
196
+ # @return true if the model is valid
197
+ def valid?
198
+ return true
199
+ end
200
+
201
+ # Checks equality by comparing each attribute.
202
+ # @param [Object] Object to be compared
203
+ def ==(o)
204
+ return true if self.equal?(o)
205
+ self.class == o.class &&
206
+ links == o.links &&
207
+ background == o.background &&
208
+ horizontal_alignment == o.horizontal_alignment &&
209
+ opacity == o.opacity &&
210
+ rotate == o.rotate &&
211
+ rotate_angle == o.rotate_angle &&
212
+ x_indent == o.x_indent &&
213
+ y_indent == o.y_indent &&
214
+ zoom == o.zoom &&
215
+ text_alignment == o.text_alignment &&
216
+ value == o.value &&
217
+ text_state == o.text_state &&
218
+ left_margin == o.left_margin &&
219
+ top_margin == o.top_margin &&
220
+ right_margin == o.right_margin
221
+ end
222
+
223
+ # @see the `==` method
224
+ # @param [Object] Object to be compared
225
+ def eql?(o)
226
+ self == o
227
+ end
228
+
229
+ # Calculates hash code according to all attributes.
230
+ # @return [Fixnum] Hash code
231
+ def hash
232
+ [links, background, horizontal_alignment, opacity, rotate, rotate_angle, x_indent, y_indent, zoom, text_alignment, value, text_state, left_margin, top_margin, right_margin].hash
233
+ end
234
+
235
+ # Builds the object from hash
236
+ # @param [Hash] attributes Model attributes in the form of hash
237
+ # @return [Object] Returns the model itself
238
+ def build_from_hash(attributes)
239
+ return nil unless attributes.is_a?(Hash)
240
+ self.class.swagger_types.each_pair do |key, type|
241
+ if type =~ /\AArray<(.*)>/i
242
+ # check to ensure the input is an array given that the the attribute
243
+ # is documented as an array but the input is not
244
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
245
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
246
+ end
247
+ elsif !attributes[self.class.attribute_map[key]].nil?
248
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
249
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
250
+ end
251
+
252
+ self
253
+ end
254
+
255
+ # Deserializes the data based on type
256
+ # @param string type Data type
257
+ # @param string value Value to be deserialized
258
+ # @return [Object] Deserialized data
259
+ def _deserialize(type, value)
260
+ case type.to_sym
261
+ when :DateTime
262
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
263
+ Time.strptime(value, format).utc.to_datetime
264
+ when :Date
265
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
266
+ Time.strptime(value, format).utc.to_datetime.to_date
267
+ when :String
268
+ value.to_s
269
+ when :Integer
270
+ value.to_i
271
+ when :Float
272
+ value.to_f
273
+ when :BOOLEAN
274
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
275
+ true
276
+ else
277
+ false
278
+ end
279
+ when :Object
280
+ # generic object (usually a Hash), return directly
281
+ value
282
+ when /\AArray<(?<inner_type>.+)>\z/
283
+ inner_type = Regexp.last_match[:inner_type]
284
+ value.map { |v| _deserialize(inner_type, v) }
285
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
286
+ k_type = Regexp.last_match[:k_type]
287
+ v_type = Regexp.last_match[:v_type]
288
+ {}.tap do |hash|
289
+ value.each do |k, v|
290
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
291
+ end
292
+ end
293
+ else # model
294
+ temp_model = AsposePdfCloud.const_get(type).new
295
+ temp_model.build_from_hash(value)
296
+ end
297
+ end
298
+
299
+ # Returns the string representation of the object
300
+ # @return [String] String presentation of the object
301
+ def to_s
302
+ to_hash.to_s
303
+ end
304
+
305
+ # to_body is an alias to to_hash (backward compatibility)
306
+ # @return [Hash] Returns the object in the form of hash
307
+ def to_body
308
+ to_hash
309
+ end
310
+
311
+ # Returns the object in the form of hash
312
+ # @return [Hash] Returns the object in the form of hash
313
+ def to_hash
314
+ hash = {}
315
+ self.class.attribute_map.each_pair do |attr, param|
316
+ value = self.send(attr)
317
+ next if value.nil?
318
+ hash[param] = _to_hash(value)
319
+ end
320
+ hash
321
+ end
322
+
323
+ # Outputs non-array value in the form of hash
324
+ # For object, use to_hash. Otherwise, just return the value
325
+ # @param [Object] value Any valid value
326
+ # @return [Hash] Returns the value in the form of hash
327
+ def _to_hash(value)
328
+ if value.is_a?(Array)
329
+ value.compact.map{ |v| _to_hash(v) }
330
+ elsif value.is_a?(Hash)
331
+ {}.tap do |hash|
332
+ value.each { |k, v| hash[k] = _to_hash(v) }
333
+ end
334
+ elsif value.respond_to? :to_hash
335
+ value.to_hash
336
+ else
337
+ value
338
+ end
339
+ end
340
+
341
+ end
342
+
343
+ end