aspose_pdf_cloud 19.1.0 → 19.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,7 +31,7 @@ module AsposePdfCloud
31
31
  # Response status.
32
32
  attr_accessor :status
33
33
 
34
- # Ink annotations object
34
+ # Redaction annotations object
35
35
  attr_accessor :annotations
36
36
 
37
37
 
@@ -0,0 +1,335 @@
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
+ # Provides ScreenAnnotation.
27
+ class ScreenAnnotation
28
+ # Link to the document.
29
+ attr_accessor :links
30
+
31
+ # Color of the annotation.
32
+ attr_accessor :color
33
+
34
+ # Get the annotation content.
35
+ attr_accessor :contents
36
+
37
+ # The date and time when the annotation was last modified.
38
+ attr_accessor :modified
39
+
40
+ # Gets ID of the annotation.
41
+ attr_accessor :id
42
+
43
+ # Gets Flags of the annotation.
44
+ attr_accessor :flags
45
+
46
+ # Gets Name of the annotation.
47
+ attr_accessor :name
48
+
49
+ # Gets Rect of the annotation.
50
+ attr_accessor :rect
51
+
52
+ # Gets PageIndex of the annotation.
53
+ attr_accessor :page_index
54
+
55
+ # Gets ZIndex of the annotation.
56
+ attr_accessor :z_index
57
+
58
+ # Gets HorizontalAlignment of the annotation.
59
+ attr_accessor :horizontal_alignment
60
+
61
+ # Gets VerticalAlignment of the annotation.
62
+ attr_accessor :vertical_alignment
63
+
64
+ # Get the annotation title.
65
+ attr_accessor :title
66
+
67
+ # Sets content file path.
68
+ attr_accessor :file_path
69
+
70
+
71
+ # Attribute mapping from ruby-style variable name to JSON key.
72
+ def self.attribute_map
73
+ {
74
+ :'links' => :'Links',
75
+ :'color' => :'Color',
76
+ :'contents' => :'Contents',
77
+ :'modified' => :'Modified',
78
+ :'id' => :'Id',
79
+ :'flags' => :'Flags',
80
+ :'name' => :'Name',
81
+ :'rect' => :'Rect',
82
+ :'page_index' => :'PageIndex',
83
+ :'z_index' => :'ZIndex',
84
+ :'horizontal_alignment' => :'HorizontalAlignment',
85
+ :'vertical_alignment' => :'VerticalAlignment',
86
+ :'title' => :'Title',
87
+ :'file_path' => :'FilePath'
88
+ }
89
+ end
90
+
91
+ # Attribute type mapping.
92
+ def self.swagger_types
93
+ {
94
+ :'links' => :'Array<Link>',
95
+ :'color' => :'Color',
96
+ :'contents' => :'String',
97
+ :'modified' => :'String',
98
+ :'id' => :'String',
99
+ :'flags' => :'Array<AnnotationFlags>',
100
+ :'name' => :'String',
101
+ :'rect' => :'Rectangle',
102
+ :'page_index' => :'Integer',
103
+ :'z_index' => :'Integer',
104
+ :'horizontal_alignment' => :'HorizontalAlignment',
105
+ :'vertical_alignment' => :'VerticalAlignment',
106
+ :'title' => :'String',
107
+ :'file_path' => :'String'
108
+ }
109
+ end
110
+
111
+ # Initializes the object
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ def initialize(attributes = {})
114
+ return unless attributes.is_a?(Hash)
115
+
116
+ # convert string to symbol for hash key
117
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
118
+
119
+ if attributes.has_key?(:'Links')
120
+ if (value = attributes[:'Links']).is_a?(Array)
121
+ self.links = value
122
+ end
123
+ end
124
+
125
+ if attributes.has_key?(:'Color')
126
+ self.color = attributes[:'Color']
127
+ end
128
+
129
+ if attributes.has_key?(:'Contents')
130
+ self.contents = attributes[:'Contents']
131
+ end
132
+
133
+ if attributes.has_key?(:'Modified')
134
+ self.modified = attributes[:'Modified']
135
+ end
136
+
137
+ if attributes.has_key?(:'Id')
138
+ self.id = attributes[:'Id']
139
+ end
140
+
141
+ if attributes.has_key?(:'Flags')
142
+ if (value = attributes[:'Flags']).is_a?(Array)
143
+ self.flags = value
144
+ end
145
+ end
146
+
147
+ if attributes.has_key?(:'Name')
148
+ self.name = attributes[:'Name']
149
+ end
150
+
151
+ if attributes.has_key?(:'Rect')
152
+ self.rect = attributes[:'Rect']
153
+ end
154
+
155
+ if attributes.has_key?(:'PageIndex')
156
+ self.page_index = attributes[:'PageIndex']
157
+ end
158
+
159
+ if attributes.has_key?(:'ZIndex')
160
+ self.z_index = attributes[:'ZIndex']
161
+ end
162
+
163
+ if attributes.has_key?(:'HorizontalAlignment')
164
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
165
+ end
166
+
167
+ if attributes.has_key?(:'VerticalAlignment')
168
+ self.vertical_alignment = attributes[:'VerticalAlignment']
169
+ end
170
+
171
+ if attributes.has_key?(:'Title')
172
+ self.title = attributes[:'Title']
173
+ end
174
+
175
+ if attributes.has_key?(:'FilePath')
176
+ self.file_path = attributes[:'FilePath']
177
+ end
178
+
179
+ end
180
+
181
+ # Show invalid properties with the reasons. Usually used together with valid?
182
+ # @return Array for valid properies with the reasons
183
+ def list_invalid_properties
184
+ invalid_properties = Array.new
185
+ return invalid_properties
186
+ end
187
+
188
+ # Check to see if the all the properties in the model are valid
189
+ # @return true if the model is valid
190
+ def valid?
191
+ return true
192
+ end
193
+
194
+ # Checks equality by comparing each attribute.
195
+ # @param [Object] Object to be compared
196
+ def ==(o)
197
+ return true if self.equal?(o)
198
+ self.class == o.class &&
199
+ links == o.links &&
200
+ color == o.color &&
201
+ contents == o.contents &&
202
+ modified == o.modified &&
203
+ id == o.id &&
204
+ flags == o.flags &&
205
+ name == o.name &&
206
+ rect == o.rect &&
207
+ page_index == o.page_index &&
208
+ z_index == o.z_index &&
209
+ horizontal_alignment == o.horizontal_alignment &&
210
+ vertical_alignment == o.vertical_alignment &&
211
+ title == o.title &&
212
+ file_path == o.file_path
213
+ end
214
+
215
+ # @see the `==` method
216
+ # @param [Object] Object to be compared
217
+ def eql?(o)
218
+ self == o
219
+ end
220
+
221
+ # Calculates hash code according to all attributes.
222
+ # @return [Fixnum] Hash code
223
+ def hash
224
+ [links, color, contents, modified, id, flags, name, rect, page_index, z_index, horizontal_alignment, vertical_alignment, title, file_path].hash
225
+ end
226
+
227
+ # Builds the object from hash
228
+ # @param [Hash] attributes Model attributes in the form of hash
229
+ # @return [Object] Returns the model itself
230
+ def build_from_hash(attributes)
231
+ return nil unless attributes.is_a?(Hash)
232
+ self.class.swagger_types.each_pair do |key, type|
233
+ if type =~ /\AArray<(.*)>/i
234
+ # check to ensure the input is an array given that the the attribute
235
+ # is documented as an array but the input is not
236
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
237
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
238
+ end
239
+ elsif !attributes[self.class.attribute_map[key]].nil?
240
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
241
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
242
+ end
243
+
244
+ self
245
+ end
246
+
247
+ # Deserializes the data based on type
248
+ # @param string type Data type
249
+ # @param string value Value to be deserialized
250
+ # @return [Object] Deserialized data
251
+ def _deserialize(type, value)
252
+ case type.to_sym
253
+ when :DateTime
254
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
255
+ Time.strptime(value, format).utc.to_datetime
256
+ when :Date
257
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
258
+ Time.strptime(value, format).utc.to_datetime.to_date
259
+ when :String
260
+ value.to_s
261
+ when :Integer
262
+ value.to_i
263
+ when :Float
264
+ value.to_f
265
+ when :BOOLEAN
266
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
267
+ true
268
+ else
269
+ false
270
+ end
271
+ when :Object
272
+ # generic object (usually a Hash), return directly
273
+ value
274
+ when /\AArray<(?<inner_type>.+)>\z/
275
+ inner_type = Regexp.last_match[:inner_type]
276
+ value.map { |v| _deserialize(inner_type, v) }
277
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
278
+ k_type = Regexp.last_match[:k_type]
279
+ v_type = Regexp.last_match[:v_type]
280
+ {}.tap do |hash|
281
+ value.each do |k, v|
282
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
283
+ end
284
+ end
285
+ else # model
286
+ temp_model = AsposePdfCloud.const_get(type).new
287
+ temp_model.build_from_hash(value)
288
+ end
289
+ end
290
+
291
+ # Returns the string representation of the object
292
+ # @return [String] String presentation of the object
293
+ def to_s
294
+ to_hash.to_s
295
+ end
296
+
297
+ # to_body is an alias to to_hash (backward compatibility)
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_body
300
+ to_hash
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ next if value.nil?
310
+ hash[param] = _to_hash(value)
311
+ end
312
+ hash
313
+ end
314
+
315
+ # Outputs non-array value in the form of hash
316
+ # For object, use to_hash. Otherwise, just return the value
317
+ # @param [Object] value Any valid value
318
+ # @return [Hash] Returns the value in the form of hash
319
+ def _to_hash(value)
320
+ if value.is_a?(Array)
321
+ value.compact.map{ |v| _to_hash(v) }
322
+ elsif value.is_a?(Hash)
323
+ {}.tap do |hash|
324
+ value.each { |k, v| hash[k] = _to_hash(v) }
325
+ end
326
+ elsif value.respond_to? :to_hash
327
+ value.to_hash
328
+ else
329
+ value
330
+ end
331
+ end
332
+
333
+ end
334
+
335
+ end
@@ -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 response containing single screen annotation object
27
+ class ScreenAnnotationResponse
28
+ # Response status code.
29
+ attr_accessor :code
30
+
31
+ # Response status.
32
+ attr_accessor :status
33
+
34
+ # Screen annotation object
35
+ attr_accessor :annotation
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
+ :'annotation' => :'Annotation'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ :'code' => :'Integer',
51
+ :'status' => :'String',
52
+ :'annotation' => :'ScreenAnnotation'
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?(:'Annotation')
73
+ self.annotation = attributes[:'Annotation']
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
+ annotation == o.annotation
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, annotation].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