aspose_pdf_cloud 1.0.2 → 18.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +42 -0
  3. data/.swagger-codegen-ignore +58 -0
  4. data/.swagger-codegen/VERSION +1 -0
  5. data/LICENSE +21 -22
  6. data/README.md +51 -43
  7. data/aspose_pdf_cloud.gemspec +32 -8
  8. data/lib/aspose_pdf_cloud.rb +93 -58
  9. data/lib/aspose_pdf_cloud/api/pdf_api.rb +2624 -1916
  10. data/lib/aspose_pdf_cloud/api_client.rb +280 -92
  11. data/lib/aspose_pdf_cloud/api_error.rb +29 -6
  12. data/lib/aspose_pdf_cloud/configuration.rb +86 -63
  13. data/lib/aspose_pdf_cloud/models/annotation.rb +218 -45
  14. data/lib/aspose_pdf_cloud/models/annotation_response.rb +195 -34
  15. data/lib/aspose_pdf_cloud/models/annotations.rb +187 -25
  16. data/lib/aspose_pdf_cloud/models/annotations_response.rb +195 -34
  17. data/lib/aspose_pdf_cloud/models/append_document.rb +198 -23
  18. data/lib/aspose_pdf_cloud/models/attachment.rb +224 -49
  19. data/lib/aspose_pdf_cloud/models/attachment_response.rb +195 -34
  20. data/lib/aspose_pdf_cloud/models/attachments.rb +187 -25
  21. data/lib/aspose_pdf_cloud/models/attachments_response.rb +195 -34
  22. data/lib/aspose_pdf_cloud/models/bookmarks.rb +187 -25
  23. data/lib/aspose_pdf_cloud/models/bookmarks_response.rb +195 -34
  24. data/lib/aspose_pdf_cloud/models/color.rb +214 -31
  25. data/lib/aspose_pdf_cloud/models/document.rb +194 -29
  26. data/lib/aspose_pdf_cloud/models/document_pages_response.rb +195 -34
  27. data/lib/aspose_pdf_cloud/models/document_properties.rb +187 -25
  28. data/lib/aspose_pdf_cloud/models/document_properties_response.rb +195 -34
  29. data/lib/aspose_pdf_cloud/models/document_property.rb +197 -33
  30. data/lib/aspose_pdf_cloud/models/document_property_response.rb +195 -34
  31. data/lib/aspose_pdf_cloud/models/document_response.rb +206 -34
  32. data/lib/aspose_pdf_cloud/models/document_text_replace_response.rb +203 -41
  33. data/lib/aspose_pdf_cloud/models/field.rb +213 -42
  34. data/lib/aspose_pdf_cloud/models/field_response.rb +195 -34
  35. data/lib/aspose_pdf_cloud/models/field_type.rb +44 -0
  36. data/lib/aspose_pdf_cloud/models/fields.rb +187 -25
  37. data/lib/aspose_pdf_cloud/models/fields_response.rb +195 -34
  38. data/lib/aspose_pdf_cloud/models/font_styles.rb +43 -0
  39. data/lib/aspose_pdf_cloud/models/horizontal_alignment.rb +44 -0
  40. data/lib/aspose_pdf_cloud/models/http_status_code.rb +87 -0
  41. data/lib/aspose_pdf_cloud/models/image.rb +194 -29
  42. data/lib/aspose_pdf_cloud/models/image_response.rb +195 -34
  43. data/lib/aspose_pdf_cloud/models/images.rb +187 -25
  44. data/lib/aspose_pdf_cloud/models/images_list_request.rb +205 -0
  45. data/lib/aspose_pdf_cloud/models/images_response.rb +195 -34
  46. data/lib/aspose_pdf_cloud/models/line_spacing.rb +43 -0
  47. data/lib/aspose_pdf_cloud/models/link.rb +194 -27
  48. data/lib/aspose_pdf_cloud/models/link_action_type.rb +46 -0
  49. data/lib/aspose_pdf_cloud/models/link_annotation.rb +204 -39
  50. data/lib/aspose_pdf_cloud/models/link_annotation_response.rb +195 -34
  51. data/lib/aspose_pdf_cloud/models/link_annotations.rb +187 -25
  52. data/lib/aspose_pdf_cloud/models/link_annotations_response.rb +195 -34
  53. data/lib/aspose_pdf_cloud/models/link_element.rb +175 -14
  54. data/lib/aspose_pdf_cloud/models/link_highlighting_mode.rb +45 -0
  55. data/lib/aspose_pdf_cloud/models/merge_documents.rb +175 -14
  56. data/lib/aspose_pdf_cloud/models/optimize_options.rb +293 -0
  57. data/lib/aspose_pdf_cloud/models/page.rb +198 -33
  58. data/lib/aspose_pdf_cloud/models/page_text_replace_response.rb +203 -41
  59. data/lib/aspose_pdf_cloud/models/page_word_count.rb +192 -19
  60. data/lib/aspose_pdf_cloud/models/pages.rb +187 -25
  61. data/lib/aspose_pdf_cloud/models/paragraph.rb +303 -0
  62. data/lib/aspose_pdf_cloud/models/rectangle.rb +210 -27
  63. data/lib/aspose_pdf_cloud/models/rotation.rb +44 -0
  64. data/lib/aspose_pdf_cloud/models/saa_spose_response.rb +213 -0
  65. data/lib/aspose_pdf_cloud/models/segment.rb +206 -0
  66. data/lib/aspose_pdf_cloud/models/signature.rb +278 -54
  67. data/lib/aspose_pdf_cloud/models/signature_type.rb +42 -0
  68. data/lib/aspose_pdf_cloud/models/split_result.rb +175 -14
  69. data/lib/aspose_pdf_cloud/models/split_result_document.rb +206 -37
  70. data/lib/aspose_pdf_cloud/models/split_result_response.rb +196 -34
  71. data/lib/aspose_pdf_cloud/models/stamp.rb +312 -104
  72. data/lib/aspose_pdf_cloud/models/stamp_type.rb +44 -0
  73. data/lib/aspose_pdf_cloud/models/text_format.rb +197 -33
  74. data/lib/aspose_pdf_cloud/models/text_format_response.rb +195 -34
  75. data/lib/aspose_pdf_cloud/models/text_horizontal_alignment.rb +47 -0
  76. data/lib/aspose_pdf_cloud/models/text_item.rb +192 -29
  77. data/lib/aspose_pdf_cloud/models/text_item_response.rb +195 -34
  78. data/lib/aspose_pdf_cloud/models/text_items.rb +187 -25
  79. data/lib/aspose_pdf_cloud/models/text_items_response.rb +195 -34
  80. data/lib/aspose_pdf_cloud/models/text_line.rb +210 -0
  81. data/lib/aspose_pdf_cloud/models/text_rect.rb +220 -0
  82. data/lib/aspose_pdf_cloud/models/text_rects.rb +199 -0
  83. data/lib/aspose_pdf_cloud/models/text_rects_response.rb +222 -0
  84. data/lib/aspose_pdf_cloud/models/text_replace.rb +225 -25
  85. data/lib/aspose_pdf_cloud/models/text_replace_list_request.rb +209 -16
  86. data/lib/aspose_pdf_cloud/models/text_replace_request.rb +262 -0
  87. data/lib/aspose_pdf_cloud/models/text_replace_response.rb +222 -0
  88. data/lib/aspose_pdf_cloud/models/text_state.rb +211 -32
  89. data/lib/aspose_pdf_cloud/models/tiff_export_options.rb +266 -75
  90. data/lib/aspose_pdf_cloud/models/vertical_alignment.rb +45 -0
  91. data/lib/aspose_pdf_cloud/models/word_count.rb +174 -14
  92. data/lib/aspose_pdf_cloud/models/word_count_response.rb +196 -34
  93. data/lib/aspose_pdf_cloud/models/wrap_mode.rb +44 -0
  94. data/lib/aspose_pdf_cloud/version.rb +23 -2
  95. data/test/pdf_tests.rb +1268 -623
  96. data/test_data/33539.jpg +0 -0
  97. data/test_data/44781.jpg +0 -0
  98. data/test_data/4pages.pdf +0 -0
  99. data/test_data/BlankWithSignature.pdf +0 -0
  100. data/test_data/Hello_world.pdf +0 -0
  101. data/test_data/HtmlExample1.html +27 -0
  102. data/test_data/Koala.jpg +0 -0
  103. data/test_data/PdfWithAcroForm.pdf +321 -0
  104. data/test_data/PdfWithAnnotations.pdf +720 -1
  105. data/test_data/PdfWithBookmarks.pdf +0 -0
  106. data/test_data/PdfWithEmbeddedFiles.pdf +0 -0
  107. data/test_data/PdfWithImages2.pdf +0 -0
  108. data/test_data/PdfWithLinks.pdf +0 -0
  109. data/test_data/Penguins.jpg +0 -0
  110. data/test_data/butterfly.jpg +0 -0
  111. data/test_data/marketing.pdf +0 -0
  112. data/test_data/rusdoc.pdf +0 -0
  113. data/test_data/test1234.pfx +0 -0
  114. metadata +54 -13
  115. data/lib/aspose_pdf_cloud/models/barcode_response_list.rb +0 -45
  116. data/lib/aspose_pdf_cloud/models/base_object.rb +0 -86
  117. data/lib/aspose_pdf_cloud/models/base_response.rb +0 -61
  118. data/lib/aspose_pdf_cloud/models/page_response.rb +0 -61
@@ -1,98 +1,142 @@
1
- module AsposePDFCloud
2
- #
3
- class Stamp < BaseObject
4
- attr_accessor :type, :background, :bottom_margin, :horizontal_alignment, :left_margin, :opacity, :right_margin, :rotate, :rotate_angle, :top_margin, :vertical_alignment, :x_indent, :y_indent, :zoom, :text_alignment, :value, :text_state, :file_name, :width, :height, :page_index, :starting_number
5
- # attribute mapping from ruby-style variable name to JSON key
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2018 Aspose.Pdf for 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
+
24
+ module AsposePdfCloud
25
+ # Represents Pdf stamps.
26
+ class Stamp
27
+ # Gets the stamp type.
28
+ attr_accessor :type
29
+
30
+ # 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.
31
+ attr_accessor :background
32
+
33
+ # Gets or sets bottom margin of stamp.
34
+ attr_accessor :bottom_margin
35
+
36
+ # Gets or sets Horizontal alignment of stamp on the page.
37
+ attr_accessor :horizontal_alignment
38
+
39
+ # Gets or sets left margin of stamp.
40
+ attr_accessor :left_margin
41
+
42
+ # 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.
43
+ attr_accessor :opacity
44
+
45
+ # Gets or sets right margin of stamp.
46
+ attr_accessor :right_margin
47
+
48
+ # 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.
49
+ attr_accessor :rotate
50
+
51
+ # Gets or sets rotate angle of stamp in degrees. This property allows to set arbitrary rotate angle.
52
+ attr_accessor :rotate_angle
53
+
54
+ # Gets or sets top margin of stamp.
55
+ attr_accessor :top_margin
56
+
57
+ # Gets or sets vertical alignment of stamp on page.
58
+ attr_accessor :vertical_alignment
59
+
60
+ # Horizontal stamp coordinate, starting from the left.
61
+ attr_accessor :x_indent
62
+
63
+ # Vertical stamp coordinate, starting from the bottom.
64
+ attr_accessor :y_indent
65
+
66
+ # Zooming factor of the stamp. Allows to scale stamp.
67
+ attr_accessor :zoom
68
+
69
+ # Alignment of the text inside the stamp.
70
+ attr_accessor :text_alignment
71
+
72
+ # Gets or sets string value which is used as stamp on the page.
73
+ attr_accessor :value
74
+
75
+ # Gets text properties of the stamp. See for details.
76
+ attr_accessor :text_state
77
+
78
+ # Gets or sets the file name.
79
+ attr_accessor :file_name
80
+
81
+ # Gets or sets image width. Setting this property allos to scal image horizontally.
82
+ attr_accessor :width
83
+
84
+ # Gets or sets image height. Setting this image allows to scale image vertically.
85
+ attr_accessor :height
86
+
87
+ # Gets or sets the index of the page.
88
+ attr_accessor :page_index
89
+
90
+ # Gets or sets value of the number of starting page. Other pages will be numbered starting from this value.
91
+ attr_accessor :starting_number
92
+
93
+
94
+ # Attribute mapping from ruby-style variable name to JSON key.
6
95
  def self.attribute_map
7
96
  {
8
-
9
- #
10
97
  :'type' => :'Type',
11
-
12
- #
13
98
  :'background' => :'Background',
14
-
15
- #
16
99
  :'bottom_margin' => :'BottomMargin',
17
-
18
- #
19
100
  :'horizontal_alignment' => :'HorizontalAlignment',
20
-
21
- #
22
101
  :'left_margin' => :'LeftMargin',
23
-
24
- #
25
102
  :'opacity' => :'Opacity',
26
-
27
- #
28
103
  :'right_margin' => :'RightMargin',
29
-
30
- #
31
104
  :'rotate' => :'Rotate',
32
-
33
- #
34
105
  :'rotate_angle' => :'RotateAngle',
35
-
36
- #
37
106
  :'top_margin' => :'TopMargin',
38
-
39
- #
40
107
  :'vertical_alignment' => :'VerticalAlignment',
41
-
42
- #
43
108
  :'x_indent' => :'XIndent',
44
-
45
- #
46
109
  :'y_indent' => :'YIndent',
47
-
48
- #
49
110
  :'zoom' => :'Zoom',
50
-
51
- #
52
111
  :'text_alignment' => :'TextAlignment',
53
-
54
- #
55
112
  :'value' => :'Value',
56
-
57
- #
58
113
  :'text_state' => :'TextState',
59
-
60
- #
61
114
  :'file_name' => :'FileName',
62
-
63
- #
64
115
  :'width' => :'Width',
65
-
66
- #
67
116
  :'height' => :'Height',
68
-
69
- #
70
117
  :'page_index' => :'PageIndex',
71
-
72
- #
73
118
  :'starting_number' => :'StartingNumber'
74
-
75
119
  }
76
120
  end
77
121
 
78
- # attribute type
122
+ # Attribute type mapping.
79
123
  def self.swagger_types
80
124
  {
81
- :'type' => :'String',
125
+ :'type' => :'StampType',
82
126
  :'background' => :'BOOLEAN',
83
127
  :'bottom_margin' => :'Float',
84
- :'horizontal_alignment' => :'String',
128
+ :'horizontal_alignment' => :'HorizontalAlignment',
85
129
  :'left_margin' => :'Float',
86
130
  :'opacity' => :'Float',
87
131
  :'right_margin' => :'Float',
88
- :'rotate' => :'String',
132
+ :'rotate' => :'Rotation',
89
133
  :'rotate_angle' => :'Float',
90
134
  :'top_margin' => :'Float',
91
- :'vertical_alignment' => :'String',
135
+ :'vertical_alignment' => :'VerticalAlignment',
92
136
  :'x_indent' => :'Float',
93
137
  :'y_indent' => :'Float',
94
138
  :'zoom' => :'Float',
95
- :'text_alignment' => :'String',
139
+ :'text_alignment' => :'HorizontalAlignment',
96
140
  :'value' => :'String',
97
141
  :'text_state' => :'TextState',
98
142
  :'file_name' => :'String',
@@ -100,106 +144,270 @@ module AsposePDFCloud
100
144
  :'height' => :'Float',
101
145
  :'page_index' => :'Integer',
102
146
  :'starting_number' => :'Integer'
103
-
104
147
  }
105
148
  end
106
149
 
150
+ # Initializes the object
151
+ # @param [Hash] attributes Model attributes in the form of hash
107
152
  def initialize(attributes = {})
108
- return if !attributes.is_a?(Hash) || attributes.empty?
153
+ return unless attributes.is_a?(Hash)
109
154
 
110
155
  # convert string to symbol for hash key
111
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
156
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
112
157
 
113
-
114
- if attributes[:'Type']
158
+ if attributes.has_key?(:'Type')
115
159
  self.type = attributes[:'Type']
116
160
  end
117
-
118
- if attributes[:'Background']
161
+
162
+ if attributes.has_key?(:'Background')
119
163
  self.background = attributes[:'Background']
120
164
  end
121
-
122
- if attributes[:'BottomMargin']
165
+
166
+ if attributes.has_key?(:'BottomMargin')
123
167
  self.bottom_margin = attributes[:'BottomMargin']
124
168
  end
125
-
126
- if attributes[:'HorizontalAlignment']
169
+
170
+ if attributes.has_key?(:'HorizontalAlignment')
127
171
  self.horizontal_alignment = attributes[:'HorizontalAlignment']
128
172
  end
129
-
130
- if attributes[:'LeftMargin']
173
+
174
+ if attributes.has_key?(:'LeftMargin')
131
175
  self.left_margin = attributes[:'LeftMargin']
132
176
  end
133
-
134
- if attributes[:'Opacity']
177
+
178
+ if attributes.has_key?(:'Opacity')
135
179
  self.opacity = attributes[:'Opacity']
136
180
  end
137
-
138
- if attributes[:'RightMargin']
181
+
182
+ if attributes.has_key?(:'RightMargin')
139
183
  self.right_margin = attributes[:'RightMargin']
140
184
  end
141
-
142
- if attributes[:'Rotate']
185
+
186
+ if attributes.has_key?(:'Rotate')
143
187
  self.rotate = attributes[:'Rotate']
144
188
  end
145
-
146
- if attributes[:'RotateAngle']
189
+
190
+ if attributes.has_key?(:'RotateAngle')
147
191
  self.rotate_angle = attributes[:'RotateAngle']
148
192
  end
149
-
150
- if attributes[:'TopMargin']
193
+
194
+ if attributes.has_key?(:'TopMargin')
151
195
  self.top_margin = attributes[:'TopMargin']
152
196
  end
153
-
154
- if attributes[:'VerticalAlignment']
197
+
198
+ if attributes.has_key?(:'VerticalAlignment')
155
199
  self.vertical_alignment = attributes[:'VerticalAlignment']
156
200
  end
157
-
158
- if attributes[:'XIndent']
201
+
202
+ if attributes.has_key?(:'XIndent')
159
203
  self.x_indent = attributes[:'XIndent']
160
204
  end
161
-
162
- if attributes[:'YIndent']
205
+
206
+ if attributes.has_key?(:'YIndent')
163
207
  self.y_indent = attributes[:'YIndent']
164
208
  end
165
-
166
- if attributes[:'Zoom']
209
+
210
+ if attributes.has_key?(:'Zoom')
167
211
  self.zoom = attributes[:'Zoom']
168
212
  end
169
-
170
- if attributes[:'TextAlignment']
213
+
214
+ if attributes.has_key?(:'TextAlignment')
171
215
  self.text_alignment = attributes[:'TextAlignment']
172
216
  end
173
-
174
- if attributes[:'Value']
217
+
218
+ if attributes.has_key?(:'Value')
175
219
  self.value = attributes[:'Value']
176
220
  end
177
-
178
- if attributes[:'TextState']
221
+
222
+ if attributes.has_key?(:'TextState')
179
223
  self.text_state = attributes[:'TextState']
180
224
  end
181
-
182
- if attributes[:'FileName']
225
+
226
+ if attributes.has_key?(:'FileName')
183
227
  self.file_name = attributes[:'FileName']
184
228
  end
185
-
186
- if attributes[:'Width']
229
+
230
+ if attributes.has_key?(:'Width')
187
231
  self.width = attributes[:'Width']
188
232
  end
189
-
190
- if attributes[:'Height']
233
+
234
+ if attributes.has_key?(:'Height')
191
235
  self.height = attributes[:'Height']
192
236
  end
193
-
194
- if attributes[:'PageIndex']
237
+
238
+ if attributes.has_key?(:'PageIndex')
195
239
  self.page_index = attributes[:'PageIndex']
196
240
  end
197
-
198
- if attributes[:'StartingNumber']
241
+
242
+ if attributes.has_key?(:'StartingNumber')
199
243
  self.starting_number = attributes[:'StartingNumber']
200
244
  end
201
-
245
+
246
+ end
247
+
248
+ # Show invalid properties with the reasons. Usually used together with valid?
249
+ # @return Array for valid properies with the reasons
250
+ def list_invalid_properties
251
+ invalid_properties = Array.new
252
+ if @type.nil?
253
+ invalid_properties.push("invalid value for 'type', type cannot be nil.")
254
+ end
255
+
256
+ return invalid_properties
257
+ end
258
+
259
+ # Check to see if the all the properties in the model are valid
260
+ # @return true if the model is valid
261
+ def valid?
262
+ return false if @type.nil?
263
+ return true
264
+ end
265
+
266
+ # Checks equality by comparing each attribute.
267
+ # @param [Object] Object to be compared
268
+ def ==(o)
269
+ return true if self.equal?(o)
270
+ self.class == o.class &&
271
+ type == o.type &&
272
+ background == o.background &&
273
+ bottom_margin == o.bottom_margin &&
274
+ horizontal_alignment == o.horizontal_alignment &&
275
+ left_margin == o.left_margin &&
276
+ opacity == o.opacity &&
277
+ right_margin == o.right_margin &&
278
+ rotate == o.rotate &&
279
+ rotate_angle == o.rotate_angle &&
280
+ top_margin == o.top_margin &&
281
+ vertical_alignment == o.vertical_alignment &&
282
+ x_indent == o.x_indent &&
283
+ y_indent == o.y_indent &&
284
+ zoom == o.zoom &&
285
+ text_alignment == o.text_alignment &&
286
+ value == o.value &&
287
+ text_state == o.text_state &&
288
+ file_name == o.file_name &&
289
+ width == o.width &&
290
+ height == o.height &&
291
+ page_index == o.page_index &&
292
+ starting_number == o.starting_number
293
+ end
294
+
295
+ # @see the `==` method
296
+ # @param [Object] Object to be compared
297
+ def eql?(o)
298
+ self == o
299
+ end
300
+
301
+ # Calculates hash code according to all attributes.
302
+ # @return [Fixnum] Hash code
303
+ def hash
304
+ [type, background, bottom_margin, horizontal_alignment, left_margin, opacity, right_margin, rotate, rotate_angle, top_margin, vertical_alignment, x_indent, y_indent, zoom, text_alignment, value, text_state, file_name, width, height, page_index, starting_number].hash
305
+ end
306
+
307
+ # Builds the object from hash
308
+ # @param [Hash] attributes Model attributes in the form of hash
309
+ # @return [Object] Returns the model itself
310
+ def build_from_hash(attributes)
311
+ return nil unless attributes.is_a?(Hash)
312
+ self.class.swagger_types.each_pair do |key, type|
313
+ if type =~ /\AArray<(.*)>/i
314
+ # check to ensure the input is an array given that the the attribute
315
+ # is documented as an array but the input is not
316
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
317
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
318
+ end
319
+ elsif !attributes[self.class.attribute_map[key]].nil?
320
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
321
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
322
+ end
323
+
324
+ self
325
+ end
326
+
327
+ # Deserializes the data based on type
328
+ # @param string type Data type
329
+ # @param string value Value to be deserialized
330
+ # @return [Object] Deserialized data
331
+ def _deserialize(type, value)
332
+ case type.to_sym
333
+ when :DateTime
334
+ DateTime.parse(value)
335
+ when :Date
336
+ Date.parse(value)
337
+ when :String
338
+ value.to_s
339
+ when :Integer
340
+ value.to_i
341
+ when :Float
342
+ value.to_f
343
+ when :BOOLEAN
344
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
345
+ true
346
+ else
347
+ false
348
+ end
349
+ when :Object
350
+ # generic object (usually a Hash), return directly
351
+ value
352
+ when /\AArray<(?<inner_type>.+)>\z/
353
+ inner_type = Regexp.last_match[:inner_type]
354
+ value.map { |v| _deserialize(inner_type, v) }
355
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
356
+ k_type = Regexp.last_match[:k_type]
357
+ v_type = Regexp.last_match[:v_type]
358
+ {}.tap do |hash|
359
+ value.each do |k, v|
360
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
361
+ end
362
+ end
363
+ else # model
364
+ temp_model = AsposePdfCloud.const_get(type).new
365
+ temp_model.build_from_hash(value)
366
+ end
367
+ end
368
+
369
+ # Returns the string representation of the object
370
+ # @return [String] String presentation of the object
371
+ def to_s
372
+ to_hash.to_s
373
+ end
374
+
375
+ # to_body is an alias to to_hash (backward compatibility)
376
+ # @return [Hash] Returns the object in the form of hash
377
+ def to_body
378
+ to_hash
379
+ end
380
+
381
+ # Returns the object in the form of hash
382
+ # @return [Hash] Returns the object in the form of hash
383
+ def to_hash
384
+ hash = {}
385
+ self.class.attribute_map.each_pair do |attr, param|
386
+ value = self.send(attr)
387
+ next if value.nil?
388
+ hash[param] = _to_hash(value)
389
+ end
390
+ hash
391
+ end
392
+
393
+ # Outputs non-array value in the form of hash
394
+ # For object, use to_hash. Otherwise, just return the value
395
+ # @param [Object] value Any valid value
396
+ # @return [Hash] Returns the value in the form of hash
397
+ def _to_hash(value)
398
+ if value.is_a?(Array)
399
+ value.compact.map{ |v| _to_hash(v) }
400
+ elsif value.is_a?(Hash)
401
+ {}.tap do |hash|
402
+ value.each { |k, v| hash[k] = _to_hash(v) }
403
+ end
404
+ elsif value.respond_to? :to_hash
405
+ value.to_hash
406
+ else
407
+ value
408
+ end
202
409
  end
203
410
 
204
411
  end
412
+
205
413
  end