groupdocs_signature_cloud 19.5 → 20.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/lib/groupdocs_signature_cloud.rb +9 -1
  3. data/lib/groupdocs_signature_cloud/api/file_api.rb +7 -7
  4. data/lib/groupdocs_signature_cloud/api/folder_api.rb +7 -7
  5. data/lib/groupdocs_signature_cloud/api/info_api.rb +2 -2
  6. data/lib/groupdocs_signature_cloud/api/sign_api.rb +198 -4
  7. data/lib/groupdocs_signature_cloud/api/storage_api.rb +5 -5
  8. data/lib/groupdocs_signature_cloud/api_client.rb +1 -1
  9. data/lib/groupdocs_signature_cloud/api_error.rb +1 -1
  10. data/lib/groupdocs_signature_cloud/configuration.rb +1 -1
  11. data/lib/groupdocs_signature_cloud/models/barcode_signature.rb +140 -36
  12. data/lib/groupdocs_signature_cloud/models/barcode_type.rb +1 -1
  13. data/lib/groupdocs_signature_cloud/models/barcodes_result.rb +1 -1
  14. data/lib/groupdocs_signature_cloud/models/base_settings.rb +1 -1
  15. data/lib/groupdocs_signature_cloud/models/border_line.rb +22 -7
  16. data/lib/groupdocs_signature_cloud/models/brush.rb +1 -1
  17. data/lib/groupdocs_signature_cloud/models/color.rb +1 -1
  18. data/lib/groupdocs_signature_cloud/models/delete_options.rb +271 -0
  19. data/lib/groupdocs_signature_cloud/models/delete_result.rb +258 -0
  20. data/lib/groupdocs_signature_cloud/models/delete_settings.rb +231 -0
  21. data/lib/groupdocs_signature_cloud/models/digital_signature.rb +127 -64
  22. data/lib/groupdocs_signature_cloud/models/disc_usage.rb +1 -1
  23. data/lib/groupdocs_signature_cloud/models/error.rb +1 -1
  24. data/lib/groupdocs_signature_cloud/models/error_details.rb +1 -1
  25. data/lib/groupdocs_signature_cloud/models/file_info.rb +1 -1
  26. data/lib/groupdocs_signature_cloud/models/file_version.rb +1 -1
  27. data/lib/groupdocs_signature_cloud/models/file_versions.rb +1 -1
  28. data/lib/groupdocs_signature_cloud/models/files_list.rb +1 -1
  29. data/lib/groupdocs_signature_cloud/models/files_upload_result.rb +1 -1
  30. data/lib/groupdocs_signature_cloud/models/format.rb +1 -1
  31. data/lib/groupdocs_signature_cloud/models/formats_result.rb +1 -1
  32. data/lib/groupdocs_signature_cloud/models/image_signature.rb +411 -0
  33. data/lib/groupdocs_signature_cloud/models/info_result.rb +1 -1
  34. data/lib/groupdocs_signature_cloud/models/info_settings.rb +1 -1
  35. data/lib/groupdocs_signature_cloud/models/linear_gradient_brush.rb +1 -1
  36. data/lib/groupdocs_signature_cloud/models/object_exist.rb +1 -1
  37. data/lib/groupdocs_signature_cloud/models/options_base.rb +2 -33
  38. data/lib/groupdocs_signature_cloud/models/padding.rb +1 -1
  39. data/lib/groupdocs_signature_cloud/models/page_info.rb +1 -1
  40. data/lib/groupdocs_signature_cloud/models/pages_setup.rb +1 -1
  41. data/lib/groupdocs_signature_cloud/models/qr_code_signature.rb +140 -36
  42. data/lib/groupdocs_signature_cloud/models/qr_code_type.rb +1 -1
  43. data/lib/groupdocs_signature_cloud/models/qr_codes_result.rb +1 -1
  44. data/lib/groupdocs_signature_cloud/models/radial_gradient_brush.rb +1 -1
  45. data/lib/groupdocs_signature_cloud/models/save_options.rb +1 -1
  46. data/lib/groupdocs_signature_cloud/models/search_barcode_options.rb +2 -33
  47. data/lib/groupdocs_signature_cloud/models/search_digital_options.rb +2 -33
  48. data/lib/groupdocs_signature_cloud/models/search_options.rb +2 -33
  49. data/lib/groupdocs_signature_cloud/models/search_qr_code_options.rb +2 -33
  50. data/lib/groupdocs_signature_cloud/models/search_result.rb +1 -1
  51. data/lib/groupdocs_signature_cloud/models/search_settings.rb +1 -1
  52. data/lib/groupdocs_signature_cloud/models/sign_barcode_options.rb +33 -125
  53. data/lib/groupdocs_signature_cloud/models/sign_digital_options.rb +114 -59
  54. data/lib/groupdocs_signature_cloud/models/sign_image_options.rb +32 -53
  55. data/lib/groupdocs_signature_cloud/models/sign_options.rb +2 -33
  56. data/lib/groupdocs_signature_cloud/models/sign_qr_code_options.rb +42 -134
  57. data/lib/groupdocs_signature_cloud/models/sign_result.rb +29 -5
  58. data/lib/groupdocs_signature_cloud/models/sign_settings.rb +1 -1
  59. data/lib/groupdocs_signature_cloud/models/sign_stamp_options.rb +32 -53
  60. data/lib/groupdocs_signature_cloud/models/sign_text_options.rb +31 -108
  61. data/lib/groupdocs_signature_cloud/models/signature.rb +130 -36
  62. data/lib/groupdocs_signature_cloud/models/signature_font.rb +1 -1
  63. data/lib/groupdocs_signature_cloud/models/solid_brush.rb +1 -1
  64. data/lib/groupdocs_signature_cloud/models/stamp_line.rb +1 -1
  65. data/lib/groupdocs_signature_cloud/models/storage_exist.rb +1 -1
  66. data/lib/groupdocs_signature_cloud/models/storage_file.rb +1 -1
  67. data/lib/groupdocs_signature_cloud/models/text_signature.rb +406 -0
  68. data/lib/groupdocs_signature_cloud/models/texture_brush.rb +9 -9
  69. data/lib/groupdocs_signature_cloud/models/update_options.rb +356 -0
  70. data/lib/groupdocs_signature_cloud/models/update_result.rb +258 -0
  71. data/lib/groupdocs_signature_cloud/models/update_settings.rb +231 -0
  72. data/lib/groupdocs_signature_cloud/models/verify_barcode_options.rb +2 -33
  73. data/lib/groupdocs_signature_cloud/models/verify_digital_options.rb +8 -39
  74. data/lib/groupdocs_signature_cloud/models/verify_options.rb +2 -33
  75. data/lib/groupdocs_signature_cloud/models/verify_qr_code_options.rb +2 -33
  76. data/lib/groupdocs_signature_cloud/models/verify_result.rb +1 -1
  77. data/lib/groupdocs_signature_cloud/models/verify_settings.rb +1 -1
  78. data/lib/groupdocs_signature_cloud/models/verify_text_options.rb +2 -33
  79. data/lib/groupdocs_signature_cloud/version.rb +2 -2
  80. metadata +10 -2
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="digital_signature.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -31,21 +31,42 @@ module GroupDocsSignatureCloud
31
31
  # Contains digital Signature properties
32
32
  class DigitalSignature
33
33
 
34
- # Specifies the type of document to process (Image, Pdf, Presentation, Spreadsheet, WordProcessing)
35
- attr_accessor :document_type
36
-
37
34
  # Specifies the signature type (Text, Image, Digital, Barcode, QRCode, Stamp)
38
35
  attr_accessor :signature_type
39
36
 
37
+ # Specifies the page signature was found on
38
+ attr_accessor :page_number
39
+
40
+ # Unique signature identifier to modify signature in the document over Update or Delete methods. This property will be set automatically after Sign or Search method being called. If this property was saved before it can be set manually to manipulate the signature.
41
+ attr_accessor :signature_id
42
+
43
+ # Get or set flag to indicate if this component is Signature or document content. This property is being used with Update method to set element as signature (true) or document element (false).
44
+ attr_accessor :is_signature
45
+
46
+ # Get or set the signature creation date
47
+ attr_accessor :created_on
48
+
49
+ # Get or set the signature modification date
50
+ attr_accessor :modified_on
51
+
52
+ # Specifies top position of signature
53
+ attr_accessor :top
54
+
55
+ # Specifies left position of signature
56
+ attr_accessor :left
57
+
58
+ # Specifies width of signature
59
+ attr_accessor :width
60
+
61
+ # Specifies height of signature
62
+ attr_accessor :height
63
+
40
64
  # Gets or sets the signing purpose comment
41
65
  attr_accessor :comments
42
66
 
43
67
  # Keeps true if this digital signature is valid and the document has not been tampered with
44
68
  attr_accessor :is_valid
45
69
 
46
- # Gets or sets the type of the digital signature
47
- attr_accessor :type
48
-
49
70
  # Gets or sets the time the document was signed
50
71
  attr_accessor :sign_time
51
72
  class EnumAttributeValidator
@@ -73,11 +94,18 @@ module GroupDocsSignatureCloud
73
94
  # Attribute mapping from ruby-style variable name to JSON key.
74
95
  def self.attribute_map
75
96
  {
76
- :'document_type' => :'DocumentType',
77
97
  :'signature_type' => :'SignatureType',
98
+ :'page_number' => :'PageNumber',
99
+ :'signature_id' => :'SignatureId',
100
+ :'is_signature' => :'IsSignature',
101
+ :'created_on' => :'CreatedOn',
102
+ :'modified_on' => :'ModifiedOn',
103
+ :'top' => :'Top',
104
+ :'left' => :'Left',
105
+ :'width' => :'Width',
106
+ :'height' => :'Height',
78
107
  :'comments' => :'Comments',
79
108
  :'is_valid' => :'IsValid',
80
- :'type' => :'Type',
81
109
  :'sign_time' => :'SignTime'
82
110
  }
83
111
  end
@@ -85,11 +113,18 @@ module GroupDocsSignatureCloud
85
113
  # Attribute type mapping.
86
114
  def self.swagger_types
87
115
  {
88
- :'document_type' => :'String',
89
116
  :'signature_type' => :'String',
117
+ :'page_number' => :'Integer',
118
+ :'signature_id' => :'String',
119
+ :'is_signature' => :'BOOLEAN',
120
+ :'created_on' => :'DateTime',
121
+ :'modified_on' => :'DateTime',
122
+ :'top' => :'Integer',
123
+ :'left' => :'Integer',
124
+ :'width' => :'Integer',
125
+ :'height' => :'Integer',
90
126
  :'comments' => :'String',
91
127
  :'is_valid' => :'BOOLEAN',
92
- :'type' => :'String',
93
128
  :'sign_time' => :'DateTime'
94
129
  }
95
130
  end
@@ -102,14 +137,46 @@ module GroupDocsSignatureCloud
102
137
  # convert string to symbol for hash key
103
138
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
104
139
 
105
- if attributes.key?(:'DocumentType')
106
- self.document_type = attributes[:'DocumentType']
107
- end
108
-
109
140
  if attributes.key?(:'SignatureType')
110
141
  self.signature_type = attributes[:'SignatureType']
111
142
  end
112
143
 
144
+ if attributes.key?(:'PageNumber')
145
+ self.page_number = attributes[:'PageNumber']
146
+ end
147
+
148
+ if attributes.key?(:'SignatureId')
149
+ self.signature_id = attributes[:'SignatureId']
150
+ end
151
+
152
+ if attributes.key?(:'IsSignature')
153
+ self.is_signature = attributes[:'IsSignature']
154
+ end
155
+
156
+ if attributes.key?(:'CreatedOn')
157
+ self.created_on = attributes[:'CreatedOn']
158
+ end
159
+
160
+ if attributes.key?(:'ModifiedOn')
161
+ self.modified_on = attributes[:'ModifiedOn']
162
+ end
163
+
164
+ if attributes.key?(:'Top')
165
+ self.top = attributes[:'Top']
166
+ end
167
+
168
+ if attributes.key?(:'Left')
169
+ self.left = attributes[:'Left']
170
+ end
171
+
172
+ if attributes.key?(:'Width')
173
+ self.width = attributes[:'Width']
174
+ end
175
+
176
+ if attributes.key?(:'Height')
177
+ self.height = attributes[:'Height']
178
+ end
179
+
113
180
  if attributes.key?(:'Comments')
114
181
  self.comments = attributes[:'Comments']
115
182
  end
@@ -118,10 +185,6 @@ module GroupDocsSignatureCloud
118
185
  self.is_valid = attributes[:'IsValid']
119
186
  end
120
187
 
121
- if attributes.key?(:'Type')
122
- self.type = attributes[:'Type']
123
- end
124
-
125
188
  if attributes.key?(:'SignTime')
126
189
  self.sign_time = attributes[:'SignTime']
127
190
  end
@@ -132,20 +195,40 @@ module GroupDocsSignatureCloud
132
195
  # @return Array for valid properies with the reasons
133
196
  def list_invalid_properties
134
197
  invalid_properties = []
135
- if @document_type.nil?
136
- invalid_properties.push("invalid value for 'document_type', document_type cannot be nil.")
137
- end
138
-
139
198
  if @signature_type.nil?
140
199
  invalid_properties.push("invalid value for 'signature_type', signature_type cannot be nil.")
141
200
  end
142
201
 
143
- if @is_valid.nil?
144
- invalid_properties.push("invalid value for 'is_valid', is_valid cannot be nil.")
202
+ if @is_signature.nil?
203
+ invalid_properties.push("invalid value for 'is_signature', is_signature cannot be nil.")
204
+ end
205
+
206
+ if @created_on.nil?
207
+ invalid_properties.push("invalid value for 'created_on', created_on cannot be nil.")
208
+ end
209
+
210
+ if @modified_on.nil?
211
+ invalid_properties.push("invalid value for 'modified_on', modified_on cannot be nil.")
212
+ end
213
+
214
+ if @top.nil?
215
+ invalid_properties.push("invalid value for 'top', top cannot be nil.")
216
+ end
217
+
218
+ if @left.nil?
219
+ invalid_properties.push("invalid value for 'left', left cannot be nil.")
220
+ end
221
+
222
+ if @width.nil?
223
+ invalid_properties.push("invalid value for 'width', width cannot be nil.")
145
224
  end
146
225
 
147
- if @type.nil?
148
- invalid_properties.push("invalid value for 'type', type cannot be nil.")
226
+ if @height.nil?
227
+ invalid_properties.push("invalid value for 'height', height cannot be nil.")
228
+ end
229
+
230
+ if @is_valid.nil?
231
+ invalid_properties.push("invalid value for 'is_valid', is_valid cannot be nil.")
149
232
  end
150
233
 
151
234
  if @sign_time.nil?
@@ -158,34 +241,21 @@ module GroupDocsSignatureCloud
158
241
  # Check to see if the all the properties in the model are valid
159
242
  # @return true if the model is valid
160
243
  def valid?
161
- return false if @document_type.nil?
162
- document_type_validator = EnumAttributeValidator.new('String', ["Image", "Pdf", "Presentation", "Spreadsheet", "WordProcessing"])
163
- return false unless document_type_validator.valid?(@document_type)
164
244
  return false if @signature_type.nil?
165
245
  signature_type_validator = EnumAttributeValidator.new('String', ["None", "Text", "Image", "Digital", "Barcode", "QRCode", "Stamp"])
166
246
  return false unless signature_type_validator.valid?(@signature_type)
247
+ return false if @is_signature.nil?
248
+ return false if @created_on.nil?
249
+ return false if @modified_on.nil?
250
+ return false if @top.nil?
251
+ return false if @left.nil?
252
+ return false if @width.nil?
253
+ return false if @height.nil?
167
254
  return false if @is_valid.nil?
168
- return false if @type.nil?
169
- type_validator = EnumAttributeValidator.new('String', ["Unknown", "CryptoApi", "XmlDsig"])
170
- return false unless type_validator.valid?(@type)
171
255
  return false if @sign_time.nil?
172
256
  return true
173
257
  end
174
258
 
175
- # Custom attribute writer method checking allowed values (enum).
176
- # @param [Object] document_type Object to be assigned
177
- def document_type=(document_type)
178
- validator = EnumAttributeValidator.new('String', ["Image", "Pdf", "Presentation", "Spreadsheet", "WordProcessing"])
179
- if document_type.to_i == 0
180
- unless validator.valid?(document_type)
181
- raise ArgumentError, "invalid value for 'document_type', must be one of #{validator.allowable_values}."
182
- end
183
- @document_type = document_type
184
- else
185
- @document_type = validator.allowable_values[document_type.to_i]
186
- end
187
- end
188
-
189
259
  # Custom attribute writer method checking allowed values (enum).
190
260
  # @param [Object] signature_type Object to be assigned
191
261
  def signature_type=(signature_type)
@@ -200,30 +270,23 @@ module GroupDocsSignatureCloud
200
270
  end
201
271
  end
202
272
 
203
- # Custom attribute writer method checking allowed values (enum).
204
- # @param [Object] type Object to be assigned
205
- def type=(type)
206
- validator = EnumAttributeValidator.new('String', ["Unknown", "CryptoApi", "XmlDsig"])
207
- if type.to_i == 0
208
- unless validator.valid?(type)
209
- raise ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
210
- end
211
- @type = type
212
- else
213
- @type = validator.allowable_values[type.to_i]
214
- end
215
- end
216
-
217
273
  # Checks equality by comparing each attribute.
218
274
  # @param [Object] Object to be compared
219
275
  def ==(other)
220
276
  return true if self.equal?(other)
221
277
  self.class == other.class &&
222
- document_type == other.document_type &&
223
278
  signature_type == other.signature_type &&
279
+ page_number == other.page_number &&
280
+ signature_id == other.signature_id &&
281
+ is_signature == other.is_signature &&
282
+ created_on == other.created_on &&
283
+ modified_on == other.modified_on &&
284
+ top == other.top &&
285
+ left == other.left &&
286
+ width == other.width &&
287
+ height == other.height &&
224
288
  comments == other.comments &&
225
289
  is_valid == other.is_valid &&
226
- type == other.type &&
227
290
  sign_time == other.sign_time
228
291
  end
229
292
 
@@ -236,7 +299,7 @@ module GroupDocsSignatureCloud
236
299
  # Calculates hash code according to all attributes.
237
300
  # @return [Fixnum] Hash code
238
301
  def hash
239
- [document_type, signature_type, comments, is_valid, type, sign_time].hash
302
+ [signature_type, page_number, signature_id, is_signature, created_on, modified_on, top, left, width, height, comments, is_valid, sign_time].hash
240
303
  end
241
304
 
242
305
  # Downcases first letter.
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="disc_usage.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="error.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="error_details.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="file_info.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="file_version.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="file_versions.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="files_list.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="files_upload_result.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="format.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="formats_result.rb">
4
- # Copyright (c) 2003-2019 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -0,0 +1,411 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="image_signature.rb">
4
+ # Copyright (c) 2003-2020 Aspose Pty Ltd
5
+ # </copyright>
6
+ # <summary>
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ # </summary>
25
+ # --------------------------------------------------------------------------------------------------------------------
26
+ #
27
+
28
+ require 'date'
29
+
30
+ module GroupDocsSignatureCloud
31
+ # Contains Image signature properties
32
+ class ImageSignature
33
+
34
+ # Specifies the signature type (Text, Image, Digital, Barcode, QRCode, Stamp)
35
+ attr_accessor :signature_type
36
+
37
+ # Specifies the page signature was found on
38
+ attr_accessor :page_number
39
+
40
+ # Unique signature identifier to modify signature in the document over Update or Delete methods. This property will be set automatically after Sign or Search method being called. If this property was saved before it can be set manually to manipulate the signature.
41
+ attr_accessor :signature_id
42
+
43
+ # Get or set flag to indicate if this component is Signature or document content. This property is being used with Update method to set element as signature (true) or document element (false).
44
+ attr_accessor :is_signature
45
+
46
+ # Get or set the signature creation date
47
+ attr_accessor :created_on
48
+
49
+ # Get or set the signature modification date
50
+ attr_accessor :modified_on
51
+
52
+ # Specifies top position of signature
53
+ attr_accessor :top
54
+
55
+ # Specifies left position of signature
56
+ attr_accessor :left
57
+
58
+ # Specifies width of signature
59
+ attr_accessor :width
60
+
61
+ # Specifies height of signature
62
+ attr_accessor :height
63
+
64
+ # Specifies the image size
65
+ attr_accessor :size
66
+
67
+ # Specifies the format of image
68
+ attr_accessor :format
69
+ class EnumAttributeValidator
70
+ attr_reader :datatype
71
+ attr_reader :allowable_values
72
+
73
+ def initialize(datatype, allowable_values)
74
+ @allowable_values = allowable_values.map do |value|
75
+ case datatype.to_s
76
+ when /Integer/i
77
+ value.to_i
78
+ when /Float/i
79
+ value.to_f
80
+ else
81
+ value
82
+ end
83
+ end
84
+ end
85
+
86
+ def valid?(value)
87
+ !value || allowable_values.include?(value)
88
+ end
89
+ end
90
+
91
+ # Attribute mapping from ruby-style variable name to JSON key.
92
+ def self.attribute_map
93
+ {
94
+ :'signature_type' => :'SignatureType',
95
+ :'page_number' => :'PageNumber',
96
+ :'signature_id' => :'SignatureId',
97
+ :'is_signature' => :'IsSignature',
98
+ :'created_on' => :'CreatedOn',
99
+ :'modified_on' => :'ModifiedOn',
100
+ :'top' => :'Top',
101
+ :'left' => :'Left',
102
+ :'width' => :'Width',
103
+ :'height' => :'Height',
104
+ :'size' => :'Size',
105
+ :'format' => :'Format'
106
+ }
107
+ end
108
+
109
+ # Attribute type mapping.
110
+ def self.swagger_types
111
+ {
112
+ :'signature_type' => :'String',
113
+ :'page_number' => :'Integer',
114
+ :'signature_id' => :'String',
115
+ :'is_signature' => :'BOOLEAN',
116
+ :'created_on' => :'DateTime',
117
+ :'modified_on' => :'DateTime',
118
+ :'top' => :'Integer',
119
+ :'left' => :'Integer',
120
+ :'width' => :'Integer',
121
+ :'height' => :'Integer',
122
+ :'size' => :'Integer',
123
+ :'format' => :'String'
124
+ }
125
+ end
126
+
127
+ # Initializes the object
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ def initialize(attributes = {})
130
+ return unless attributes.is_a?(Hash)
131
+
132
+ # convert string to symbol for hash key
133
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
134
+
135
+ if attributes.key?(:'SignatureType')
136
+ self.signature_type = attributes[:'SignatureType']
137
+ end
138
+
139
+ if attributes.key?(:'PageNumber')
140
+ self.page_number = attributes[:'PageNumber']
141
+ end
142
+
143
+ if attributes.key?(:'SignatureId')
144
+ self.signature_id = attributes[:'SignatureId']
145
+ end
146
+
147
+ if attributes.key?(:'IsSignature')
148
+ self.is_signature = attributes[:'IsSignature']
149
+ end
150
+
151
+ if attributes.key?(:'CreatedOn')
152
+ self.created_on = attributes[:'CreatedOn']
153
+ end
154
+
155
+ if attributes.key?(:'ModifiedOn')
156
+ self.modified_on = attributes[:'ModifiedOn']
157
+ end
158
+
159
+ if attributes.key?(:'Top')
160
+ self.top = attributes[:'Top']
161
+ end
162
+
163
+ if attributes.key?(:'Left')
164
+ self.left = attributes[:'Left']
165
+ end
166
+
167
+ if attributes.key?(:'Width')
168
+ self.width = attributes[:'Width']
169
+ end
170
+
171
+ if attributes.key?(:'Height')
172
+ self.height = attributes[:'Height']
173
+ end
174
+
175
+ if attributes.key?(:'Size')
176
+ self.size = attributes[:'Size']
177
+ end
178
+
179
+ if attributes.key?(:'Format')
180
+ self.format = attributes[:'Format']
181
+ end
182
+
183
+ end
184
+
185
+ # Show invalid properties with the reasons. Usually used together with valid?
186
+ # @return Array for valid properies with the reasons
187
+ def list_invalid_properties
188
+ invalid_properties = []
189
+ if @signature_type.nil?
190
+ invalid_properties.push("invalid value for 'signature_type', signature_type cannot be nil.")
191
+ end
192
+
193
+ if @is_signature.nil?
194
+ invalid_properties.push("invalid value for 'is_signature', is_signature cannot be nil.")
195
+ end
196
+
197
+ if @created_on.nil?
198
+ invalid_properties.push("invalid value for 'created_on', created_on cannot be nil.")
199
+ end
200
+
201
+ if @modified_on.nil?
202
+ invalid_properties.push("invalid value for 'modified_on', modified_on cannot be nil.")
203
+ end
204
+
205
+ if @top.nil?
206
+ invalid_properties.push("invalid value for 'top', top cannot be nil.")
207
+ end
208
+
209
+ if @left.nil?
210
+ invalid_properties.push("invalid value for 'left', left cannot be nil.")
211
+ end
212
+
213
+ if @width.nil?
214
+ invalid_properties.push("invalid value for 'width', width cannot be nil.")
215
+ end
216
+
217
+ if @height.nil?
218
+ invalid_properties.push("invalid value for 'height', height cannot be nil.")
219
+ end
220
+
221
+ if @size.nil?
222
+ invalid_properties.push("invalid value for 'size', size cannot be nil.")
223
+ end
224
+
225
+ return invalid_properties
226
+ end
227
+
228
+ # Check to see if the all the properties in the model are valid
229
+ # @return true if the model is valid
230
+ def valid?
231
+ return false if @signature_type.nil?
232
+ signature_type_validator = EnumAttributeValidator.new('String', ["None", "Text", "Image", "Digital", "Barcode", "QRCode", "Stamp"])
233
+ return false unless signature_type_validator.valid?(@signature_type)
234
+ return false if @is_signature.nil?
235
+ return false if @created_on.nil?
236
+ return false if @modified_on.nil?
237
+ return false if @top.nil?
238
+ return false if @left.nil?
239
+ return false if @width.nil?
240
+ return false if @height.nil?
241
+ return false if @size.nil?
242
+ return true
243
+ end
244
+
245
+ # Custom attribute writer method checking allowed values (enum).
246
+ # @param [Object] signature_type Object to be assigned
247
+ def signature_type=(signature_type)
248
+ validator = EnumAttributeValidator.new('String', ["None", "Text", "Image", "Digital", "Barcode", "QRCode", "Stamp"])
249
+ if signature_type.to_i == 0
250
+ unless validator.valid?(signature_type)
251
+ raise ArgumentError, "invalid value for 'signature_type', must be one of #{validator.allowable_values}."
252
+ end
253
+ @signature_type = signature_type
254
+ else
255
+ @signature_type = validator.allowable_values[signature_type.to_i]
256
+ end
257
+ end
258
+
259
+ # Checks equality by comparing each attribute.
260
+ # @param [Object] Object to be compared
261
+ def ==(other)
262
+ return true if self.equal?(other)
263
+ self.class == other.class &&
264
+ signature_type == other.signature_type &&
265
+ page_number == other.page_number &&
266
+ signature_id == other.signature_id &&
267
+ is_signature == other.is_signature &&
268
+ created_on == other.created_on &&
269
+ modified_on == other.modified_on &&
270
+ top == other.top &&
271
+ left == other.left &&
272
+ width == other.width &&
273
+ height == other.height &&
274
+ size == other.size &&
275
+ format == other.format
276
+ end
277
+
278
+ # @see the `==` method
279
+ # @param [Object] Object to be compared
280
+ def eql?(other)
281
+ self == other
282
+ end
283
+
284
+ # Calculates hash code according to all attributes.
285
+ # @return [Fixnum] Hash code
286
+ def hash
287
+ [signature_type, page_number, signature_id, is_signature, created_on, modified_on, top, left, width, height, size, format].hash
288
+ end
289
+
290
+ # Downcases first letter.
291
+ # @return downcased string
292
+ def uncap(str)
293
+ str[0, 1].downcase + str[1..-1]
294
+ end
295
+
296
+ # Builds the object from hash
297
+ # @param [Hash] attributes Model attributes in the form of hash
298
+ # @return [Object] Returns the model itself
299
+ def build_from_hash(attributes)
300
+ return nil unless attributes.is_a?(Hash)
301
+ self.class.swagger_types.each_pair do |key, type|
302
+ pname = uncap(self.class.attribute_map[key]).intern
303
+ value = attributes[pname]
304
+ if type =~ /\AArray<(.*)>/i
305
+ # check to ensure the input is an array given that the the attribute
306
+ # is documented as an array but the input is not
307
+ if value.is_a?(Array)
308
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
309
+ end
310
+ elsif !value.nil?
311
+ self.send("#{key}=", _deserialize(type, value))
312
+ end
313
+ # or else data not found in attributes(hash), not an issue as the data can be optional
314
+ end
315
+
316
+ self
317
+ end
318
+
319
+ # Deserializes the data based on type
320
+ # @param string type Data type
321
+ # @param string value Value to be deserialized
322
+ # @return [Object] Deserialized data
323
+ def _deserialize(type, value)
324
+ case type.to_sym
325
+ when :DateTime
326
+ Date.parse value
327
+ when :Date
328
+ Date.parse value
329
+ when :String
330
+ value.to_s
331
+ when :Integer
332
+ value.to_i
333
+ when :Float
334
+ value.to_f
335
+ when :BOOLEAN
336
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
337
+ true
338
+ else
339
+ false
340
+ end
341
+ when :Object
342
+ # generic object (usually a Hash), return directly
343
+ value
344
+ when /\AArray<(?<inner_type>.+)>\z/
345
+ inner_type = Regexp.last_match[:inner_type]
346
+ value.map { |v| _deserialize(inner_type, v) }
347
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
348
+ k_type = Regexp.last_match[:k_type]
349
+ v_type = Regexp.last_match[:v_type]
350
+ {}.tap do |hash|
351
+ value.each do |k, v|
352
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
353
+ end
354
+ end
355
+ else
356
+ # model
357
+ # Signature type fix
358
+ ttype = type
359
+ if value.is_a?(Hash) and !value[:signatureType].nil?
360
+ ttype = value[:signatureType] + 'Signature'
361
+ end
362
+ temp_model = GroupDocsSignatureCloud.const_get(ttype).new
363
+ temp_model.build_from_hash(value)
364
+ end
365
+ end
366
+
367
+ # Returns the string representation of the object
368
+ # @return [String] String presentation of the object
369
+ def to_s
370
+ to_hash.to_s
371
+ end
372
+
373
+ # to_body is an alias to to_hash (backward compatibility)
374
+ # @return [Hash] Returns the object in the form of hash
375
+ def to_body
376
+ to_hash
377
+ end
378
+
379
+ # Returns the object in the form of hash
380
+ # @return [Hash] Returns the object in the form of hash
381
+ def to_hash
382
+ hash = {}
383
+ self.class.attribute_map.each_pair do |attr, param|
384
+ value = self.send(attr)
385
+ next if value.nil?
386
+ hash[param] = _to_hash(value)
387
+ end
388
+ hash
389
+ end
390
+
391
+ # Outputs non-array value in the form of hash
392
+ # For object, use to_hash. Otherwise, just return the value
393
+ # @param [Object] value Any valid value
394
+ # @return [Hash] Returns the value in the form of hash
395
+ def _to_hash(value)
396
+ if value.is_a?(Array)
397
+ value.compact.map { |v| _to_hash(v) }
398
+ elsif value.is_a?(Hash)
399
+ {}.tap do |hash|
400
+ value.each { |k, v| hash[k] = _to_hash(v) }
401
+ end
402
+ elsif value.respond_to? :to_hash
403
+ value.to_hash
404
+ else
405
+ value
406
+ end
407
+ end
408
+
409
+ end
410
+
411
+ end