aspose_pdf_cloud 19.2.0 → 19.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -5
  3. data/docs/CellRecognized.md +10 -0
  4. data/docs/ImageStamp.md +25 -0
  5. data/docs/PdfApi.md +419 -3
  6. data/docs/PdfPageStamp.md +24 -0
  7. data/docs/Position.md +10 -0
  8. data/docs/RowRecognized.md +10 -0
  9. data/docs/StampBase.md +22 -0
  10. data/docs/StampInfo.md +16 -0
  11. data/docs/StampsInfo.md +10 -0
  12. data/docs/StampsInfoResponse.md +11 -0
  13. data/docs/TableRecognized.md +13 -0
  14. data/docs/TableRecognizedResponse.md +11 -0
  15. data/docs/TablesRecognized.md +10 -0
  16. data/docs/TablesRecognizedResponse.md +11 -0
  17. data/docs/TextRect.md +6 -1
  18. data/docs/TextStamp.md +25 -0
  19. data/lib/aspose_pdf_cloud.rb +14 -0
  20. data/lib/aspose_pdf_cloud/api/pdf_api.rb +1450 -204
  21. data/lib/aspose_pdf_cloud/models/cell_recognized.rb +211 -0
  22. data/lib/aspose_pdf_cloud/models/image_stamp.rb +363 -0
  23. data/lib/aspose_pdf_cloud/models/pdf_page_stamp.rb +353 -0
  24. data/lib/aspose_pdf_cloud/models/position.rb +221 -0
  25. data/lib/aspose_pdf_cloud/models/row_recognized.rb +213 -0
  26. data/lib/aspose_pdf_cloud/models/stamp_base.rb +333 -0
  27. data/lib/aspose_pdf_cloud/models/stamp_info.rb +273 -0
  28. data/lib/aspose_pdf_cloud/models/stamps_info.rb +215 -0
  29. data/lib/aspose_pdf_cloud/models/stamps_info_response.rb +226 -0
  30. data/lib/aspose_pdf_cloud/models/table_recognized.rb +245 -0
  31. data/lib/aspose_pdf_cloud/models/table_recognized_response.rb +226 -0
  32. data/lib/aspose_pdf_cloud/models/tables_recognized.rb +215 -0
  33. data/lib/aspose_pdf_cloud/models/tables_recognized_response.rb +226 -0
  34. data/lib/aspose_pdf_cloud/models/text_rect.rb +54 -9
  35. data/lib/aspose_pdf_cloud/models/text_stamp.rb +363 -0
  36. data/lib/aspose_pdf_cloud/version.rb +1 -1
  37. data/test/pdf_tests.rb +260 -3
  38. data/test_data/PageNumberStamp.pdf +0 -0
  39. data/test_data/PdfWithTable.pdf +0 -0
  40. metadata +32 -2
@@ -0,0 +1,226 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2019 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
+ require 'time'
24
+
25
+ module AsposePdfCloud
26
+ # Represents multiple stamps info reponse
27
+ class StampsInfoResponse
28
+ # Response status code.
29
+ attr_accessor :code
30
+
31
+ # Response status.
32
+ attr_accessor :status
33
+
34
+ # Stamps info
35
+ attr_accessor :stamps
36
+
37
+
38
+ # Attribute mapping from ruby-style variable name to JSON key.
39
+ def self.attribute_map
40
+ {
41
+ :'code' => :'Code',
42
+ :'status' => :'Status',
43
+ :'stamps' => :'Stamps'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'code' => :'Integer',
51
+ :'status' => :'String',
52
+ :'stamps' => :'StampsInfo'
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
63
+
64
+ if attributes.has_key?(:'Code')
65
+ self.code = attributes[:'Code']
66
+ end
67
+
68
+ if attributes.has_key?(:'Status')
69
+ self.status = attributes[:'Status']
70
+ end
71
+
72
+ if attributes.has_key?(:'Stamps')
73
+ self.stamps = attributes[:'Stamps']
74
+ end
75
+
76
+ end
77
+
78
+ # Show invalid properties with the reasons. Usually used together with valid?
79
+ # @return Array for valid properies with the reasons
80
+ def list_invalid_properties
81
+ invalid_properties = Array.new
82
+ if @code.nil?
83
+ invalid_properties.push("invalid value for 'code', code cannot be nil.")
84
+ end
85
+
86
+ return invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ return false if @code.nil?
93
+ return true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ code == o.code &&
102
+ status == o.status &&
103
+ stamps == o.stamps
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Fixnum] Hash code
114
+ def hash
115
+ [code, status, stamps].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.swagger_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
146
+ Time.strptime(value, format).utc.to_datetime
147
+ when :Date
148
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
149
+ Time.strptime(value, format).utc.to_datetime.to_date
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :BOOLEAN
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ temp_model = AsposePdfCloud.const_get(type).new
178
+ temp_model.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ next if value.nil?
201
+ hash[param] = _to_hash(value)
202
+ end
203
+ hash
204
+ end
205
+
206
+ # Outputs non-array value in the form of hash
207
+ # For object, use to_hash. Otherwise, just return the value
208
+ # @param [Object] value Any valid value
209
+ # @return [Hash] Returns the value in the form of hash
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map{ |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+
224
+ end
225
+
226
+ end
@@ -0,0 +1,245 @@
1
+ =begin
2
+ --------------------------------------------------------------------------------------------------------------------
3
+ Copyright (c) 2019 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
+ require 'time'
24
+
25
+ module AsposePdfCloud
26
+
27
+ class TableRecognized
28
+ # Link to the document.
29
+ attr_accessor :links
30
+
31
+ # Gets readonly IList containing rows of the table
32
+ attr_accessor :row_list
33
+
34
+ # Gets rectangle that describes position of the table on page
35
+ attr_accessor :rectangle
36
+
37
+ # Gets number of the page containing this table
38
+ attr_accessor :page_num
39
+
40
+ # Gets ID of the table.
41
+ attr_accessor :id
42
+
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'links' => :'Links',
48
+ :'row_list' => :'RowList',
49
+ :'rectangle' => :'Rectangle',
50
+ :'page_num' => :'PageNum',
51
+ :'id' => :'Id'
52
+ }
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.swagger_types
57
+ {
58
+ :'links' => :'Array<Link>',
59
+ :'row_list' => :'Array<RowRecognized>',
60
+ :'rectangle' => :'Rectangle',
61
+ :'page_num' => :'Integer',
62
+ :'id' => :'String'
63
+ }
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ return unless attributes.is_a?(Hash)
70
+
71
+ # convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
73
+
74
+ if attributes.has_key?(:'Links')
75
+ if (value = attributes[:'Links']).is_a?(Array)
76
+ self.links = value
77
+ end
78
+ end
79
+
80
+ if attributes.has_key?(:'RowList')
81
+ if (value = attributes[:'RowList']).is_a?(Array)
82
+ self.row_list = value
83
+ end
84
+ end
85
+
86
+ if attributes.has_key?(:'Rectangle')
87
+ self.rectangle = attributes[:'Rectangle']
88
+ end
89
+
90
+ if attributes.has_key?(:'PageNum')
91
+ self.page_num = attributes[:'PageNum']
92
+ end
93
+
94
+ if attributes.has_key?(:'Id')
95
+ self.id = attributes[:'Id']
96
+ end
97
+
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properies with the reasons
102
+ def list_invalid_properties
103
+ invalid_properties = Array.new
104
+ return invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+ return true
111
+ end
112
+
113
+ # Checks equality by comparing each attribute.
114
+ # @param [Object] Object to be compared
115
+ def ==(o)
116
+ return true if self.equal?(o)
117
+ self.class == o.class &&
118
+ links == o.links &&
119
+ row_list == o.row_list &&
120
+ rectangle == o.rectangle &&
121
+ page_num == o.page_num &&
122
+ id == o.id
123
+ end
124
+
125
+ # @see the `==` method
126
+ # @param [Object] Object to be compared
127
+ def eql?(o)
128
+ self == o
129
+ end
130
+
131
+ # Calculates hash code according to all attributes.
132
+ # @return [Fixnum] Hash code
133
+ def hash
134
+ [links, row_list, rectangle, page_num, id].hash
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def build_from_hash(attributes)
141
+ return nil unless attributes.is_a?(Hash)
142
+ self.class.swagger_types.each_pair do |key, type|
143
+ if type =~ /\AArray<(.*)>/i
144
+ # check to ensure the input is an array given that the the attribute
145
+ # is documented as an array but the input is not
146
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
147
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
148
+ end
149
+ elsif !attributes[self.class.attribute_map[key]].nil?
150
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
151
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
152
+ end
153
+
154
+ self
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param string type Data type
159
+ # @param string value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def _deserialize(type, value)
162
+ case type.to_sym
163
+ when :DateTime
164
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
165
+ Time.strptime(value, format).utc.to_datetime
166
+ when :Date
167
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
168
+ Time.strptime(value, format).utc.to_datetime.to_date
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :BOOLEAN
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ temp_model = AsposePdfCloud.const_get(type).new
197
+ temp_model.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ next if value.nil?
220
+ hash[param] = _to_hash(value)
221
+ end
222
+ hash
223
+ end
224
+
225
+ # Outputs non-array value in the form of hash
226
+ # For object, use to_hash. Otherwise, just return the value
227
+ # @param [Object] value Any valid value
228
+ # @return [Hash] Returns the value in the form of hash
229
+ def _to_hash(value)
230
+ if value.is_a?(Array)
231
+ value.compact.map{ |v| _to_hash(v) }
232
+ elsif value.is_a?(Hash)
233
+ {}.tap do |hash|
234
+ value.each { |k, v| hash[k] = _to_hash(v) }
235
+ end
236
+ elsif value.respond_to? :to_hash
237
+ value.to_hash
238
+ else
239
+ value
240
+ end
241
+ end
242
+
243
+ end
244
+
245
+ end