aspose_pdf_cloud 18.9.0 → 18.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +362 -3
  3. data/docs/Annotation.md +22 -0
  4. data/docs/AnnotationFlags.md +20 -0
  5. data/docs/AnnotationInfo.md +23 -0
  6. data/docs/AnnotationState.md +17 -0
  7. data/docs/AnnotationType.md +37 -0
  8. data/docs/AnnotationsInfo.md +10 -0
  9. data/docs/AnnotationsInfoResponse.md +11 -0
  10. data/docs/AntialiasingProcessingType.md +11 -0
  11. data/docs/AppendDocument.md +11 -0
  12. data/docs/AsposeResponse.md +10 -0
  13. data/docs/Attachment.md +16 -0
  14. data/docs/AttachmentResponse.md +11 -0
  15. data/docs/Attachments.md +10 -0
  16. data/docs/AttachmentsResponse.md +11 -0
  17. data/docs/CaptionPosition.md +11 -0
  18. data/docs/CircleAnnotation.md +26 -0
  19. data/docs/CircleAnnotationResponse.md +11 -0
  20. data/docs/CircleAnnotations.md +10 -0
  21. data/docs/CircleAnnotationsResponse.md +11 -0
  22. data/docs/Color.md +12 -0
  23. data/docs/ColorDepth.md +13 -0
  24. data/docs/CommonFigureAnnotation.md +25 -0
  25. data/docs/CompressionType.md +14 -0
  26. data/docs/DocFormat.md +11 -0
  27. data/docs/DocRecognitionMode.md +11 -0
  28. data/docs/Document.md +11 -0
  29. data/docs/DocumentPageResponse.md +11 -0
  30. data/docs/DocumentPagesResponse.md +11 -0
  31. data/docs/DocumentPrivilege.md +19 -0
  32. data/docs/DocumentProperties.md +10 -0
  33. data/docs/DocumentPropertiesResponse.md +11 -0
  34. data/docs/DocumentProperty.md +12 -0
  35. data/docs/DocumentPropertyResponse.md +11 -0
  36. data/docs/DocumentResponse.md +12 -0
  37. data/docs/EpubRecognitionMode.md +17 -0
  38. data/docs/Field.md +14 -0
  39. data/docs/FieldResponse.md +11 -0
  40. data/docs/FieldType.md +13 -0
  41. data/docs/Fields.md +10 -0
  42. data/docs/FieldsResponse.md +11 -0
  43. data/docs/FontEncodingRules.md +11 -0
  44. data/docs/FontSavingModes.md +15 -0
  45. data/docs/FontStyles.md +13 -0
  46. data/docs/FreeTextAnnotation.md +27 -0
  47. data/docs/FreeTextAnnotationResponse.md +11 -0
  48. data/docs/FreeTextAnnotations.md +10 -0
  49. data/docs/FreeTextAnnotationsResponse.md +11 -0
  50. data/docs/FreeTextIntent.md +12 -0
  51. data/docs/HorizontalAlignment.md +13 -0
  52. data/docs/HtmlDocumentType.md +11 -0
  53. data/docs/HtmlMarkupGenerationModes.md +14 -0
  54. data/docs/Image.md +14 -0
  55. data/docs/ImageResponse.md +11 -0
  56. data/docs/ImageSrcType.md +11 -0
  57. data/docs/ImageTemplate.md +17 -0
  58. data/docs/ImageTemplatesRequest.md +11 -0
  59. data/docs/Images.md +10 -0
  60. data/docs/ImagesResponse.md +11 -0
  61. data/docs/Justification.md +12 -0
  62. data/docs/LettersPositioningMethods.md +12 -0
  63. data/docs/LineAnnotation.md +36 -0
  64. data/docs/LineAnnotationResponse.md +11 -0
  65. data/docs/LineAnnotations.md +10 -0
  66. data/docs/LineAnnotationsResponse.md +11 -0
  67. data/docs/LineEnding.md +19 -0
  68. data/docs/LineIntent.md +12 -0
  69. data/docs/LineSpacing.md +11 -0
  70. data/docs/Link.md +13 -0
  71. data/docs/LinkActionType.md +15 -0
  72. data/docs/LinkAnnotation.md +15 -0
  73. data/docs/LinkAnnotationResponse.md +11 -0
  74. data/docs/LinkAnnotations.md +10 -0
  75. data/docs/LinkAnnotationsResponse.md +11 -0
  76. data/docs/LinkElement.md +9 -0
  77. data/docs/LinkHighlightingMode.md +14 -0
  78. data/docs/MarginInfo.md +12 -0
  79. data/docs/MarkupAnnotation.md +23 -0
  80. data/docs/MergeDocuments.md +9 -0
  81. data/docs/OptimizeOptions.md +15 -0
  82. data/docs/Page.md +12 -0
  83. data/docs/PageWordCount.md +10 -0
  84. data/docs/Pages.md +10 -0
  85. data/docs/Paragraph.md +20 -0
  86. data/docs/PartsEmbeddingModes.md +15 -0
  87. data/docs/PdfAType.md +11 -0
  88. data/docs/PdfApi.md +4961 -0
  89. data/docs/Point.md +10 -0
  90. data/docs/PolyAnnotation.md +28 -0
  91. data/docs/PolyIntent.md +13 -0
  92. data/docs/PolyLineAnnotation.md +29 -0
  93. data/docs/PolyLineAnnotationResponse.md +11 -0
  94. data/docs/PolyLineAnnotations.md +10 -0
  95. data/docs/PolyLineAnnotationsResponse.md +11 -0
  96. data/docs/PolygonAnnotation.md +29 -0
  97. data/docs/PolygonAnnotationResponse.md +11 -0
  98. data/docs/PolygonAnnotations.md +10 -0
  99. data/docs/PolygonAnnotationsResponse.md +11 -0
  100. data/docs/RasterImagesSavingModes.md +15 -0
  101. data/docs/RectanglePdf.md +12 -0
  102. data/docs/Rotation.md +13 -0
  103. data/docs/Segment.md +10 -0
  104. data/docs/ShapeType.md +12 -0
  105. data/docs/Signature.md +21 -0
  106. data/docs/SignatureType.md +12 -0
  107. data/docs/SignatureVerifyResponse.md +11 -0
  108. data/docs/SplitResult.md +9 -0
  109. data/docs/SplitResultDocument.md +13 -0
  110. data/docs/SplitResultResponse.md +11 -0
  111. data/docs/SquareAnnotation.md +26 -0
  112. data/docs/SquareAnnotationResponse.md +11 -0
  113. data/docs/SquareAnnotations.md +10 -0
  114. data/docs/SquareAnnotationsResponse.md +11 -0
  115. data/docs/Stamp.md +30 -0
  116. data/docs/StampType.md +13 -0
  117. data/docs/TextAnnotation.md +27 -0
  118. data/docs/TextAnnotationResponse.md +11 -0
  119. data/docs/TextAnnotations.md +10 -0
  120. data/docs/TextAnnotationsResponse.md +11 -0
  121. data/docs/TextHorizontalAlignment.md +15 -0
  122. data/docs/TextIcon.md +20 -0
  123. data/docs/TextLine.md +10 -0
  124. data/docs/TextRect.md +11 -0
  125. data/docs/TextRects.md +9 -0
  126. data/docs/TextRectsResponse.md +11 -0
  127. data/docs/TextReplace.md +13 -0
  128. data/docs/TextReplaceListRequest.md +12 -0
  129. data/docs/TextReplaceResponse.md +11 -0
  130. data/docs/TextState.md +13 -0
  131. data/docs/TextStyle.md +12 -0
  132. data/docs/VerticalAlignment.md +13 -0
  133. data/docs/WordCount.md +9 -0
  134. data/docs/WordCountResponse.md +11 -0
  135. data/docs/WrapMode.md +12 -0
  136. data/lib/aspose_pdf_cloud.rb +27 -0
  137. data/lib/aspose_pdf_cloud/api/pdf_api.rb +3632 -1662
  138. data/lib/aspose_pdf_cloud/models/caption_position.rb +43 -0
  139. data/lib/aspose_pdf_cloud/models/circle_annotation.rb +372 -0
  140. data/lib/aspose_pdf_cloud/models/circle_annotation_response.rb +222 -0
  141. data/lib/aspose_pdf_cloud/models/circle_annotations.rb +211 -0
  142. data/lib/aspose_pdf_cloud/models/circle_annotations_response.rb +222 -0
  143. data/lib/aspose_pdf_cloud/models/common_figure_annotation.rb +362 -0
  144. data/lib/aspose_pdf_cloud/models/line_annotation.rb +472 -0
  145. data/lib/aspose_pdf_cloud/models/line_annotation_response.rb +222 -0
  146. data/lib/aspose_pdf_cloud/models/line_annotations.rb +211 -0
  147. data/lib/aspose_pdf_cloud/models/line_annotations_response.rb +222 -0
  148. data/lib/aspose_pdf_cloud/models/line_ending.rb +51 -0
  149. data/lib/aspose_pdf_cloud/models/line_intent.rb +44 -0
  150. data/lib/aspose_pdf_cloud/models/point.rb +218 -0
  151. data/lib/aspose_pdf_cloud/models/poly_annotation.rb +394 -0
  152. data/lib/aspose_pdf_cloud/models/poly_intent.rb +45 -0
  153. data/lib/aspose_pdf_cloud/models/poly_line_annotation.rb +404 -0
  154. data/lib/aspose_pdf_cloud/models/poly_line_annotation_response.rb +222 -0
  155. data/lib/aspose_pdf_cloud/models/poly_line_annotations.rb +211 -0
  156. data/lib/aspose_pdf_cloud/models/poly_line_annotations_response.rb +222 -0
  157. data/lib/aspose_pdf_cloud/models/polygon_annotation.rb +404 -0
  158. data/lib/aspose_pdf_cloud/models/polygon_annotation_response.rb +222 -0
  159. data/lib/aspose_pdf_cloud/models/polygon_annotations.rb +211 -0
  160. data/lib/aspose_pdf_cloud/models/polygon_annotations_response.rb +222 -0
  161. data/lib/aspose_pdf_cloud/models/square_annotation.rb +372 -0
  162. data/lib/aspose_pdf_cloud/models/square_annotation_response.rb +222 -0
  163. data/lib/aspose_pdf_cloud/models/square_annotations.rb +211 -0
  164. data/lib/aspose_pdf_cloud/models/square_annotations_response.rb +222 -0
  165. data/lib/aspose_pdf_cloud/version.rb +1 -1
  166. data/test/pdf_tests.rb +483 -1
  167. metadata +162 -2
@@ -0,0 +1,472 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2018 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
+
24
+ module AsposePdfCloud
25
+ # Provides LineAnnotation.
26
+ class LineAnnotation
27
+ # Link to the document.
28
+ attr_accessor :links
29
+
30
+ # Get the annotation content.
31
+ attr_accessor :contents
32
+
33
+ # The date and time when the annotation was created.
34
+ attr_accessor :creation_date
35
+
36
+ # Get the annotation subject.
37
+ attr_accessor :subject
38
+
39
+ # Get the annotation title.
40
+ attr_accessor :title
41
+
42
+ # The date and time when the annotation was last modified.
43
+ attr_accessor :modified
44
+
45
+ # Gets ID of the annotation.
46
+ attr_accessor :id
47
+
48
+ # Gets Flags of the annotation.
49
+ attr_accessor :flags
50
+
51
+ # Gets Name of the annotation.
52
+ attr_accessor :name
53
+
54
+ # Gets Rect of the annotation.
55
+ attr_accessor :rect
56
+
57
+ # Gets PageIndex of the annotation.
58
+ attr_accessor :page_index
59
+
60
+ # Gets ZIndex of the annotation.
61
+ attr_accessor :z_index
62
+
63
+ # Gets HorizontalAlignment of the annotation.
64
+ attr_accessor :horizontal_alignment
65
+
66
+ # Gets VerticalAlignment of the annotation.
67
+ attr_accessor :vertical_alignment
68
+
69
+ # Get the annotation RichText.
70
+ attr_accessor :rich_text
71
+
72
+ # Gets or sets starting point of line.
73
+ attr_accessor :starting
74
+
75
+ # Gets or sets line ending style for line starting point.
76
+ attr_accessor :starting_style
77
+
78
+ # Gets or sets ending point of line.
79
+ attr_accessor :ending
80
+
81
+ # Gets or sets ending style for end point of line.
82
+ attr_accessor :ending_style
83
+
84
+ # Gets or sets interior color of the annotation.
85
+ attr_accessor :interior_color
86
+
87
+ # Gets or sets leader line length.
88
+ attr_accessor :leader_line
89
+
90
+ # Gets or sets length of leader line extension.
91
+ attr_accessor :leader_line_extension
92
+
93
+ # Gets or sets leader line offset.
94
+ attr_accessor :leader_line_offset
95
+
96
+ # Gets or sets boolean flag which determinies is contents must be shown as caption.
97
+ attr_accessor :show_caption
98
+
99
+ # Gets or sets caption text offset from its normal position.
100
+ attr_accessor :caption_offset
101
+
102
+ # Gets or sets annotation caption position.
103
+ attr_accessor :caption_position
104
+
105
+ # Color of the annotation.
106
+ attr_accessor :color
107
+
108
+ # Gets or sets the intent of the line annotation.
109
+ attr_accessor :intent
110
+
111
+
112
+ # Attribute mapping from ruby-style variable name to JSON key.
113
+ def self.attribute_map
114
+ {
115
+ :'links' => :'Links',
116
+ :'contents' => :'Contents',
117
+ :'creation_date' => :'CreationDate',
118
+ :'subject' => :'Subject',
119
+ :'title' => :'Title',
120
+ :'modified' => :'Modified',
121
+ :'id' => :'Id',
122
+ :'flags' => :'Flags',
123
+ :'name' => :'Name',
124
+ :'rect' => :'Rect',
125
+ :'page_index' => :'PageIndex',
126
+ :'z_index' => :'ZIndex',
127
+ :'horizontal_alignment' => :'HorizontalAlignment',
128
+ :'vertical_alignment' => :'VerticalAlignment',
129
+ :'rich_text' => :'RichText',
130
+ :'starting' => :'Starting',
131
+ :'starting_style' => :'StartingStyle',
132
+ :'ending' => :'Ending',
133
+ :'ending_style' => :'EndingStyle',
134
+ :'interior_color' => :'InteriorColor',
135
+ :'leader_line' => :'LeaderLine',
136
+ :'leader_line_extension' => :'LeaderLineExtension',
137
+ :'leader_line_offset' => :'LeaderLineOffset',
138
+ :'show_caption' => :'ShowCaption',
139
+ :'caption_offset' => :'CaptionOffset',
140
+ :'caption_position' => :'CaptionPosition',
141
+ :'color' => :'Color',
142
+ :'intent' => :'Intent'
143
+ }
144
+ end
145
+
146
+ # Attribute type mapping.
147
+ def self.swagger_types
148
+ {
149
+ :'links' => :'Array<Link>',
150
+ :'contents' => :'String',
151
+ :'creation_date' => :'String',
152
+ :'subject' => :'String',
153
+ :'title' => :'String',
154
+ :'modified' => :'String',
155
+ :'id' => :'String',
156
+ :'flags' => :'Array<AnnotationFlags>',
157
+ :'name' => :'String',
158
+ :'rect' => :'RectanglePdf',
159
+ :'page_index' => :'Integer',
160
+ :'z_index' => :'Integer',
161
+ :'horizontal_alignment' => :'HorizontalAlignment',
162
+ :'vertical_alignment' => :'VerticalAlignment',
163
+ :'rich_text' => :'String',
164
+ :'starting' => :'Point',
165
+ :'starting_style' => :'LineEnding',
166
+ :'ending' => :'Point',
167
+ :'ending_style' => :'LineEnding',
168
+ :'interior_color' => :'Color',
169
+ :'leader_line' => :'Float',
170
+ :'leader_line_extension' => :'Float',
171
+ :'leader_line_offset' => :'Float',
172
+ :'show_caption' => :'BOOLEAN',
173
+ :'caption_offset' => :'Point',
174
+ :'caption_position' => :'CaptionPosition',
175
+ :'color' => :'Color',
176
+ :'intent' => :'LineIntent'
177
+ }
178
+ end
179
+
180
+ # Initializes the object
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ def initialize(attributes = {})
183
+ return unless attributes.is_a?(Hash)
184
+
185
+ # convert string to symbol for hash key
186
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
187
+
188
+ if attributes.has_key?(:'Links')
189
+ if (value = attributes[:'Links']).is_a?(Array)
190
+ self.links = value
191
+ end
192
+ end
193
+
194
+ if attributes.has_key?(:'Contents')
195
+ self.contents = attributes[:'Contents']
196
+ end
197
+
198
+ if attributes.has_key?(:'CreationDate')
199
+ self.creation_date = attributes[:'CreationDate']
200
+ end
201
+
202
+ if attributes.has_key?(:'Subject')
203
+ self.subject = attributes[:'Subject']
204
+ end
205
+
206
+ if attributes.has_key?(:'Title')
207
+ self.title = attributes[:'Title']
208
+ end
209
+
210
+ if attributes.has_key?(:'Modified')
211
+ self.modified = attributes[:'Modified']
212
+ end
213
+
214
+ if attributes.has_key?(:'Id')
215
+ self.id = attributes[:'Id']
216
+ end
217
+
218
+ if attributes.has_key?(:'Flags')
219
+ if (value = attributes[:'Flags']).is_a?(Array)
220
+ self.flags = value
221
+ end
222
+ end
223
+
224
+ if attributes.has_key?(:'Name')
225
+ self.name = attributes[:'Name']
226
+ end
227
+
228
+ if attributes.has_key?(:'Rect')
229
+ self.rect = attributes[:'Rect']
230
+ end
231
+
232
+ if attributes.has_key?(:'PageIndex')
233
+ self.page_index = attributes[:'PageIndex']
234
+ end
235
+
236
+ if attributes.has_key?(:'ZIndex')
237
+ self.z_index = attributes[:'ZIndex']
238
+ end
239
+
240
+ if attributes.has_key?(:'HorizontalAlignment')
241
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
242
+ end
243
+
244
+ if attributes.has_key?(:'VerticalAlignment')
245
+ self.vertical_alignment = attributes[:'VerticalAlignment']
246
+ end
247
+
248
+ if attributes.has_key?(:'RichText')
249
+ self.rich_text = attributes[:'RichText']
250
+ end
251
+
252
+ if attributes.has_key?(:'Starting')
253
+ self.starting = attributes[:'Starting']
254
+ end
255
+
256
+ if attributes.has_key?(:'StartingStyle')
257
+ self.starting_style = attributes[:'StartingStyle']
258
+ end
259
+
260
+ if attributes.has_key?(:'Ending')
261
+ self.ending = attributes[:'Ending']
262
+ end
263
+
264
+ if attributes.has_key?(:'EndingStyle')
265
+ self.ending_style = attributes[:'EndingStyle']
266
+ end
267
+
268
+ if attributes.has_key?(:'InteriorColor')
269
+ self.interior_color = attributes[:'InteriorColor']
270
+ end
271
+
272
+ if attributes.has_key?(:'LeaderLine')
273
+ self.leader_line = attributes[:'LeaderLine']
274
+ end
275
+
276
+ if attributes.has_key?(:'LeaderLineExtension')
277
+ self.leader_line_extension = attributes[:'LeaderLineExtension']
278
+ end
279
+
280
+ if attributes.has_key?(:'LeaderLineOffset')
281
+ self.leader_line_offset = attributes[:'LeaderLineOffset']
282
+ end
283
+
284
+ if attributes.has_key?(:'ShowCaption')
285
+ self.show_caption = attributes[:'ShowCaption']
286
+ end
287
+
288
+ if attributes.has_key?(:'CaptionOffset')
289
+ self.caption_offset = attributes[:'CaptionOffset']
290
+ end
291
+
292
+ if attributes.has_key?(:'CaptionPosition')
293
+ self.caption_position = attributes[:'CaptionPosition']
294
+ end
295
+
296
+ if attributes.has_key?(:'Color')
297
+ self.color = attributes[:'Color']
298
+ end
299
+
300
+ if attributes.has_key?(:'Intent')
301
+ self.intent = attributes[:'Intent']
302
+ end
303
+
304
+ end
305
+
306
+ # Show invalid properties with the reasons. Usually used together with valid?
307
+ # @return Array for valid properies with the reasons
308
+ def list_invalid_properties
309
+ invalid_properties = Array.new
310
+ return invalid_properties
311
+ end
312
+
313
+ # Check to see if the all the properties in the model are valid
314
+ # @return true if the model is valid
315
+ def valid?
316
+ return true
317
+ end
318
+
319
+ # Checks equality by comparing each attribute.
320
+ # @param [Object] Object to be compared
321
+ def ==(o)
322
+ return true if self.equal?(o)
323
+ self.class == o.class &&
324
+ links == o.links &&
325
+ contents == o.contents &&
326
+ creation_date == o.creation_date &&
327
+ subject == o.subject &&
328
+ title == o.title &&
329
+ modified == o.modified &&
330
+ id == o.id &&
331
+ flags == o.flags &&
332
+ name == o.name &&
333
+ rect == o.rect &&
334
+ page_index == o.page_index &&
335
+ z_index == o.z_index &&
336
+ horizontal_alignment == o.horizontal_alignment &&
337
+ vertical_alignment == o.vertical_alignment &&
338
+ rich_text == o.rich_text &&
339
+ starting == o.starting &&
340
+ starting_style == o.starting_style &&
341
+ ending == o.ending &&
342
+ ending_style == o.ending_style &&
343
+ interior_color == o.interior_color &&
344
+ leader_line == o.leader_line &&
345
+ leader_line_extension == o.leader_line_extension &&
346
+ leader_line_offset == o.leader_line_offset &&
347
+ show_caption == o.show_caption &&
348
+ caption_offset == o.caption_offset &&
349
+ caption_position == o.caption_position &&
350
+ color == o.color &&
351
+ intent == o.intent
352
+ end
353
+
354
+ # @see the `==` method
355
+ # @param [Object] Object to be compared
356
+ def eql?(o)
357
+ self == o
358
+ end
359
+
360
+ # Calculates hash code according to all attributes.
361
+ # @return [Fixnum] Hash code
362
+ def hash
363
+ [links, contents, creation_date, subject, title, modified, id, flags, name, rect, page_index, z_index, horizontal_alignment, vertical_alignment, rich_text, starting, starting_style, ending, ending_style, interior_color, leader_line, leader_line_extension, leader_line_offset, show_caption, caption_offset, caption_position, color, intent].hash
364
+ end
365
+
366
+ # Builds the object from hash
367
+ # @param [Hash] attributes Model attributes in the form of hash
368
+ # @return [Object] Returns the model itself
369
+ def build_from_hash(attributes)
370
+ return nil unless attributes.is_a?(Hash)
371
+ self.class.swagger_types.each_pair do |key, type|
372
+ if type =~ /\AArray<(.*)>/i
373
+ # check to ensure the input is an array given that the the attribute
374
+ # is documented as an array but the input is not
375
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
376
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
377
+ end
378
+ elsif !attributes[self.class.attribute_map[key]].nil?
379
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
380
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
381
+ end
382
+
383
+ self
384
+ end
385
+
386
+ # Deserializes the data based on type
387
+ # @param string type Data type
388
+ # @param string value Value to be deserialized
389
+ # @return [Object] Deserialized data
390
+ def _deserialize(type, value)
391
+ case type.to_sym
392
+ when :DateTime
393
+ DateTime.parse(value)
394
+ when :Date
395
+ Date.parse(value)
396
+ when :String
397
+ value.to_s
398
+ when :Integer
399
+ value.to_i
400
+ when :Float
401
+ value.to_f
402
+ when :BOOLEAN
403
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
404
+ true
405
+ else
406
+ false
407
+ end
408
+ when :Object
409
+ # generic object (usually a Hash), return directly
410
+ value
411
+ when /\AArray<(?<inner_type>.+)>\z/
412
+ inner_type = Regexp.last_match[:inner_type]
413
+ value.map { |v| _deserialize(inner_type, v) }
414
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
415
+ k_type = Regexp.last_match[:k_type]
416
+ v_type = Regexp.last_match[:v_type]
417
+ {}.tap do |hash|
418
+ value.each do |k, v|
419
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
420
+ end
421
+ end
422
+ else # model
423
+ temp_model = AsposePdfCloud.const_get(type).new
424
+ temp_model.build_from_hash(value)
425
+ end
426
+ end
427
+
428
+ # Returns the string representation of the object
429
+ # @return [String] String presentation of the object
430
+ def to_s
431
+ to_hash.to_s
432
+ end
433
+
434
+ # to_body is an alias to to_hash (backward compatibility)
435
+ # @return [Hash] Returns the object in the form of hash
436
+ def to_body
437
+ to_hash
438
+ end
439
+
440
+ # Returns the object in the form of hash
441
+ # @return [Hash] Returns the object in the form of hash
442
+ def to_hash
443
+ hash = {}
444
+ self.class.attribute_map.each_pair do |attr, param|
445
+ value = self.send(attr)
446
+ next if value.nil?
447
+ hash[param] = _to_hash(value)
448
+ end
449
+ hash
450
+ end
451
+
452
+ # Outputs non-array value in the form of hash
453
+ # For object, use to_hash. Otherwise, just return the value
454
+ # @param [Object] value Any valid value
455
+ # @return [Hash] Returns the value in the form of hash
456
+ def _to_hash(value)
457
+ if value.is_a?(Array)
458
+ value.compact.map{ |v| _to_hash(v) }
459
+ elsif value.is_a?(Hash)
460
+ {}.tap do |hash|
461
+ value.each { |k, v| hash[k] = _to_hash(v) }
462
+ end
463
+ elsif value.respond_to? :to_hash
464
+ value.to_hash
465
+ else
466
+ value
467
+ end
468
+ end
469
+
470
+ end
471
+
472
+ end