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,211 @@
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
+ # List of annotations.
26
+ class SquareAnnotations
27
+ # Link to the document.
28
+ attr_accessor :links
29
+
30
+ attr_accessor :list
31
+
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'links' => :'Links',
37
+ :'list' => :'List'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'links' => :'Array<Link>',
45
+ :'list' => :'Array<SquareAnnotation>'
46
+ }
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
56
+
57
+ if attributes.has_key?(:'Links')
58
+ if (value = attributes[:'Links']).is_a?(Array)
59
+ self.links = value
60
+ end
61
+ end
62
+
63
+ if attributes.has_key?(:'List')
64
+ if (value = attributes[:'List']).is_a?(Array)
65
+ self.list = value
66
+ end
67
+ end
68
+
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properies with the reasons
73
+ def list_invalid_properties
74
+ invalid_properties = Array.new
75
+ return invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ return true
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(o)
87
+ return true if self.equal?(o)
88
+ self.class == o.class &&
89
+ links == o.links &&
90
+ list == o.list
91
+ end
92
+
93
+ # @see the `==` method
94
+ # @param [Object] Object to be compared
95
+ def eql?(o)
96
+ self == o
97
+ end
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Fixnum] Hash code
101
+ def hash
102
+ [links, list].hash
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.swagger_types.each_pair do |key, type|
111
+ if type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :BOOLEAN
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ temp_model = AsposePdfCloud.const_get(type).new
163
+ temp_model.build_from_hash(value)
164
+ end
165
+ end
166
+
167
+ # Returns the string representation of the object
168
+ # @return [String] String presentation of the object
169
+ def to_s
170
+ to_hash.to_s
171
+ end
172
+
173
+ # to_body is an alias to to_hash (backward compatibility)
174
+ # @return [Hash] Returns the object in the form of hash
175
+ def to_body
176
+ to_hash
177
+ end
178
+
179
+ # Returns the object in the form of hash
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_hash
182
+ hash = {}
183
+ self.class.attribute_map.each_pair do |attr, param|
184
+ value = self.send(attr)
185
+ next if value.nil?
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map{ |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+
209
+ end
210
+
211
+ end
@@ -0,0 +1,222 @@
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
+
26
+ class SquareAnnotationsResponse
27
+ # Response status code.
28
+ attr_accessor :code
29
+
30
+ # Response status.
31
+ attr_accessor :status
32
+
33
+ attr_accessor :annotations
34
+
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'code' => :'Code',
40
+ :'status' => :'Status',
41
+ :'annotations' => :'Annotations'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ :'code' => :'Integer',
49
+ :'status' => :'String',
50
+ :'annotations' => :'SquareAnnotations'
51
+ }
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
61
+
62
+ if attributes.has_key?(:'Code')
63
+ self.code = attributes[:'Code']
64
+ end
65
+
66
+ if attributes.has_key?(:'Status')
67
+ self.status = attributes[:'Status']
68
+ end
69
+
70
+ if attributes.has_key?(:'Annotations')
71
+ self.annotations = attributes[:'Annotations']
72
+ end
73
+
74
+ end
75
+
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properies with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = Array.new
80
+ if @code.nil?
81
+ invalid_properties.push("invalid value for 'code', code cannot be nil.")
82
+ end
83
+
84
+ return invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ return false if @code.nil?
91
+ return true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ code == o.code &&
100
+ status == o.status &&
101
+ annotations == o.annotations
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Fixnum] Hash code
112
+ def hash
113
+ [code, status, annotations].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.swagger_types.each_pair do |key, type|
122
+ if type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :BOOLEAN
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ temp_model = AsposePdfCloud.const_get(type).new
174
+ temp_model.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ next if value.nil?
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map{ |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+
222
+ end
@@ -20,5 +20,5 @@ SOFTWARE.
20
20
  =end
21
21
 
22
22
  module AsposePdfCloud
23
- VERSION = "18.9.0"
23
+ VERSION = "18.10.0"
24
24
  end
@@ -121,6 +121,488 @@ class PdfTests < Minitest::Test
121
121
  assert(response, 'Failed to delete annotation.')
122
122
  end
123
123
 
124
+ # PolyLine Annotations Tests
125
+
126
+ def test_get_document_poly_line_annotations
127
+ file_name = 'PdfWithAnnotations.pdf'
128
+ upload_file(file_name)
129
+
130
+ opts = {
131
+ :folder => @temp_folder
132
+ }
133
+
134
+ response = @pdf_api.get_document_poly_line_annotations(file_name, opts)
135
+ assert(response, 'Failed to read document polyline annotations.')
136
+ end
137
+
138
+ def test_post_page_poly_line_annotations
139
+ file_name = 'PdfWithAnnotations.pdf'
140
+ upload_file(file_name)
141
+
142
+ opts = {
143
+ :folder => @temp_folder
144
+ }
145
+
146
+ annotation = PolyLineAnnotation.new
147
+ annotation.name = 'Test poly_line'
148
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
149
+ annotation.flags = [AnnotationFlags::DEFAULT]
150
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
151
+ annotation.rich_text = 'Rich Text'
152
+ annotation.subject = 'Subj'
153
+ annotation.z_index = 1
154
+ annotation.title = 'Title'
155
+ annotation.vertices = [
156
+ Point.new({:X => 10, :Y => 10}),
157
+ Point.new({:X => 20, :Y => 10}),
158
+ Point.new({:X => 10, :Y => 20}),
159
+ Point.new({:X => 10, :Y => 10})
160
+ ]
161
+
162
+ response = @pdf_api.post_page_poly_line_annotations(file_name, 1, [annotation], opts)
163
+ assert(response, 'Failed to add polyline annotations into page.')
164
+ end
165
+
166
+ def test_get_page_poly_line_annotations
167
+ file_name = 'PdfWithAnnotations.pdf'
168
+ upload_file(file_name)
169
+
170
+ page_number = 1
171
+ opts = {
172
+ :folder => @temp_folder
173
+ }
174
+
175
+ response = @pdf_api.get_page_poly_line_annotations(file_name, page_number, opts)
176
+ assert(response, 'Failed to read page polyline annotations.')
177
+ end
178
+
179
+ def test_get_poly_line_annotation
180
+ file_name = 'PdfWithAnnotations.pdf'
181
+ upload_file(file_name)
182
+
183
+ opts = {
184
+ :folder => @temp_folder
185
+ }
186
+
187
+ annotations_response = @pdf_api.get_document_poly_line_annotations(file_name, opts)
188
+ assert(annotations_response, 'Failed to read document polyline annotations.')
189
+ annotation_id = annotations_response[0].annotations.list[0].id
190
+
191
+ response = @pdf_api.get_poly_line_annotation(file_name, annotation_id, opts)
192
+ assert(response, 'Failed to read page polyline annotations.')
193
+ end
194
+
195
+ def test_put_poly_line_annotation
196
+ file_name = 'PdfWithAnnotations.pdf'
197
+ upload_file(file_name)
198
+
199
+ opts = {
200
+ :folder => @temp_folder
201
+ }
202
+
203
+ annotation = PolyLineAnnotation.new
204
+ annotation.name = 'Test poly_line'
205
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
206
+ annotation.flags = [AnnotationFlags::DEFAULT]
207
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
208
+ annotation.rich_text = 'Rich Text'
209
+ annotation.subject = 'Subj'
210
+ annotation.z_index = 1
211
+ annotation.vertices = [
212
+ Point.new({:X => 10, :Y => 10}),
213
+ Point.new({:X => 20, :Y => 10}),
214
+ Point.new({:X => 10, :Y => 20}),
215
+ Point.new({:X => 10, :Y => 10})
216
+ ]
217
+
218
+ annotations_response = @pdf_api.get_document_poly_line_annotations(file_name, opts)
219
+ assert(annotations_response, 'Failed to read document polyline annotations.')
220
+ annotation_id = annotations_response[0].annotations.list[0].id
221
+
222
+ response = @pdf_api.put_poly_line_annotation(file_name, annotation_id, annotation, opts)
223
+ assert(response, 'Failed to replace polyline annotation.')
224
+ end
225
+
226
+
227
+ # Polygon Annotations Tests
228
+
229
+ def test_get_document_polygon_annotations
230
+ file_name = 'PdfWithAnnotations.pdf'
231
+ upload_file(file_name)
232
+
233
+ opts = {
234
+ :folder => @temp_folder
235
+ }
236
+
237
+ response = @pdf_api.get_document_polygon_annotations(file_name, opts)
238
+ assert(response, 'Failed to read document polygon annotations.')
239
+ end
240
+
241
+ def test_post_page_polygon_annotations
242
+ file_name = 'PdfWithAnnotations.pdf'
243
+ upload_file(file_name)
244
+
245
+ opts = {
246
+ :folder => @temp_folder
247
+ }
248
+
249
+ annotation = PolygonAnnotation.new
250
+ annotation.name = 'Test polygon'
251
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
252
+ annotation.flags = [AnnotationFlags::DEFAULT]
253
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
254
+ annotation.rich_text = 'Rich Text'
255
+ annotation.subject = 'Subj'
256
+ annotation.z_index = 1
257
+ annotation.title = 'Title'
258
+ annotation.vertices = [
259
+ Point.new({:X => 10, :Y => 10}),
260
+ Point.new({:X => 20, :Y => 10}),
261
+ Point.new({:X => 10, :Y => 20}),
262
+ Point.new({:X => 10, :Y => 10})
263
+ ]
264
+
265
+ response = @pdf_api.post_page_polygon_annotations(file_name, 1, [annotation], opts)
266
+ assert(response, 'Failed to add polygon annotations into page.')
267
+ end
268
+
269
+ def test_get_page_polygon_annotations
270
+ file_name = 'PdfWithAnnotations.pdf'
271
+ upload_file(file_name)
272
+
273
+ page_number = 1
274
+ opts = {
275
+ :folder => @temp_folder
276
+ }
277
+
278
+ response = @pdf_api.get_page_polygon_annotations(file_name, page_number, opts)
279
+ assert(response, 'Failed to read page polygon annotations.')
280
+ end
281
+
282
+ def test_get_polygon_annotation
283
+ file_name = 'PdfWithAnnotations.pdf'
284
+ upload_file(file_name)
285
+
286
+ opts = {
287
+ :folder => @temp_folder
288
+ }
289
+
290
+ annotations_response = @pdf_api.get_document_polygon_annotations(file_name, opts)
291
+ assert(annotations_response, 'Failed to read document polygon annotations.')
292
+ annotation_id = annotations_response[0].annotations.list[0].id
293
+
294
+ response = @pdf_api.get_polygon_annotation(file_name, annotation_id, opts)
295
+ assert(response, 'Failed to read page polygon annotations.')
296
+ end
297
+
298
+ def test_put_polygon_annotation
299
+ file_name = 'PdfWithAnnotations.pdf'
300
+ upload_file(file_name)
301
+
302
+ opts = {
303
+ :folder => @temp_folder
304
+ }
305
+
306
+ annotation = PolygonAnnotation.new
307
+ annotation.name = 'Test polygon'
308
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
309
+ annotation.flags = [AnnotationFlags::DEFAULT]
310
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
311
+ annotation.rich_text = 'Rich Text'
312
+ annotation.subject = 'Subj'
313
+ annotation.z_index = 1
314
+ annotation.vertices = [
315
+ Point.new({:X => 10, :Y => 10}),
316
+ Point.new({:X => 20, :Y => 10}),
317
+ Point.new({:X => 10, :Y => 20}),
318
+ Point.new({:X => 10, :Y => 10})
319
+ ]
320
+
321
+ annotations_response = @pdf_api.get_document_polygon_annotations(file_name, opts)
322
+ assert(annotations_response, 'Failed to read document polygon annotations.')
323
+ annotation_id = annotations_response[0].annotations.list[0].id
324
+
325
+ response = @pdf_api.put_polygon_annotation(file_name, annotation_id, annotation, opts)
326
+ assert(response, 'Failed to replace polygon annotation.')
327
+ end
328
+
329
+ # Circle Annotations Tests
330
+
331
+ def test_get_document_circle_annotations
332
+ file_name = 'PdfWithAnnotations.pdf'
333
+ upload_file(file_name)
334
+
335
+ opts = {
336
+ :folder => @temp_folder
337
+ }
338
+
339
+ response = @pdf_api.get_document_circle_annotations(file_name, opts)
340
+ assert(response, 'Failed to read document circle annotations.')
341
+ end
342
+
343
+ def test_post_page_circle_annotations
344
+ file_name = 'PdfWithAnnotations.pdf'
345
+ upload_file(file_name)
346
+
347
+ opts = {
348
+ :folder => @temp_folder
349
+ }
350
+
351
+ annotation = CircleAnnotation.new
352
+ annotation.name = 'Test circle'
353
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
354
+ annotation.flags = [AnnotationFlags::DEFAULT]
355
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
356
+ annotation.rich_text = 'Rich Text'
357
+ annotation.subject = 'Subj'
358
+ annotation.z_index = 1
359
+ annotation.title = 'Title'
360
+
361
+ response = @pdf_api.post_page_circle_annotations(file_name, 1, [annotation], opts)
362
+ assert(response, 'Failed to add circle annotations into page.')
363
+ end
364
+
365
+ def test_get_page_circle_annotations
366
+ file_name = 'PdfWithAnnotations.pdf'
367
+ upload_file(file_name)
368
+
369
+ page_number = 1
370
+ opts = {
371
+ :folder => @temp_folder
372
+ }
373
+
374
+ response = @pdf_api.get_page_circle_annotations(file_name, page_number, opts)
375
+ assert(response, 'Failed to read page circle annotations.')
376
+ end
377
+
378
+ def test_get_circle_annotation
379
+ file_name = 'PdfWithAnnotations.pdf'
380
+ upload_file(file_name)
381
+
382
+ opts = {
383
+ :folder => @temp_folder
384
+ }
385
+
386
+ annotations_response = @pdf_api.get_document_circle_annotations(file_name, opts)
387
+ assert(annotations_response, 'Failed to read document circle annotations.')
388
+ annotation_id = annotations_response[0].annotations.list[0].id
389
+
390
+ response = @pdf_api.get_circle_annotation(file_name, annotation_id, opts)
391
+ assert(response, 'Failed to read page circle annotations.')
392
+ end
393
+
394
+ def test_put_circle_annotation
395
+ file_name = 'PdfWithAnnotations.pdf'
396
+ upload_file(file_name)
397
+
398
+ opts = {
399
+ :folder => @temp_folder
400
+ }
401
+
402
+ annotation = CircleAnnotation.new
403
+ annotation.name = 'Test circle'
404
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
405
+ annotation.flags = [AnnotationFlags::DEFAULT]
406
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
407
+ annotation.rich_text = 'Rich Text'
408
+ annotation.subject = 'Subj'
409
+ annotation.z_index = 1
410
+
411
+ annotations_response = @pdf_api.get_document_circle_annotations(file_name, opts)
412
+ assert(annotations_response, 'Failed to read document circle annotations.')
413
+ annotation_id = annotations_response[0].annotations.list[0].id
414
+
415
+ response = @pdf_api.put_circle_annotation(file_name, annotation_id, annotation, opts)
416
+ assert(response, 'Failed to replace circle annotation.')
417
+ end
418
+
419
+
420
+ # Square Annotations Tests
421
+
422
+ def test_get_document_square_annotations
423
+ file_name = 'PdfWithAnnotations.pdf'
424
+ upload_file(file_name)
425
+
426
+ opts = {
427
+ :folder => @temp_folder
428
+ }
429
+
430
+ response = @pdf_api.get_document_square_annotations(file_name, opts)
431
+ assert(response, 'Failed to read document square annotations.')
432
+ end
433
+
434
+ def test_post_page_square_annotations
435
+ file_name = 'PdfWithAnnotations.pdf'
436
+ upload_file(file_name)
437
+
438
+ opts = {
439
+ :folder => @temp_folder
440
+ }
441
+
442
+ annotation = SquareAnnotation.new
443
+ annotation.name = 'Test square'
444
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
445
+ annotation.flags = [AnnotationFlags::DEFAULT]
446
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
447
+ annotation.rich_text = 'Rich Text'
448
+ annotation.subject = 'Subj'
449
+ annotation.z_index = 1
450
+ annotation.title = 'Title'
451
+
452
+ response = @pdf_api.post_page_square_annotations(file_name, 1, [annotation], opts)
453
+ assert(response, 'Failed to add square annotations into page.')
454
+ end
455
+
456
+ def test_get_page_square_annotations
457
+ file_name = 'PdfWithAnnotations.pdf'
458
+ upload_file(file_name)
459
+
460
+ page_number = 1
461
+ opts = {
462
+ :folder => @temp_folder
463
+ }
464
+
465
+ response = @pdf_api.get_page_square_annotations(file_name, page_number, opts)
466
+ assert(response, 'Failed to read page square annotations.')
467
+ end
468
+
469
+ def test_get_square_annotation
470
+ file_name = 'PdfWithAnnotations.pdf'
471
+ upload_file(file_name)
472
+
473
+ opts = {
474
+ :folder => @temp_folder
475
+ }
476
+
477
+ annotations_response = @pdf_api.get_document_square_annotations(file_name, opts)
478
+ assert(annotations_response, 'Failed to read document square annotations.')
479
+ annotation_id = annotations_response[0].annotations.list[0].id
480
+
481
+ response = @pdf_api.get_square_annotation(file_name, annotation_id, opts)
482
+ assert(response, 'Failed to read page square annotations.')
483
+ end
484
+
485
+ def test_put_square_annotation
486
+ file_name = 'PdfWithAnnotations.pdf'
487
+ upload_file(file_name)
488
+
489
+ opts = {
490
+ :folder => @temp_folder
491
+ }
492
+
493
+ annotation = SquareAnnotation.new
494
+ annotation.name = 'Test square'
495
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
496
+ annotation.flags = [AnnotationFlags::DEFAULT]
497
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
498
+ annotation.rich_text = 'Rich Text'
499
+ annotation.subject = 'Subj'
500
+ annotation.z_index = 1
501
+
502
+ annotations_response = @pdf_api.get_document_square_annotations(file_name, opts)
503
+ assert(annotations_response, 'Failed to read document square annotations.')
504
+ annotation_id = annotations_response[0].annotations.list[0].id
505
+
506
+ response = @pdf_api.put_square_annotation(file_name, annotation_id, annotation, opts)
507
+ assert(response, 'Failed to replace square annotation.')
508
+ end
509
+
510
+
511
+ # Line Annotations Tests
512
+
513
+ def test_get_document_line_annotations
514
+ file_name = 'PdfWithAnnotations.pdf'
515
+ upload_file(file_name)
516
+
517
+ opts = {
518
+ :folder => @temp_folder
519
+ }
520
+
521
+ response = @pdf_api.get_document_line_annotations(file_name, opts)
522
+ assert(response, 'Failed to read document line annotations.')
523
+ end
524
+
525
+ def test_post_page_line_annotations
526
+ file_name = 'PdfWithAnnotations.pdf'
527
+ upload_file(file_name)
528
+
529
+ opts = {
530
+ :folder => @temp_folder
531
+ }
532
+
533
+ annotation = LineAnnotation.new
534
+ annotation.name = 'Test Line'
535
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
536
+ annotation.flags = [AnnotationFlags::DEFAULT]
537
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
538
+ annotation.rich_text = 'Rich Text'
539
+ annotation.subject = 'Subj'
540
+ annotation.z_index = 1
541
+ annotation.title = 'Title'
542
+ annotation.starting = Point.new({:X => 10, :Y => 10})
543
+ annotation.ending = Point.new({:X => 100, :Y => 100})
544
+
545
+ response = @pdf_api.post_page_line_annotations(file_name, 1, [annotation], opts)
546
+ assert(response, 'Failed to add line annotations into page.')
547
+ end
548
+
549
+ def test_get_page_line_annotations
550
+ file_name = 'PdfWithAnnotations.pdf'
551
+ upload_file(file_name)
552
+
553
+ page_number = 1
554
+ opts = {
555
+ :folder => @temp_folder
556
+ }
557
+
558
+ response = @pdf_api.get_page_line_annotations(file_name, page_number, opts)
559
+ assert(response, 'Failed to read page line annotations.')
560
+ end
561
+
562
+ def test_get_line_annotation
563
+ file_name = 'PdfWithAnnotations.pdf'
564
+ upload_file(file_name)
565
+
566
+ opts = {
567
+ :folder => @temp_folder
568
+ }
569
+
570
+ annotations_response = @pdf_api.get_document_line_annotations(file_name, opts)
571
+ assert(annotations_response, 'Failed to read document line annotations.')
572
+ annotation_id = annotations_response[0].annotations.list[0].id
573
+
574
+ response = @pdf_api.get_line_annotation(file_name, annotation_id, opts)
575
+ assert(response, 'Failed to read page line annotations.')
576
+ end
577
+
578
+ def test_put_line_annotation
579
+ file_name = 'PdfWithAnnotations.pdf'
580
+ upload_file(file_name)
581
+
582
+ opts = {
583
+ :folder => @temp_folder
584
+ }
585
+
586
+ annotation = LineAnnotation.new
587
+ annotation.name = 'Test Line'
588
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
589
+ annotation.flags = [AnnotationFlags::DEFAULT]
590
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
591
+ annotation.rich_text = 'Rich Text'
592
+ annotation.subject = 'Subj'
593
+ annotation.z_index = 1
594
+ annotation.starting = Point.new({:X => 10, :Y => 10})
595
+ annotation.ending = Point.new({:X => 100, :Y => 100})
596
+
597
+ annotations_response = @pdf_api.get_document_line_annotations(file_name, opts)
598
+ assert(annotations_response, 'Failed to read document line annotations.')
599
+ annotation_id = annotations_response[0].annotations.list[0].id
600
+
601
+ response = @pdf_api.put_line_annotation(file_name, annotation_id, annotation, opts)
602
+ assert(response, 'Failed to replace line annotation.')
603
+ end
604
+
605
+
124
606
  # Free Text Annotations Tests
125
607
 
126
608
  def test_get_document_free_text_annotations
@@ -1676,7 +2158,7 @@ class PdfTests < Minitest::Test
1676
2158
  end
1677
2159
 
1678
2160
 
1679
- # Links Tests
2161
+ # Link Annotations Tests
1680
2162
 
1681
2163
  def test_get_page_link_annotation
1682
2164
  file_name = 'PdfWithLinks.pdf'