aspose_pdf_cloud 19.7.0 → 19.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,45 @@
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
+ class DocMDPAccessPermissionType
27
+
28
+ NO_CHANGES = "NoChanges".freeze
29
+ FILLING_IN_FORMS = "FillingInForms".freeze
30
+ ANNOTATION_MODIFICATION = "AnnotationModification".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 = DocMDPAccessPermissionType.constants.select{|c| c.to_s == value}
38
+ constantValues = DocMDPAccessPermissionType.constants.select{ |const_name| DocMDPAccessPermissionType.const_get(const_name) == value}
39
+
40
+ raise "Invalid ENUM value #{value} for class #DocMDPAccessPermissionType" if constantValues.empty?
41
+ value
42
+ end
43
+ end
44
+
45
+ end
@@ -0,0 +1,383 @@
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 form field.
27
+ class FormField
28
+ # Link to the document.
29
+ attr_accessor :links
30
+
31
+ # Field name.
32
+ attr_accessor :partial_name
33
+
34
+ # Field rectangle.
35
+ attr_accessor :rect
36
+
37
+ # Field value.
38
+ attr_accessor :value
39
+
40
+ # Page index.
41
+ attr_accessor :page_index
42
+
43
+ # Gets or sets height of the field.
44
+ attr_accessor :height
45
+
46
+ # Gets or sets width of the field.
47
+ attr_accessor :width
48
+
49
+ # Z index.
50
+ attr_accessor :z_index
51
+
52
+ # Is group.
53
+ attr_accessor :is_group
54
+
55
+ # Gets field parent.
56
+ attr_accessor :parent
57
+
58
+ # Property for Generator support. Used when field is added to header or footer. If true, this field will created once and it's appearance will be visible on all pages of the document. If false, separated field will be created for every document page.
59
+ attr_accessor :is_shared_field
60
+
61
+ # Gets Flags of the field.
62
+ attr_accessor :flags
63
+
64
+ # Color of the annotation.
65
+ attr_accessor :color
66
+
67
+ # Get the field content.
68
+ attr_accessor :contents
69
+
70
+ # Gets or sets a outer margin for paragraph (for pdf generation)
71
+ attr_accessor :margin
72
+
73
+ # Field highlighting mode.
74
+ attr_accessor :highlighting
75
+
76
+ # Gets HorizontalAlignment of the field.
77
+ attr_accessor :horizontal_alignment
78
+
79
+ # Gets VerticalAlignment of the field.
80
+ attr_accessor :vertical_alignment
81
+
82
+
83
+ # Attribute mapping from ruby-style variable name to JSON key.
84
+ def self.attribute_map
85
+ {
86
+ :'links' => :'Links',
87
+ :'partial_name' => :'PartialName',
88
+ :'rect' => :'Rect',
89
+ :'value' => :'Value',
90
+ :'page_index' => :'PageIndex',
91
+ :'height' => :'Height',
92
+ :'width' => :'Width',
93
+ :'z_index' => :'ZIndex',
94
+ :'is_group' => :'IsGroup',
95
+ :'parent' => :'Parent',
96
+ :'is_shared_field' => :'IsSharedField',
97
+ :'flags' => :'Flags',
98
+ :'color' => :'Color',
99
+ :'contents' => :'Contents',
100
+ :'margin' => :'Margin',
101
+ :'highlighting' => :'Highlighting',
102
+ :'horizontal_alignment' => :'HorizontalAlignment',
103
+ :'vertical_alignment' => :'VerticalAlignment'
104
+ }
105
+ end
106
+
107
+ # Attribute type mapping.
108
+ def self.swagger_types
109
+ {
110
+ :'links' => :'Array<Link>',
111
+ :'partial_name' => :'String',
112
+ :'rect' => :'Rectangle',
113
+ :'value' => :'String',
114
+ :'page_index' => :'Integer',
115
+ :'height' => :'Float',
116
+ :'width' => :'Float',
117
+ :'z_index' => :'Integer',
118
+ :'is_group' => :'BOOLEAN',
119
+ :'parent' => :'FormField',
120
+ :'is_shared_field' => :'BOOLEAN',
121
+ :'flags' => :'Array<AnnotationFlags>',
122
+ :'color' => :'Color',
123
+ :'contents' => :'String',
124
+ :'margin' => :'MarginInfo',
125
+ :'highlighting' => :'LinkHighlightingMode',
126
+ :'horizontal_alignment' => :'HorizontalAlignment',
127
+ :'vertical_alignment' => :'VerticalAlignment'
128
+ }
129
+ end
130
+
131
+ # Initializes the object
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ def initialize(attributes = {})
134
+ return unless attributes.is_a?(Hash)
135
+
136
+ # convert string to symbol for hash key
137
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
138
+
139
+ if attributes.has_key?(:'Links')
140
+ if (value = attributes[:'Links']).is_a?(Array)
141
+ self.links = value
142
+ end
143
+ end
144
+
145
+ if attributes.has_key?(:'PartialName')
146
+ self.partial_name = attributes[:'PartialName']
147
+ end
148
+
149
+ if attributes.has_key?(:'Rect')
150
+ self.rect = attributes[:'Rect']
151
+ end
152
+
153
+ if attributes.has_key?(:'Value')
154
+ self.value = attributes[:'Value']
155
+ end
156
+
157
+ if attributes.has_key?(:'PageIndex')
158
+ self.page_index = attributes[:'PageIndex']
159
+ end
160
+
161
+ if attributes.has_key?(:'Height')
162
+ self.height = attributes[:'Height']
163
+ end
164
+
165
+ if attributes.has_key?(:'Width')
166
+ self.width = attributes[:'Width']
167
+ end
168
+
169
+ if attributes.has_key?(:'ZIndex')
170
+ self.z_index = attributes[:'ZIndex']
171
+ end
172
+
173
+ if attributes.has_key?(:'IsGroup')
174
+ self.is_group = attributes[:'IsGroup']
175
+ end
176
+
177
+ if attributes.has_key?(:'Parent')
178
+ self.parent = attributes[:'Parent']
179
+ end
180
+
181
+ if attributes.has_key?(:'IsSharedField')
182
+ self.is_shared_field = attributes[:'IsSharedField']
183
+ end
184
+
185
+ if attributes.has_key?(:'Flags')
186
+ if (value = attributes[:'Flags']).is_a?(Array)
187
+ self.flags = value
188
+ end
189
+ end
190
+
191
+ if attributes.has_key?(:'Color')
192
+ self.color = attributes[:'Color']
193
+ end
194
+
195
+ if attributes.has_key?(:'Contents')
196
+ self.contents = attributes[:'Contents']
197
+ end
198
+
199
+ if attributes.has_key?(:'Margin')
200
+ self.margin = attributes[:'Margin']
201
+ end
202
+
203
+ if attributes.has_key?(:'Highlighting')
204
+ self.highlighting = attributes[:'Highlighting']
205
+ end
206
+
207
+ if attributes.has_key?(:'HorizontalAlignment')
208
+ self.horizontal_alignment = attributes[:'HorizontalAlignment']
209
+ end
210
+
211
+ if attributes.has_key?(:'VerticalAlignment')
212
+ self.vertical_alignment = attributes[:'VerticalAlignment']
213
+ end
214
+
215
+ end
216
+
217
+ # Show invalid properties with the reasons. Usually used together with valid?
218
+ # @return Array for valid properies with the reasons
219
+ def list_invalid_properties
220
+ invalid_properties = Array.new
221
+ if @page_index.nil?
222
+ invalid_properties.push("invalid value for 'page_index', page_index cannot be nil.")
223
+ end
224
+
225
+ if @is_group.nil?
226
+ invalid_properties.push("invalid value for 'is_group', is_group cannot be nil.")
227
+ end
228
+
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 false if @page_index.nil?
236
+ return false if @is_group.nil?
237
+ return true
238
+ end
239
+
240
+ # Checks equality by comparing each attribute.
241
+ # @param [Object] Object to be compared
242
+ def ==(o)
243
+ return true if self.equal?(o)
244
+ self.class == o.class &&
245
+ links == o.links &&
246
+ partial_name == o.partial_name &&
247
+ rect == o.rect &&
248
+ value == o.value &&
249
+ page_index == o.page_index &&
250
+ height == o.height &&
251
+ width == o.width &&
252
+ z_index == o.z_index &&
253
+ is_group == o.is_group &&
254
+ parent == o.parent &&
255
+ is_shared_field == o.is_shared_field &&
256
+ flags == o.flags &&
257
+ color == o.color &&
258
+ contents == o.contents &&
259
+ margin == o.margin &&
260
+ highlighting == o.highlighting &&
261
+ horizontal_alignment == o.horizontal_alignment &&
262
+ vertical_alignment == o.vertical_alignment
263
+ end
264
+
265
+ # @see the `==` method
266
+ # @param [Object] Object to be compared
267
+ def eql?(o)
268
+ self == o
269
+ end
270
+
271
+ # Calculates hash code according to all attributes.
272
+ # @return [Fixnum] Hash code
273
+ def hash
274
+ [links, partial_name, rect, value, page_index, height, width, z_index, is_group, parent, is_shared_field, flags, color, contents, margin, highlighting, horizontal_alignment, vertical_alignment].hash
275
+ end
276
+
277
+ # Builds the object from hash
278
+ # @param [Hash] attributes Model attributes in the form of hash
279
+ # @return [Object] Returns the model itself
280
+ def build_from_hash(attributes)
281
+ return nil unless attributes.is_a?(Hash)
282
+ self.class.swagger_types.each_pair do |key, type|
283
+ if type =~ /\AArray<(.*)>/i
284
+ # check to ensure the input is an array given that the the attribute
285
+ # is documented as an array but the input is not
286
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
287
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
288
+ end
289
+ elsif !attributes[self.class.attribute_map[key]].nil?
290
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
291
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
292
+ end
293
+
294
+ self
295
+ end
296
+
297
+ # Deserializes the data based on type
298
+ # @param string type Data type
299
+ # @param string value Value to be deserialized
300
+ # @return [Object] Deserialized data
301
+ def _deserialize(type, value)
302
+ case type.to_sym
303
+ when :DateTime
304
+ DateTime.parse(value)
305
+ when :Date
306
+ Date.parse(value)
307
+ when :String
308
+ value.to_s
309
+ when :Integer
310
+ value.to_i
311
+ when :Float
312
+ value.to_f
313
+ when :BOOLEAN
314
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
315
+ true
316
+ else
317
+ false
318
+ end
319
+ when :Object
320
+ # generic object (usually a Hash), return directly
321
+ value
322
+ when /\AArray<(?<inner_type>.+)>\z/
323
+ inner_type = Regexp.last_match[:inner_type]
324
+ value.map { |v| _deserialize(inner_type, v) }
325
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
326
+ k_type = Regexp.last_match[:k_type]
327
+ v_type = Regexp.last_match[:v_type]
328
+ {}.tap do |hash|
329
+ value.each do |k, v|
330
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
331
+ end
332
+ end
333
+ else # model
334
+ temp_model = AsposePdfCloud.const_get(type).new
335
+ temp_model.build_from_hash(value)
336
+ end
337
+ end
338
+
339
+ # Returns the string representation of the object
340
+ # @return [String] String presentation of the object
341
+ def to_s
342
+ to_hash.to_s
343
+ end
344
+
345
+ # to_body is an alias to to_hash (backward compatibility)
346
+ # @return [Hash] Returns the object in the form of hash
347
+ def to_body
348
+ to_hash
349
+ end
350
+
351
+ # Returns the object in the form of hash
352
+ # @return [Hash] Returns the object in the form of hash
353
+ def to_hash
354
+ hash = {}
355
+ self.class.attribute_map.each_pair do |attr, param|
356
+ value = self.send(attr)
357
+ next if value.nil?
358
+ hash[param] = _to_hash(value)
359
+ end
360
+ hash
361
+ end
362
+
363
+ # Outputs non-array value in the form of hash
364
+ # For object, use to_hash. Otherwise, just return the value
365
+ # @param [Object] value Any valid value
366
+ # @return [Hash] Returns the value in the form of hash
367
+ def _to_hash(value)
368
+ if value.is_a?(Array)
369
+ value.compact.map{ |v| _to_hash(v) }
370
+ elsif value.is_a?(Hash)
371
+ {}.tap do |hash|
372
+ value.each { |k, v| hash[k] = _to_hash(v) }
373
+ end
374
+ elsif value.respond_to? :to_hash
375
+ value.to_hash
376
+ else
377
+ value
378
+ end
379
+ end
380
+
381
+ end
382
+
383
+ end
@@ -64,6 +64,15 @@ module AsposePdfCloud
64
64
  # Gets or sets the showproperties in signature field
65
65
  attr_accessor :show_properties
66
66
 
67
+ # Gets/sets timestamp settings.
68
+ attr_accessor :timestamp_settings
69
+
70
+ # Verify the document regarding this signature and return true if document is valid or otherwise false.
71
+ attr_accessor :is_valid
72
+
73
+ # Gets/sets the custom appearance.
74
+ attr_accessor :custom_appearance
75
+
67
76
 
68
77
  # Attribute mapping from ruby-style variable name to JSON key.
69
78
  def self.attribute_map
@@ -80,7 +89,10 @@ module AsposePdfCloud
80
89
  :'form_field_name' => :'FormFieldName',
81
90
  :'authority' => :'Authority',
82
91
  :'date' => :'Date',
83
- :'show_properties' => :'ShowProperties'
92
+ :'show_properties' => :'ShowProperties',
93
+ :'timestamp_settings' => :'TimestampSettings',
94
+ :'is_valid' => :'IsValid',
95
+ :'custom_appearance' => :'CustomAppearance'
84
96
  }
85
97
  end
86
98
 
@@ -99,7 +111,10 @@ module AsposePdfCloud
99
111
  :'form_field_name' => :'String',
100
112
  :'authority' => :'String',
101
113
  :'date' => :'String',
102
- :'show_properties' => :'BOOLEAN'
114
+ :'show_properties' => :'BOOLEAN',
115
+ :'timestamp_settings' => :'TimestampSettings',
116
+ :'is_valid' => :'BOOLEAN',
117
+ :'custom_appearance' => :'SignatureCustomAppearance'
103
118
  }
104
119
  end
105
120
 
@@ -163,6 +178,18 @@ module AsposePdfCloud
163
178
  self.show_properties = attributes[:'ShowProperties']
164
179
  end
165
180
 
181
+ if attributes.has_key?(:'TimestampSettings')
182
+ self.timestamp_settings = attributes[:'TimestampSettings']
183
+ end
184
+
185
+ if attributes.has_key?(:'IsValid')
186
+ self.is_valid = attributes[:'IsValid']
187
+ end
188
+
189
+ if attributes.has_key?(:'CustomAppearance')
190
+ self.custom_appearance = attributes[:'CustomAppearance']
191
+ end
192
+
166
193
  end
167
194
 
168
195
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -234,7 +261,10 @@ module AsposePdfCloud
234
261
  form_field_name == o.form_field_name &&
235
262
  authority == o.authority &&
236
263
  date == o.date &&
237
- show_properties == o.show_properties
264
+ show_properties == o.show_properties &&
265
+ timestamp_settings == o.timestamp_settings &&
266
+ is_valid == o.is_valid &&
267
+ custom_appearance == o.custom_appearance
238
268
  end
239
269
 
240
270
  # @see the `==` method
@@ -246,7 +276,7 @@ module AsposePdfCloud
246
276
  # Calculates hash code according to all attributes.
247
277
  # @return [Fixnum] Hash code
248
278
  def hash
249
- [signature_path, signature_type, password, appearance, reason, contact, location, visible, rectangle, form_field_name, authority, date, show_properties].hash
279
+ [signature_path, signature_type, password, appearance, reason, contact, location, visible, rectangle, form_field_name, authority, date, show_properties, timestamp_settings, is_valid, custom_appearance].hash
250
280
  end
251
281
 
252
282
  # Builds the object from hash