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,45 @@
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
+ class ColumnAdjustment
27
+
28
+ CUSTOMIZED = "Customized".freeze
29
+ AUTO_FIT_TO_CONTENT = "AutoFitToContent".freeze
30
+ AUTO_FIT_TO_WINDOW = "AutoFitToWindow".freeze
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ # resolve issue with Concstant Name modification (ex: "FooName" to :FOO_NAME)
37
+ # consantValues = ColumnAdjustment.constants.select{|c| c.to_s == value}
38
+ constantValues = ColumnAdjustment.constants.select{ |const_name| ColumnAdjustment.const_get(const_name) == value}
39
+
40
+ raise "Invalid ENUM value #{value} for class #ColumnAdjustment" if constantValues.empty?
41
+ value
42
+ end
43
+ end
44
+
45
+ end
@@ -0,0 +1,46 @@
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
+ class CryptoAlgorithm
27
+
28
+ RC4X40 = "RC4x40".freeze
29
+ RC4X128 = "RC4x128".freeze
30
+ AE_SX128 = "AESx128".freeze
31
+ AE_SX256 = "AESx256".freeze
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ # resolve issue with Concstant Name modification (ex: "FooName" to :FOO_NAME)
38
+ # consantValues = CryptoAlgorithm.constants.select{|c| c.to_s == value}
39
+ constantValues = CryptoAlgorithm.constants.select{ |const_name| CryptoAlgorithm.const_get(const_name) == value}
40
+
41
+ raise "Invalid ENUM value #{value} for class #CryptoAlgorithm" if constantValues.empty?
42
+ value
43
+ end
44
+ end
45
+
46
+ end
@@ -0,0 +1,303 @@
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 graphics info.
27
+ class GraphInfo
28
+ # Gets or sets a float value that indicates the line width of the graph.
29
+ attr_accessor :line_width
30
+
31
+ # Gets or sets a object that indicates the color of the graph.
32
+ attr_accessor :color
33
+
34
+ # Gets or sets a dash array.
35
+ attr_accessor :dash_array
36
+
37
+ # Gets or sets a dash phase.
38
+ attr_accessor :dash_phase
39
+
40
+ # Gets or sets a object that indicates the fill color of the graph.
41
+ attr_accessor :fill_color
42
+
43
+ # Gets or sets is border doubled.
44
+ attr_accessor :is_doubled
45
+
46
+ # Gets or sets a float value that indicates the skew angle of the x-coordinate when transforming a coordinate system.
47
+ attr_accessor :skew_angle_x
48
+
49
+ # Gets or sets a float value that indicates the skew angle of the y-coordinate when transforming a coordinate system.
50
+ attr_accessor :skew_angle_y
51
+
52
+ # Gets or sets a float value that indicates the scaling rate of the x-coordinate when transforming a coordinate system.
53
+ attr_accessor :scaling_rate_x
54
+
55
+ # Gets or sets a float value that indicates the scaling rate of the y-coordinate when transforming a coordinate system.
56
+ attr_accessor :scaling_rate_y
57
+
58
+ # Gets or sets a float value that indicates the rotation angle of the coordinate system when transforming a coordinate system.
59
+ attr_accessor :rotation_angle
60
+
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'line_width' => :'LineWidth',
66
+ :'color' => :'Color',
67
+ :'dash_array' => :'DashArray',
68
+ :'dash_phase' => :'DashPhase',
69
+ :'fill_color' => :'FillColor',
70
+ :'is_doubled' => :'IsDoubled',
71
+ :'skew_angle_x' => :'SkewAngleX',
72
+ :'skew_angle_y' => :'SkewAngleY',
73
+ :'scaling_rate_x' => :'ScalingRateX',
74
+ :'scaling_rate_y' => :'ScalingRateY',
75
+ :'rotation_angle' => :'RotationAngle'
76
+ }
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.swagger_types
81
+ {
82
+ :'line_width' => :'Float',
83
+ :'color' => :'Color',
84
+ :'dash_array' => :'Array<Integer>',
85
+ :'dash_phase' => :'Integer',
86
+ :'fill_color' => :'Color',
87
+ :'is_doubled' => :'BOOLEAN',
88
+ :'skew_angle_x' => :'Float',
89
+ :'skew_angle_y' => :'Float',
90
+ :'scaling_rate_x' => :'Float',
91
+ :'scaling_rate_y' => :'Float',
92
+ :'rotation_angle' => :'Float'
93
+ }
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ return unless attributes.is_a?(Hash)
100
+
101
+ # convert string to symbol for hash key
102
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
103
+
104
+ if attributes.has_key?(:'LineWidth')
105
+ self.line_width = attributes[:'LineWidth']
106
+ end
107
+
108
+ if attributes.has_key?(:'Color')
109
+ self.color = attributes[:'Color']
110
+ end
111
+
112
+ if attributes.has_key?(:'DashArray')
113
+ if (value = attributes[:'DashArray']).is_a?(Array)
114
+ self.dash_array = value
115
+ end
116
+ end
117
+
118
+ if attributes.has_key?(:'DashPhase')
119
+ self.dash_phase = attributes[:'DashPhase']
120
+ end
121
+
122
+ if attributes.has_key?(:'FillColor')
123
+ self.fill_color = attributes[:'FillColor']
124
+ end
125
+
126
+ if attributes.has_key?(:'IsDoubled')
127
+ self.is_doubled = attributes[:'IsDoubled']
128
+ end
129
+
130
+ if attributes.has_key?(:'SkewAngleX')
131
+ self.skew_angle_x = attributes[:'SkewAngleX']
132
+ end
133
+
134
+ if attributes.has_key?(:'SkewAngleY')
135
+ self.skew_angle_y = attributes[:'SkewAngleY']
136
+ end
137
+
138
+ if attributes.has_key?(:'ScalingRateX')
139
+ self.scaling_rate_x = attributes[:'ScalingRateX']
140
+ end
141
+
142
+ if attributes.has_key?(:'ScalingRateY')
143
+ self.scaling_rate_y = attributes[:'ScalingRateY']
144
+ end
145
+
146
+ if attributes.has_key?(:'RotationAngle')
147
+ self.rotation_angle = attributes[:'RotationAngle']
148
+ end
149
+
150
+ end
151
+
152
+ # Show invalid properties with the reasons. Usually used together with valid?
153
+ # @return Array for valid properies with the reasons
154
+ def list_invalid_properties
155
+ invalid_properties = Array.new
156
+ return invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ return true
163
+ end
164
+
165
+ # Checks equality by comparing each attribute.
166
+ # @param [Object] Object to be compared
167
+ def ==(o)
168
+ return true if self.equal?(o)
169
+ self.class == o.class &&
170
+ line_width == o.line_width &&
171
+ color == o.color &&
172
+ dash_array == o.dash_array &&
173
+ dash_phase == o.dash_phase &&
174
+ fill_color == o.fill_color &&
175
+ is_doubled == o.is_doubled &&
176
+ skew_angle_x == o.skew_angle_x &&
177
+ skew_angle_y == o.skew_angle_y &&
178
+ scaling_rate_x == o.scaling_rate_x &&
179
+ scaling_rate_y == o.scaling_rate_y &&
180
+ rotation_angle == o.rotation_angle
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Fixnum] Hash code
191
+ def hash
192
+ [line_width, color, dash_array, dash_phase, fill_color, is_doubled, skew_angle_x, skew_angle_y, scaling_rate_x, scaling_rate_y, rotation_angle].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def build_from_hash(attributes)
199
+ return nil unless attributes.is_a?(Hash)
200
+ self.class.swagger_types.each_pair do |key, type|
201
+ if type =~ /\AArray<(.*)>/i
202
+ # check to ensure the input is an array given that the the attribute
203
+ # is documented as an array but the input is not
204
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
205
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
206
+ end
207
+ elsif !attributes[self.class.attribute_map[key]].nil?
208
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
209
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
210
+ end
211
+
212
+ self
213
+ end
214
+
215
+ # Deserializes the data based on type
216
+ # @param string type Data type
217
+ # @param string value Value to be deserialized
218
+ # @return [Object] Deserialized data
219
+ def _deserialize(type, value)
220
+ case type.to_sym
221
+ when :DateTime
222
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
223
+ Time.strptime(value, format).utc.to_datetime
224
+ when :Date
225
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
226
+ Time.strptime(value, format).utc.to_datetime.to_date
227
+ when :String
228
+ value.to_s
229
+ when :Integer
230
+ value.to_i
231
+ when :Float
232
+ value.to_f
233
+ when :BOOLEAN
234
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
235
+ true
236
+ else
237
+ false
238
+ end
239
+ when :Object
240
+ # generic object (usually a Hash), return directly
241
+ value
242
+ when /\AArray<(?<inner_type>.+)>\z/
243
+ inner_type = Regexp.last_match[:inner_type]
244
+ value.map { |v| _deserialize(inner_type, v) }
245
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
246
+ k_type = Regexp.last_match[:k_type]
247
+ v_type = Regexp.last_match[:v_type]
248
+ {}.tap do |hash|
249
+ value.each do |k, v|
250
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
251
+ end
252
+ end
253
+ else # model
254
+ temp_model = AsposePdfCloud.const_get(type).new
255
+ temp_model.build_from_hash(value)
256
+ end
257
+ end
258
+
259
+ # Returns the string representation of the object
260
+ # @return [String] String presentation of the object
261
+ def to_s
262
+ to_hash.to_s
263
+ end
264
+
265
+ # to_body is an alias to to_hash (backward compatibility)
266
+ # @return [Hash] Returns the object in the form of hash
267
+ def to_body
268
+ to_hash
269
+ end
270
+
271
+ # Returns the object in the form of hash
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_hash
274
+ hash = {}
275
+ self.class.attribute_map.each_pair do |attr, param|
276
+ value = self.send(attr)
277
+ next if value.nil?
278
+ hash[param] = _to_hash(value)
279
+ end
280
+ hash
281
+ end
282
+
283
+ # Outputs non-array value in the form of hash
284
+ # For object, use to_hash. Otherwise, just return the value
285
+ # @param [Object] value Any valid value
286
+ # @return [Hash] Returns the value in the form of hash
287
+ def _to_hash(value)
288
+ if value.is_a?(Array)
289
+ value.compact.map{ |v| _to_hash(v) }
290
+ elsif value.is_a?(Hash)
291
+ {}.tap do |hash|
292
+ value.each { |k, v| hash[k] = _to_hash(v) }
293
+ end
294
+ elsif value.respond_to? :to_hash
295
+ value.to_hash
296
+ else
297
+ value
298
+ end
299
+ end
300
+
301
+ end
302
+
303
+ 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 image footer.
27
+ class ImageFooter
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
+ # Gets or sets the file name.
56
+ attr_accessor :file_name
57
+
58
+ # Gets or sets image width. Setting this property allos to scal image horizontally.
59
+ attr_accessor :width
60
+
61
+ # Gets or sets image height. Setting this image allows to scale image vertically.
62
+ attr_accessor :height
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
+ :'file_name' => :'FileName',
87
+ :'width' => :'Width',
88
+ :'height' => :'Height',
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
+ :'file_name' => :'String',
108
+ :'width' => :'Float',
109
+ :'height' => :'Float',
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?(:'FileName')
163
+ self.file_name = attributes[:'FileName']
164
+ end
165
+
166
+ if attributes.has_key?(:'Width')
167
+ self.width = attributes[:'Width']
168
+ end
169
+
170
+ if attributes.has_key?(:'Height')
171
+ self.height = attributes[:'Height']
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
+ file_name == o.file_name &&
216
+ width == o.width &&
217
+ height == o.height &&
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, file_name, width, height, 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