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,46 +1,47 @@
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 LinkActionType
26
-
27
- GO_TO_ACTION = 0.freeze
28
- GO_TO_URI_ACTION = 1.freeze
29
- JAVASCRIPT_ACTION = 2.freeze
30
- LAUNCH_ACTION = 3.freeze
31
- NAMED_ACTION = 4.freeze
32
- SUBMIT_FORM_ACTION = 5.freeze
33
-
34
- # Builds the enum from string
35
- # @param [Fixnum] The enum value in the form of the string
36
- # @return [Fixnum] The enum value
37
- def build_from_hash(value)
38
- constantValues = LinkActionType.constants.select{ |const_name| LinkActionType.const_get(const_name) == value}
39
- raise "Invalid ENUM value #{value} for class #LinkActionType" if constantValues.empty?
40
- value
41
- #constantValues[0]
42
- end
43
-
44
- end
45
-
46
- 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 LinkActionType
26
+
27
+ GO_TO_ACTION = "GoToAction".freeze
28
+ GO_TO_URI_ACTION = "GoToURIAction".freeze
29
+ JAVASCRIPT_ACTION = "JavascriptAction".freeze
30
+ LAUNCH_ACTION = "LaunchAction".freeze
31
+ NAMED_ACTION = "NamedAction".freeze
32
+ SUBMIT_FORM_ACTION = "SubmitFormAction".freeze
33
+
34
+ # Builds the enum from string
35
+ # @param [String] The enum value in the form of the string
36
+ # @return [String] The enum value
37
+ def build_from_hash(value)
38
+ # resolve issue with Concstant Name modification (ex: "FooName" to :FOO_NAME)
39
+ # consantValues = LinkActionType.constants.select{|c| c.to_s == value}
40
+ constantValues = LinkActionType.constants.select{ |const_name| LinkActionType.const_get(const_name) == value}
41
+
42
+ raise "Invalid ENUM value #{value} for class #LinkActionType" if constantValues.empty?
43
+ value
44
+ end
45
+ end
46
+
47
+ end
@@ -1,236 +1,254 @@
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 link to linkAnnotation.
26
- class LinkAnnotation
27
- # Link to the document.
28
- attr_accessor :links
29
-
30
- attr_accessor :action_type
31
-
32
- attr_accessor :action
33
-
34
- attr_accessor :highlighting
35
-
36
- attr_accessor :color
37
-
38
-
39
- # Attribute mapping from ruby-style variable name to JSON key.
40
- def self.attribute_map
41
- {
42
- :'links' => :'Links',
43
- :'action_type' => :'ActionType',
44
- :'action' => :'Action',
45
- :'highlighting' => :'Highlighting',
46
- :'color' => :'Color'
47
- }
48
- end
49
-
50
- # Attribute type mapping.
51
- def self.swagger_types
52
- {
53
- :'links' => :'Array<Link>',
54
- :'action_type' => :'LinkActionType',
55
- :'action' => :'String',
56
- :'highlighting' => :'LinkHighlightingMode',
57
- :'color' => :'Color'
58
- }
59
- end
60
-
61
- # Initializes the object
62
- # @param [Hash] attributes Model attributes in the form of hash
63
- def initialize(attributes = {})
64
- return unless attributes.is_a?(Hash)
65
-
66
- # convert string to symbol for hash key
67
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
68
-
69
- if attributes.has_key?(:'Links')
70
- if (value = attributes[:'Links']).is_a?(Array)
71
- self.links = value
72
- end
73
- end
74
-
75
- if attributes.has_key?(:'ActionType')
76
- self.action_type = attributes[:'ActionType']
77
- end
78
-
79
- if attributes.has_key?(:'Action')
80
- self.action = attributes[:'Action']
81
- end
82
-
83
- if attributes.has_key?(:'Highlighting')
84
- self.highlighting = attributes[:'Highlighting']
85
- end
86
-
87
- if attributes.has_key?(:'Color')
88
- self.color = attributes[:'Color']
89
- end
90
-
91
- end
92
-
93
- # Show invalid properties with the reasons. Usually used together with valid?
94
- # @return Array for valid properies with the reasons
95
- def list_invalid_properties
96
- invalid_properties = Array.new
97
- return invalid_properties
98
- end
99
-
100
- # Check to see if the all the properties in the model are valid
101
- # @return true if the model is valid
102
- def valid?
103
- return true
104
- end
105
-
106
- # Checks equality by comparing each attribute.
107
- # @param [Object] Object to be compared
108
- def ==(o)
109
- return true if self.equal?(o)
110
- self.class == o.class &&
111
- links == o.links &&
112
- action_type == o.action_type &&
113
- action == o.action &&
114
- highlighting == o.highlighting &&
115
- color == o.color
116
- end
117
-
118
- # @see the `==` method
119
- # @param [Object] Object to be compared
120
- def eql?(o)
121
- self == o
122
- end
123
-
124
- # Calculates hash code according to all attributes.
125
- # @return [Fixnum] Hash code
126
- def hash
127
- [links, action_type, action, highlighting, color].hash
128
- end
129
-
130
- # Builds the object from hash
131
- # @param [Hash] attributes Model attributes in the form of hash
132
- # @return [Object] Returns the model itself
133
- def build_from_hash(attributes)
134
- return nil unless attributes.is_a?(Hash)
135
- self.class.swagger_types.each_pair do |key, type|
136
- if type =~ /\AArray<(.*)>/i
137
- # check to ensure the input is an array given that the the attribute
138
- # is documented as an array but the input is not
139
- if attributes[self.class.attribute_map[key]].is_a?(Array)
140
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
141
- end
142
- elsif !attributes[self.class.attribute_map[key]].nil?
143
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
- end # or else data not found in attributes(hash), not an issue as the data can be optional
145
- end
146
-
147
- self
148
- end
149
-
150
- # Deserializes the data based on type
151
- # @param string type Data type
152
- # @param string value Value to be deserialized
153
- # @return [Object] Deserialized data
154
- def _deserialize(type, value)
155
- case type.to_sym
156
- when :DateTime
157
- DateTime.parse(value)
158
- when :Date
159
- Date.parse(value)
160
- when :String
161
- value.to_s
162
- when :Integer
163
- value.to_i
164
- when :Float
165
- value.to_f
166
- when :BOOLEAN
167
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
- true
169
- else
170
- false
171
- end
172
- when :Object
173
- # generic object (usually a Hash), return directly
174
- value
175
- when /\AArray<(?<inner_type>.+)>\z/
176
- inner_type = Regexp.last_match[:inner_type]
177
- value.map { |v| _deserialize(inner_type, v) }
178
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
- k_type = Regexp.last_match[:k_type]
180
- v_type = Regexp.last_match[:v_type]
181
- {}.tap do |hash|
182
- value.each do |k, v|
183
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
- end
185
- end
186
- else # model
187
- temp_model = AsposePdfCloud.const_get(type).new
188
- temp_model.build_from_hash(value)
189
- end
190
- end
191
-
192
- # Returns the string representation of the object
193
- # @return [String] String presentation of the object
194
- def to_s
195
- to_hash.to_s
196
- end
197
-
198
- # to_body is an alias to to_hash (backward compatibility)
199
- # @return [Hash] Returns the object in the form of hash
200
- def to_body
201
- to_hash
202
- end
203
-
204
- # Returns the object in the form of hash
205
- # @return [Hash] Returns the object in the form of hash
206
- def to_hash
207
- hash = {}
208
- self.class.attribute_map.each_pair do |attr, param|
209
- value = self.send(attr)
210
- next if value.nil?
211
- hash[param] = _to_hash(value)
212
- end
213
- hash
214
- end
215
-
216
- # Outputs non-array value in the form of hash
217
- # For object, use to_hash. Otherwise, just return the value
218
- # @param [Object] value Any valid value
219
- # @return [Hash] Returns the value in the form of hash
220
- def _to_hash(value)
221
- if value.is_a?(Array)
222
- value.compact.map{ |v| _to_hash(v) }
223
- elsif value.is_a?(Hash)
224
- {}.tap do |hash|
225
- value.each { |k, v| hash[k] = _to_hash(v) }
226
- end
227
- elsif value.respond_to? :to_hash
228
- value.to_hash
229
- else
230
- value
231
- end
232
- end
233
-
234
- end
235
-
236
- 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 link to linkAnnotation.
26
+ class LinkAnnotation
27
+ # Link to the document.
28
+ attr_accessor :links
29
+
30
+ attr_accessor :action_type
31
+
32
+ attr_accessor :action
33
+
34
+ attr_accessor :highlighting
35
+
36
+ attr_accessor :color
37
+
38
+ attr_accessor :rect
39
+
40
+ attr_accessor :id
41
+
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'links' => :'Links',
47
+ :'action_type' => :'ActionType',
48
+ :'action' => :'Action',
49
+ :'highlighting' => :'Highlighting',
50
+ :'color' => :'Color',
51
+ :'rect' => :'Rect',
52
+ :'id' => :'Id'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'links' => :'Array<Link>',
60
+ :'action_type' => :'LinkActionType',
61
+ :'action' => :'String',
62
+ :'highlighting' => :'LinkHighlightingMode',
63
+ :'color' => :'Color',
64
+ :'rect' => :'RectanglePdf',
65
+ :'id' => :'String'
66
+ }
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ return unless attributes.is_a?(Hash)
73
+
74
+ # convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
76
+
77
+ if attributes.has_key?(:'Links')
78
+ if (value = attributes[:'Links']).is_a?(Array)
79
+ self.links = value
80
+ end
81
+ end
82
+
83
+ if attributes.has_key?(:'ActionType')
84
+ self.action_type = attributes[:'ActionType']
85
+ end
86
+
87
+ if attributes.has_key?(:'Action')
88
+ self.action = attributes[:'Action']
89
+ end
90
+
91
+ if attributes.has_key?(:'Highlighting')
92
+ self.highlighting = attributes[:'Highlighting']
93
+ end
94
+
95
+ if attributes.has_key?(:'Color')
96
+ self.color = attributes[:'Color']
97
+ end
98
+
99
+ if attributes.has_key?(:'Rect')
100
+ self.rect = attributes[:'Rect']
101
+ end
102
+
103
+ if attributes.has_key?(:'Id')
104
+ self.id = attributes[:'Id']
105
+ end
106
+
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properies with the reasons
111
+ def list_invalid_properties
112
+ invalid_properties = Array.new
113
+ return invalid_properties
114
+ end
115
+
116
+ # Check to see if the all the properties in the model are valid
117
+ # @return true if the model is valid
118
+ def valid?
119
+ return true
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ links == o.links &&
128
+ action_type == o.action_type &&
129
+ action == o.action &&
130
+ highlighting == o.highlighting &&
131
+ color == o.color &&
132
+ rect == o.rect &&
133
+ id == o.id
134
+ end
135
+
136
+ # @see the `==` method
137
+ # @param [Object] Object to be compared
138
+ def eql?(o)
139
+ self == o
140
+ end
141
+
142
+ # Calculates hash code according to all attributes.
143
+ # @return [Fixnum] Hash code
144
+ def hash
145
+ [links, action_type, action, highlighting, color, rect, id].hash
146
+ end
147
+
148
+ # Builds the object from hash
149
+ # @param [Hash] attributes Model attributes in the form of hash
150
+ # @return [Object] Returns the model itself
151
+ def build_from_hash(attributes)
152
+ return nil unless attributes.is_a?(Hash)
153
+ self.class.swagger_types.each_pair do |key, type|
154
+ if type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
158
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
159
+ end
160
+ elsif !attributes[self.class.attribute_map[key]].nil?
161
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
162
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
163
+ end
164
+
165
+ self
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def _deserialize(type, value)
173
+ case type.to_sym
174
+ when :DateTime
175
+ DateTime.parse(value)
176
+ when :Date
177
+ Date.parse(value)
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :BOOLEAN
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ temp_model = AsposePdfCloud.const_get(type).new
206
+ temp_model.build_from_hash(value)
207
+ end
208
+ end
209
+
210
+ # Returns the string representation of the object
211
+ # @return [String] String presentation of the object
212
+ def to_s
213
+ to_hash.to_s
214
+ end
215
+
216
+ # to_body is an alias to to_hash (backward compatibility)
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_body
219
+ to_hash
220
+ end
221
+
222
+ # Returns the object in the form of hash
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_hash
225
+ hash = {}
226
+ self.class.attribute_map.each_pair do |attr, param|
227
+ value = self.send(attr)
228
+ next if value.nil?
229
+ hash[param] = _to_hash(value)
230
+ end
231
+ hash
232
+ end
233
+
234
+ # Outputs non-array value in the form of hash
235
+ # For object, use to_hash. Otherwise, just return the value
236
+ # @param [Object] value Any valid value
237
+ # @return [Hash] Returns the value in the form of hash
238
+ def _to_hash(value)
239
+ if value.is_a?(Array)
240
+ value.compact.map{ |v| _to_hash(v) }
241
+ elsif value.is_a?(Hash)
242
+ {}.tap do |hash|
243
+ value.each { |k, v| hash[k] = _to_hash(v) }
244
+ end
245
+ elsif value.respond_to? :to_hash
246
+ value.to_hash
247
+ else
248
+ value
249
+ end
250
+ end
251
+
252
+ end
253
+
254
+ end