aspose_pdf_cloud 18.7.0 → 18.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/aspose_pdf_cloud.gemspec +53 -49
  3. data/lib/aspose_pdf_cloud.rb +150 -145
  4. data/lib/aspose_pdf_cloud/api/pdf_api.rb +12907 -11705
  5. data/lib/aspose_pdf_cloud/api_client.rb +2 -2
  6. data/lib/aspose_pdf_cloud/api_error.rb +47 -47
  7. data/lib/aspose_pdf_cloud/configuration.rb +175 -185
  8. data/lib/aspose_pdf_cloud/models/annotation.rb +332 -260
  9. data/lib/aspose_pdf_cloud/models/annotation_flags.rb +52 -0
  10. data/lib/aspose_pdf_cloud/models/annotation_info.rb +342 -0
  11. data/lib/aspose_pdf_cloud/models/annotation_state.rb +49 -0
  12. data/lib/aspose_pdf_cloud/models/annotation_type.rb +69 -0
  13. data/lib/aspose_pdf_cloud/models/{annotations.rb → annotations_info.rb} +211 -211
  14. data/lib/aspose_pdf_cloud/models/{annotations_response.rb → annotations_info_response.rb} +222 -222
  15. data/lib/aspose_pdf_cloud/models/antialiasing_processing_type.rb +43 -43
  16. data/lib/aspose_pdf_cloud/models/append_document.rb +233 -228
  17. data/lib/aspose_pdf_cloud/models/{saa_spose_response.rb → aspose_response.rb} +213 -213
  18. data/lib/aspose_pdf_cloud/models/attachment.rb +270 -270
  19. data/lib/aspose_pdf_cloud/models/attachment_response.rb +222 -222
  20. data/lib/aspose_pdf_cloud/models/attachments.rb +211 -211
  21. data/lib/aspose_pdf_cloud/models/attachments_response.rb +222 -222
  22. data/lib/aspose_pdf_cloud/models/color.rb +244 -244
  23. data/lib/aspose_pdf_cloud/models/color_depth.rb +45 -45
  24. data/lib/aspose_pdf_cloud/models/compression_type.rb +46 -46
  25. data/lib/aspose_pdf_cloud/models/doc_format.rb +43 -43
  26. data/lib/aspose_pdf_cloud/models/doc_recognition_mode.rb +43 -43
  27. data/lib/aspose_pdf_cloud/models/document.rb +220 -220
  28. data/lib/aspose_pdf_cloud/models/{text_item_response.rb → document_page_response.rb} +222 -222
  29. data/lib/aspose_pdf_cloud/models/document_pages_response.rb +222 -222
  30. data/lib/aspose_pdf_cloud/models/document_privilege.rb +298 -298
  31. data/lib/aspose_pdf_cloud/models/document_properties.rb +211 -211
  32. data/lib/aspose_pdf_cloud/models/document_properties_response.rb +222 -222
  33. data/lib/aspose_pdf_cloud/models/document_property.rb +227 -227
  34. data/lib/aspose_pdf_cloud/models/document_property_response.rb +222 -222
  35. data/lib/aspose_pdf_cloud/models/document_response.rb +233 -233
  36. data/lib/aspose_pdf_cloud/models/epub_recognition_mode.rb +44 -44
  37. data/lib/aspose_pdf_cloud/models/field.rb +254 -254
  38. data/lib/aspose_pdf_cloud/models/field_response.rb +222 -222
  39. data/lib/aspose_pdf_cloud/models/field_type.rb +45 -44
  40. data/lib/aspose_pdf_cloud/models/fields.rb +211 -211
  41. data/lib/aspose_pdf_cloud/models/fields_response.rb +222 -222
  42. data/lib/aspose_pdf_cloud/models/font_encoding_rules.rb +43 -43
  43. data/lib/aspose_pdf_cloud/models/font_saving_modes.rb +45 -45
  44. data/lib/aspose_pdf_cloud/models/font_styles.rb +45 -43
  45. data/lib/aspose_pdf_cloud/models/free_text_annotation.rb +382 -0
  46. data/lib/aspose_pdf_cloud/models/{annotation_response.rb → free_text_annotation_response.rb} +222 -222
  47. data/lib/aspose_pdf_cloud/models/{text_items.rb → free_text_annotations.rb} +211 -211
  48. data/lib/aspose_pdf_cloud/models/{text_items_response.rb → free_text_annotations_response.rb} +222 -222
  49. data/lib/aspose_pdf_cloud/models/free_text_intent.rb +44 -0
  50. data/lib/aspose_pdf_cloud/models/horizontal_alignment.rb +45 -44
  51. data/lib/aspose_pdf_cloud/models/html_document_type.rb +43 -43
  52. data/lib/aspose_pdf_cloud/models/html_markup_generation_modes.rb +43 -43
  53. data/lib/aspose_pdf_cloud/models/image.rb +250 -220
  54. data/lib/aspose_pdf_cloud/models/image_response.rb +222 -222
  55. data/lib/aspose_pdf_cloud/models/image_src_type.rb +43 -43
  56. data/lib/aspose_pdf_cloud/models/image_template.rb +281 -281
  57. data/lib/aspose_pdf_cloud/models/image_templates_request.rb +230 -230
  58. data/lib/aspose_pdf_cloud/models/images.rb +211 -211
  59. data/lib/aspose_pdf_cloud/models/images_response.rb +222 -222
  60. data/lib/aspose_pdf_cloud/models/justification.rb +44 -0
  61. data/lib/aspose_pdf_cloud/models/letters_positioning_methods.rb +43 -43
  62. data/lib/aspose_pdf_cloud/models/line_spacing.rb +43 -43
  63. data/lib/aspose_pdf_cloud/models/link.rb +228 -228
  64. data/lib/aspose_pdf_cloud/models/link_action_type.rb +47 -46
  65. data/lib/aspose_pdf_cloud/models/link_annotation.rb +254 -236
  66. data/lib/aspose_pdf_cloud/models/link_annotation_response.rb +222 -222
  67. data/lib/aspose_pdf_cloud/models/link_annotations.rb +211 -211
  68. data/lib/aspose_pdf_cloud/models/link_annotations_response.rb +222 -222
  69. data/lib/aspose_pdf_cloud/models/link_element.rb +200 -200
  70. data/lib/aspose_pdf_cloud/models/link_highlighting_mode.rb +46 -45
  71. data/lib/aspose_pdf_cloud/models/margin_info.rb +244 -244
  72. data/lib/aspose_pdf_cloud/models/markup_annotation.rb +342 -0
  73. data/lib/aspose_pdf_cloud/models/merge_documents.rb +205 -200
  74. data/lib/aspose_pdf_cloud/models/optimize_options.rb +293 -293
  75. data/lib/aspose_pdf_cloud/models/page.rb +228 -228
  76. data/lib/aspose_pdf_cloud/models/page_word_count.rb +218 -218
  77. data/lib/aspose_pdf_cloud/models/pages.rb +211 -211
  78. data/lib/aspose_pdf_cloud/models/paragraph.rb +303 -303
  79. data/lib/aspose_pdf_cloud/models/parts_embedding_modes.rb +44 -44
  80. data/lib/aspose_pdf_cloud/models/pdf_a_type.rb +43 -43
  81. data/lib/aspose_pdf_cloud/models/raster_images_saving_modes.rb +44 -44
  82. data/lib/aspose_pdf_cloud/models/{document_text_replace_response.rb → rectangle_pdf.rb} +244 -231
  83. data/lib/aspose_pdf_cloud/models/rotation.rb +45 -44
  84. data/lib/aspose_pdf_cloud/models/segment.rb +211 -206
  85. data/lib/aspose_pdf_cloud/models/shape_type.rb +44 -44
  86. data/lib/aspose_pdf_cloud/models/signature.rb +338 -333
  87. data/lib/aspose_pdf_cloud/models/signature_type.rb +44 -42
  88. data/lib/aspose_pdf_cloud/models/signature_verify_response.rb +223 -223
  89. data/lib/aspose_pdf_cloud/models/split_result.rb +200 -200
  90. data/lib/aspose_pdf_cloud/models/split_result_document.rb +238 -238
  91. data/lib/aspose_pdf_cloud/models/split_result_response.rb +223 -223
  92. data/lib/aspose_pdf_cloud/models/stamp.rb +413 -413
  93. data/lib/aspose_pdf_cloud/models/stamp_type.rb +45 -44
  94. data/lib/aspose_pdf_cloud/models/{tiff_export_options.rb → text_annotation.rb} +382 -348
  95. data/lib/aspose_pdf_cloud/models/text_annotation_response.rb +222 -0
  96. data/lib/aspose_pdf_cloud/models/{text_item.rb → text_annotations.rb} +211 -218
  97. data/lib/aspose_pdf_cloud/models/text_annotations_response.rb +222 -0
  98. data/lib/aspose_pdf_cloud/models/text_horizontal_alignment.rb +47 -47
  99. data/lib/aspose_pdf_cloud/models/text_icon.rb +52 -0
  100. data/lib/aspose_pdf_cloud/models/text_line.rb +215 -210
  101. data/lib/aspose_pdf_cloud/models/text_rect.rb +220 -220
  102. data/lib/aspose_pdf_cloud/models/text_rects.rb +199 -199
  103. data/lib/aspose_pdf_cloud/models/text_rects_response.rb +222 -222
  104. data/lib/aspose_pdf_cloud/models/text_replace.rb +253 -253
  105. data/lib/aspose_pdf_cloud/models/text_replace_list_request.rb +232 -232
  106. data/lib/aspose_pdf_cloud/models/text_replace_response.rb +222 -222
  107. data/lib/aspose_pdf_cloud/models/text_state.rb +248 -248
  108. data/lib/aspose_pdf_cloud/models/{text_format.rb → text_style.rb} +233 -227
  109. data/lib/aspose_pdf_cloud/models/vertical_alignment.rb +45 -45
  110. data/lib/aspose_pdf_cloud/models/word_count.rb +199 -199
  111. data/lib/aspose_pdf_cloud/models/word_count_response.rb +223 -223
  112. data/lib/aspose_pdf_cloud/models/wrap_mode.rb +44 -44
  113. data/lib/aspose_pdf_cloud/version.rb +24 -24
  114. data/test/pdf_tests.rb +1496 -1325
  115. data/test_data/TexExample.tex +304 -304
  116. metadata +24 -21
  117. data/.gitignore +0 -46
  118. data/.swagger-codegen-ignore +0 -58
  119. data/lib/aspose_pdf_cloud/models/http_status_code.rb +0 -87
  120. data/lib/aspose_pdf_cloud/models/images_list_request.rb +0 -205
  121. data/lib/aspose_pdf_cloud/models/page_text_replace_response.rb +0 -231
  122. data/lib/aspose_pdf_cloud/models/rectangle.rb +0 -244
  123. data/lib/aspose_pdf_cloud/models/text_format_response.rb +0 -222
  124. data/lib/aspose_pdf_cloud/models/text_replace_request.rb +0 -262
@@ -1,44 +1,45 @@
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
- class StampType
26
-
27
- TEXT = 0.freeze
28
- IMAGE = 1.freeze
29
- PAGE = 2.freeze
30
- PAGE_NUMBER = 3.freeze
31
-
32
- # Builds the enum from string
33
- # @param [Fixnum] The enum value in the form of the string
34
- # @return [Fixnum] The enum value
35
- def build_from_hash(value)
36
- constantValues = StampType.constants.select{ |const_name| StampType.const_get(const_name) == value}
37
- raise "Invalid ENUM value #{value} for class #StampType" if constantValues.empty?
38
- value
39
- #constantValues[0]
40
- end
41
-
42
- end
43
-
44
- end
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
+ class StampType
26
+
27
+ TEXT = "Text".freeze
28
+ IMAGE = "Image".freeze
29
+ PAGE = "Page".freeze
30
+ PAGE_NUMBER = "PageNumber".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 = StampType.constants.select{|c| c.to_s == value}
38
+ constantValues = StampType.constants.select{ |const_name| StampType.const_get(const_name) == value}
39
+
40
+ raise "Invalid ENUM value #{value} for class #StampType" if constantValues.empty?
41
+ value
42
+ end
43
+ end
44
+
45
+ end
@@ -1,348 +1,382 @@
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
- # Used for tiff export options setting.
26
- class TiffExportOptions
27
- # Image brightness.
28
- attr_accessor :brightness
29
-
30
- # Tiff compression. Possible values are: LZW, CCITT4, CCITT3, RLE, None.
31
- attr_accessor :compression
32
-
33
- # Image color depth. Possible valuse are: Default, Format8bpp, Format4bpp, Format1bpp.
34
- attr_accessor :color_depth
35
-
36
- # Left image margin.
37
- attr_accessor :left_margin
38
-
39
- # Right image margin.
40
- attr_accessor :right_margin
41
-
42
- # Top image margin.
43
- attr_accessor :top_margin
44
-
45
- # Bottom image margin.
46
- attr_accessor :bottom_margin
47
-
48
- # Image orientation. Possible values are: None, Landscape, Portait.
49
- attr_accessor :orientation
50
-
51
- # Skip blank pages flag.
52
- attr_accessor :skip_blank_pages
53
-
54
- # Image width.
55
- attr_accessor :width
56
-
57
- # Image height.
58
- attr_accessor :height
59
-
60
- # Horizontal resolution.
61
- attr_accessor :x_resolution
62
-
63
- # Vertical resolution.
64
- attr_accessor :y_resolution
65
-
66
- # Start page to export.
67
- attr_accessor :page_index
68
-
69
- # Number of pages to export.
70
- attr_accessor :page_count
71
-
72
- # Resulting image file.
73
- attr_accessor :result_file
74
-
75
-
76
- # Attribute mapping from ruby-style variable name to JSON key.
77
- def self.attribute_map
78
- {
79
- :'brightness' => :'Brightness',
80
- :'compression' => :'Compression',
81
- :'color_depth' => :'ColorDepth',
82
- :'left_margin' => :'LeftMargin',
83
- :'right_margin' => :'RightMargin',
84
- :'top_margin' => :'TopMargin',
85
- :'bottom_margin' => :'BottomMargin',
86
- :'orientation' => :'Orientation',
87
- :'skip_blank_pages' => :'SkipBlankPages',
88
- :'width' => :'Width',
89
- :'height' => :'Height',
90
- :'x_resolution' => :'XResolution',
91
- :'y_resolution' => :'YResolution',
92
- :'page_index' => :'PageIndex',
93
- :'page_count' => :'PageCount',
94
- :'result_file' => :'ResultFile'
95
- }
96
- end
97
-
98
- # Attribute type mapping.
99
- def self.swagger_types
100
- {
101
- :'brightness' => :'Float',
102
- :'compression' => :'CompressionType',
103
- :'color_depth' => :'ColorDepth',
104
- :'left_margin' => :'Integer',
105
- :'right_margin' => :'Integer',
106
- :'top_margin' => :'Integer',
107
- :'bottom_margin' => :'Integer',
108
- :'orientation' => :'ShapeType',
109
- :'skip_blank_pages' => :'BOOLEAN',
110
- :'width' => :'Integer',
111
- :'height' => :'Integer',
112
- :'x_resolution' => :'Integer',
113
- :'y_resolution' => :'Integer',
114
- :'page_index' => :'Integer',
115
- :'page_count' => :'Integer',
116
- :'result_file' => :'String'
117
- }
118
- end
119
-
120
- # Initializes the object
121
- # @param [Hash] attributes Model attributes in the form of hash
122
- def initialize(attributes = {})
123
- return unless attributes.is_a?(Hash)
124
-
125
- # convert string to symbol for hash key
126
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
127
-
128
- if attributes.has_key?(:'Brightness')
129
- self.brightness = attributes[:'Brightness']
130
- end
131
-
132
- if attributes.has_key?(:'Compression')
133
- self.compression = attributes[:'Compression']
134
- end
135
-
136
- if attributes.has_key?(:'ColorDepth')
137
- self.color_depth = attributes[:'ColorDepth']
138
- end
139
-
140
- if attributes.has_key?(:'LeftMargin')
141
- self.left_margin = attributes[:'LeftMargin']
142
- end
143
-
144
- if attributes.has_key?(:'RightMargin')
145
- self.right_margin = attributes[:'RightMargin']
146
- end
147
-
148
- if attributes.has_key?(:'TopMargin')
149
- self.top_margin = attributes[:'TopMargin']
150
- end
151
-
152
- if attributes.has_key?(:'BottomMargin')
153
- self.bottom_margin = attributes[:'BottomMargin']
154
- end
155
-
156
- if attributes.has_key?(:'Orientation')
157
- self.orientation = attributes[:'Orientation']
158
- end
159
-
160
- if attributes.has_key?(:'SkipBlankPages')
161
- self.skip_blank_pages = attributes[:'SkipBlankPages']
162
- end
163
-
164
- if attributes.has_key?(:'Width')
165
- self.width = attributes[:'Width']
166
- end
167
-
168
- if attributes.has_key?(:'Height')
169
- self.height = attributes[:'Height']
170
- end
171
-
172
- if attributes.has_key?(:'XResolution')
173
- self.x_resolution = attributes[:'XResolution']
174
- end
175
-
176
- if attributes.has_key?(:'YResolution')
177
- self.y_resolution = attributes[:'YResolution']
178
- end
179
-
180
- if attributes.has_key?(:'PageIndex')
181
- self.page_index = attributes[:'PageIndex']
182
- end
183
-
184
- if attributes.has_key?(:'PageCount')
185
- self.page_count = attributes[:'PageCount']
186
- end
187
-
188
- if attributes.has_key?(:'ResultFile')
189
- self.result_file = attributes[:'ResultFile']
190
- end
191
-
192
- end
193
-
194
- # Show invalid properties with the reasons. Usually used together with valid?
195
- # @return Array for valid properies with the reasons
196
- def list_invalid_properties
197
- invalid_properties = Array.new
198
- return invalid_properties
199
- end
200
-
201
- # Check to see if the all the properties in the model are valid
202
- # @return true if the model is valid
203
- def valid?
204
- return true
205
- end
206
-
207
- # Checks equality by comparing each attribute.
208
- # @param [Object] Object to be compared
209
- def ==(o)
210
- return true if self.equal?(o)
211
- self.class == o.class &&
212
- brightness == o.brightness &&
213
- compression == o.compression &&
214
- color_depth == o.color_depth &&
215
- left_margin == o.left_margin &&
216
- right_margin == o.right_margin &&
217
- top_margin == o.top_margin &&
218
- bottom_margin == o.bottom_margin &&
219
- orientation == o.orientation &&
220
- skip_blank_pages == o.skip_blank_pages &&
221
- width == o.width &&
222
- height == o.height &&
223
- x_resolution == o.x_resolution &&
224
- y_resolution == o.y_resolution &&
225
- page_index == o.page_index &&
226
- page_count == o.page_count &&
227
- result_file == o.result_file
228
- end
229
-
230
- # @see the `==` method
231
- # @param [Object] Object to be compared
232
- def eql?(o)
233
- self == o
234
- end
235
-
236
- # Calculates hash code according to all attributes.
237
- # @return [Fixnum] Hash code
238
- def hash
239
- [brightness, compression, color_depth, left_margin, right_margin, top_margin, bottom_margin, orientation, skip_blank_pages, width, height, x_resolution, y_resolution, page_index, page_count, result_file].hash
240
- end
241
-
242
- # Builds the object from hash
243
- # @param [Hash] attributes Model attributes in the form of hash
244
- # @return [Object] Returns the model itself
245
- def build_from_hash(attributes)
246
- return nil unless attributes.is_a?(Hash)
247
- self.class.swagger_types.each_pair do |key, type|
248
- if type =~ /\AArray<(.*)>/i
249
- # check to ensure the input is an array given that the the attribute
250
- # is documented as an array but the input is not
251
- if attributes[self.class.attribute_map[key]].is_a?(Array)
252
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
253
- end
254
- elsif !attributes[self.class.attribute_map[key]].nil?
255
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
256
- end # or else data not found in attributes(hash), not an issue as the data can be optional
257
- end
258
-
259
- self
260
- end
261
-
262
- # Deserializes the data based on type
263
- # @param string type Data type
264
- # @param string value Value to be deserialized
265
- # @return [Object] Deserialized data
266
- def _deserialize(type, value)
267
- case type.to_sym
268
- when :DateTime
269
- DateTime.parse(value)
270
- when :Date
271
- Date.parse(value)
272
- when :String
273
- value.to_s
274
- when :Integer
275
- value.to_i
276
- when :Float
277
- value.to_f
278
- when :BOOLEAN
279
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
280
- true
281
- else
282
- false
283
- end
284
- when :Object
285
- # generic object (usually a Hash), return directly
286
- value
287
- when /\AArray<(?<inner_type>.+)>\z/
288
- inner_type = Regexp.last_match[:inner_type]
289
- value.map { |v| _deserialize(inner_type, v) }
290
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
291
- k_type = Regexp.last_match[:k_type]
292
- v_type = Regexp.last_match[:v_type]
293
- {}.tap do |hash|
294
- value.each do |k, v|
295
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
296
- end
297
- end
298
- else # model
299
- temp_model = AsposePdfCloud.const_get(type).new
300
- temp_model.build_from_hash(value)
301
- end
302
- end
303
-
304
- # Returns the string representation of the object
305
- # @return [String] String presentation of the object
306
- def to_s
307
- to_hash.to_s
308
- end
309
-
310
- # to_body is an alias to to_hash (backward compatibility)
311
- # @return [Hash] Returns the object in the form of hash
312
- def to_body
313
- to_hash
314
- end
315
-
316
- # Returns the object in the form of hash
317
- # @return [Hash] Returns the object in the form of hash
318
- def to_hash
319
- hash = {}
320
- self.class.attribute_map.each_pair do |attr, param|
321
- value = self.send(attr)
322
- next if value.nil?
323
- hash[param] = _to_hash(value)
324
- end
325
- hash
326
- end
327
-
328
- # Outputs non-array value in the form of hash
329
- # For object, use to_hash. Otherwise, just return the value
330
- # @param [Object] value Any valid value
331
- # @return [Hash] Returns the value in the form of hash
332
- def _to_hash(value)
333
- if value.is_a?(Array)
334
- value.compact.map{ |v| _to_hash(v) }
335
- elsif value.is_a?(Hash)
336
- {}.tap do |hash|
337
- value.each { |k, v| hash[k] = _to_hash(v) }
338
- end
339
- elsif value.respond_to? :to_hash
340
- value.to_hash
341
- else
342
- value
343
- end
344
- end
345
-
346
- end
347
-
348
- end
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 TextAnnotation.
26
+ class TextAnnotation
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 the state to which the original annotation should be set.
73
+ attr_accessor :state
74
+
75
+ # Gets or sets is the annotation open.
76
+ attr_accessor :open
77
+
78
+ # Color of the annotation.
79
+ attr_accessor :color
80
+
81
+ # Gets or sets an icon to be used in displaying the annotation.
82
+ attr_accessor :icon
83
+
84
+
85
+ # Attribute mapping from ruby-style variable name to JSON key.
86
+ def self.attribute_map
87
+ {
88
+ :'links' => :'Links',
89
+ :'contents' => :'Contents',
90
+ :'creation_date' => :'CreationDate',
91
+ :'subject' => :'Subject',
92
+ :'title' => :'Title',
93
+ :'modified' => :'Modified',
94
+ :'id' => :'Id',
95
+ :'flags' => :'Flags',
96
+ :'name' => :'Name',
97
+ :'rect' => :'Rect',
98
+ :'page_index' => :'PageIndex',
99
+ :'z_index' => :'ZIndex',
100
+ :'horizontal_alignment' => :'HorizontalAlignment',
101
+ :'vertical_alignment' => :'VerticalAlignment',
102
+ :'rich_text' => :'RichText',
103
+ :'state' => :'State',
104
+ :'open' => :'Open',
105
+ :'color' => :'Color',
106
+ :'icon' => :'Icon'
107
+ }
108
+ end
109
+
110
+ # Attribute type mapping.
111
+ def self.swagger_types
112
+ {
113
+ :'links' => :'Array<Link>',
114
+ :'contents' => :'String',
115
+ :'creation_date' => :'String',
116
+ :'subject' => :'String',
117
+ :'title' => :'String',
118
+ :'modified' => :'String',
119
+ :'id' => :'String',
120
+ :'flags' => :'Array<AnnotationFlags>',
121
+ :'name' => :'String',
122
+ :'rect' => :'RectanglePdf',
123
+ :'page_index' => :'Integer',
124
+ :'z_index' => :'Integer',
125
+ :'horizontal_alignment' => :'HorizontalAlignment',
126
+ :'vertical_alignment' => :'VerticalAlignment',
127
+ :'rich_text' => :'String',
128
+ :'state' => :'AnnotationState',
129
+ :'open' => :'BOOLEAN',
130
+ :'color' => :'Color',
131
+ :'icon' => :'TextIcon'
132
+ }
133
+ end
134
+
135
+ # Initializes the object
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ def initialize(attributes = {})
138
+ return unless attributes.is_a?(Hash)
139
+
140
+ # convert string to symbol for hash key
141
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
142
+
143
+ if attributes.has_key?(:'Links')
144
+ if (value = attributes[:'Links']).is_a?(Array)
145
+ self.links = value
146
+ end
147
+ end
148
+
149
+ if attributes.has_key?(:'Contents')
150
+ self.contents = attributes[:'Contents']
151
+ end
152
+
153
+ if attributes.has_key?(:'CreationDate')
154
+ self.creation_date = attributes[:'CreationDate']
155
+ end
156
+
157
+ if attributes.has_key?(:'Subject')
158
+ self.subject = attributes[:'Subject']
159
+ end
160
+
161
+ if attributes.has_key?(:'Title')
162
+ self.title = attributes[:'Title']
163
+ end
164
+
165
+ if attributes.has_key?(:'Modified')
166
+ self.modified = attributes[:'Modified']
167
+ end
168
+
169
+ if attributes.has_key?(:'Id')
170
+ self.id = attributes[:'Id']
171
+ end
172
+
173
+ if attributes.has_key?(:'Flags')
174
+ if (value = attributes[:'Flags']).is_a?(Array)
175
+ self.flags = value
176
+ end
177
+ end
178
+
179
+ if attributes.has_key?(:'Name')
180
+ self.name = attributes[:'Name']
181
+ end
182
+
183
+ if attributes.has_key?(:'Rect')
184
+ self.rect = attributes[:'Rect']
185
+ end
186
+
187
+ if attributes.has_key?(:'PageIndex')
188
+ self.page_index = attributes[:'PageIndex']
189
+ end
190
+
191
+ if attributes.has_key?(:'ZIndex')
192
+ self.z_index = attributes[:'ZIndex']
193
+ end
194
+
195
+ if attributes.has_key?(:'HorizontalAlignment')
196
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
197
+ end
198
+
199
+ if attributes.has_key?(:'VerticalAlignment')
200
+ self.vertical_alignment = attributes[:'VerticalAlignment']
201
+ end
202
+
203
+ if attributes.has_key?(:'RichText')
204
+ self.rich_text = attributes[:'RichText']
205
+ end
206
+
207
+ if attributes.has_key?(:'State')
208
+ self.state = attributes[:'State']
209
+ end
210
+
211
+ if attributes.has_key?(:'Open')
212
+ self.open = attributes[:'Open']
213
+ end
214
+
215
+ if attributes.has_key?(:'Color')
216
+ self.color = attributes[:'Color']
217
+ end
218
+
219
+ if attributes.has_key?(:'Icon')
220
+ self.icon = attributes[:'Icon']
221
+ end
222
+
223
+ end
224
+
225
+ # Show invalid properties with the reasons. Usually used together with valid?
226
+ # @return Array for valid properies with the reasons
227
+ def list_invalid_properties
228
+ invalid_properties = Array.new
229
+ return invalid_properties
230
+ end
231
+
232
+ # Check to see if the all the properties in the model are valid
233
+ # @return true if the model is valid
234
+ def valid?
235
+ return true
236
+ end
237
+
238
+ # Checks equality by comparing each attribute.
239
+ # @param [Object] Object to be compared
240
+ def ==(o)
241
+ return true if self.equal?(o)
242
+ self.class == o.class &&
243
+ links == o.links &&
244
+ contents == o.contents &&
245
+ creation_date == o.creation_date &&
246
+ subject == o.subject &&
247
+ title == o.title &&
248
+ modified == o.modified &&
249
+ id == o.id &&
250
+ flags == o.flags &&
251
+ name == o.name &&
252
+ rect == o.rect &&
253
+ page_index == o.page_index &&
254
+ z_index == o.z_index &&
255
+ horizontal_alignment == o.horizontal_alignment &&
256
+ vertical_alignment == o.vertical_alignment &&
257
+ rich_text == o.rich_text &&
258
+ state == o.state &&
259
+ open == o.open &&
260
+ color == o.color &&
261
+ icon == o.icon
262
+ end
263
+
264
+ # @see the `==` method
265
+ # @param [Object] Object to be compared
266
+ def eql?(o)
267
+ self == o
268
+ end
269
+
270
+ # Calculates hash code according to all attributes.
271
+ # @return [Fixnum] Hash code
272
+ def hash
273
+ [links, contents, creation_date, subject, title, modified, id, flags, name, rect, page_index, z_index, horizontal_alignment, vertical_alignment, rich_text, state, open, color, icon].hash
274
+ end
275
+
276
+ # Builds the object from hash
277
+ # @param [Hash] attributes Model attributes in the form of hash
278
+ # @return [Object] Returns the model itself
279
+ def build_from_hash(attributes)
280
+ return nil unless attributes.is_a?(Hash)
281
+ self.class.swagger_types.each_pair do |key, type|
282
+ if type =~ /\AArray<(.*)>/i
283
+ # check to ensure the input is an array given that the the attribute
284
+ # is documented as an array but the input is not
285
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
286
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
287
+ end
288
+ elsif !attributes[self.class.attribute_map[key]].nil?
289
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
290
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
291
+ end
292
+
293
+ self
294
+ end
295
+
296
+ # Deserializes the data based on type
297
+ # @param string type Data type
298
+ # @param string value Value to be deserialized
299
+ # @return [Object] Deserialized data
300
+ def _deserialize(type, value)
301
+ case type.to_sym
302
+ when :DateTime
303
+ DateTime.parse(value)
304
+ when :Date
305
+ Date.parse(value)
306
+ when :String
307
+ value.to_s
308
+ when :Integer
309
+ value.to_i
310
+ when :Float
311
+ value.to_f
312
+ when :BOOLEAN
313
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
314
+ true
315
+ else
316
+ false
317
+ end
318
+ when :Object
319
+ # generic object (usually a Hash), return directly
320
+ value
321
+ when /\AArray<(?<inner_type>.+)>\z/
322
+ inner_type = Regexp.last_match[:inner_type]
323
+ value.map { |v| _deserialize(inner_type, v) }
324
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
325
+ k_type = Regexp.last_match[:k_type]
326
+ v_type = Regexp.last_match[:v_type]
327
+ {}.tap do |hash|
328
+ value.each do |k, v|
329
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
330
+ end
331
+ end
332
+ else # model
333
+ temp_model = AsposePdfCloud.const_get(type).new
334
+ temp_model.build_from_hash(value)
335
+ end
336
+ end
337
+
338
+ # Returns the string representation of the object
339
+ # @return [String] String presentation of the object
340
+ def to_s
341
+ to_hash.to_s
342
+ end
343
+
344
+ # to_body is an alias to to_hash (backward compatibility)
345
+ # @return [Hash] Returns the object in the form of hash
346
+ def to_body
347
+ to_hash
348
+ end
349
+
350
+ # Returns the object in the form of hash
351
+ # @return [Hash] Returns the object in the form of hash
352
+ def to_hash
353
+ hash = {}
354
+ self.class.attribute_map.each_pair do |attr, param|
355
+ value = self.send(attr)
356
+ next if value.nil?
357
+ hash[param] = _to_hash(value)
358
+ end
359
+ hash
360
+ end
361
+
362
+ # Outputs non-array value in the form of hash
363
+ # For object, use to_hash. Otherwise, just return the value
364
+ # @param [Object] value Any valid value
365
+ # @return [Hash] Returns the value in the form of hash
366
+ def _to_hash(value)
367
+ if value.is_a?(Array)
368
+ value.compact.map{ |v| _to_hash(v) }
369
+ elsif value.is_a?(Hash)
370
+ {}.tap do |hash|
371
+ value.each { |k, v| hash[k] = _to_hash(v) }
372
+ end
373
+ elsif value.respond_to? :to_hash
374
+ value.to_hash
375
+ else
376
+ value
377
+ end
378
+ end
379
+
380
+ end
381
+
382
+ end