groupdocs_signature_cloud 20.7 → 22.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/groupdocs_signature_cloud/api/file_api.rb +6 -6
- data/lib/groupdocs_signature_cloud/api/folder_api.rb +6 -6
- data/lib/groupdocs_signature_cloud/api/info_api.rb +2 -2
- data/lib/groupdocs_signature_cloud/api/license_api.rb +169 -0
- data/lib/groupdocs_signature_cloud/api/preview_api.rb +217 -0
- data/lib/groupdocs_signature_cloud/api/sign_api.rb +6 -6
- data/lib/groupdocs_signature_cloud/api/storage_api.rb +5 -5
- data/lib/groupdocs_signature_cloud/api_client.rb +1 -1
- data/lib/groupdocs_signature_cloud/api_error.rb +18 -5
- data/lib/groupdocs_signature_cloud/configuration.rb +1 -1
- data/lib/groupdocs_signature_cloud/models/barcode_signature.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/barcode_type.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/barcodes_result.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/base_settings.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/border_line.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/brush.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/checkbox_form_field_signature.rb +460 -0
- data/lib/groupdocs_signature_cloud/models/color.rb +38 -5
- data/lib/groupdocs_signature_cloud/models/combobox_form_field_signature.rb +467 -0
- data/lib/groupdocs_signature_cloud/models/consumption_result.rb +257 -0
- data/lib/groupdocs_signature_cloud/models/delete_options.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/delete_result.rb +20 -2
- data/lib/groupdocs_signature_cloud/models/delete_settings.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/digital_form_field_signature.rb +460 -0
- data/lib/groupdocs_signature_cloud/models/digital_signature.rb +35 -7
- data/lib/groupdocs_signature_cloud/models/digital_signature_appearance.rb +309 -0
- data/lib/groupdocs_signature_cloud/models/disc_usage.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/error.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/error_details.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/file_info.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/file_version.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/file_versions.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/files_list.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/files_upload_result.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/form_field_signature.rb +445 -0
- data/lib/groupdocs_signature_cloud/models/format.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/formats_result.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/image_appearance.rb +339 -0
- data/lib/groupdocs_signature_cloud/models/image_signature.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/info_result.rb +36 -6
- data/lib/groupdocs_signature_cloud/models/info_settings.rb +38 -5
- data/lib/groupdocs_signature_cloud/models/linear_gradient_brush.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/object_exist.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/options_base.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/padding.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/page_info.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/pages_setup.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/pdf_digital_signature.rb +339 -0
- data/lib/groupdocs_signature_cloud/models/pdf_digital_signature_appearance.rb +359 -0
- data/lib/groupdocs_signature_cloud/models/pdf_text_annotation_appearance.rb +395 -0
- data/lib/groupdocs_signature_cloud/models/pdf_text_sticker_appearance.rb +355 -0
- data/lib/groupdocs_signature_cloud/models/preview_page.rb +277 -0
- data/lib/groupdocs_signature_cloud/models/preview_result.rb +279 -0
- data/lib/groupdocs_signature_cloud/models/preview_settings.rb +356 -0
- data/lib/groupdocs_signature_cloud/models/qr_code_signature.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/qr_code_type.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/qr_codes_result.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/radial_gradient_brush.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/radio_button_form_field_signature.rb +467 -0
- data/lib/groupdocs_signature_cloud/models/save_options.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/search_barcode_options.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/search_digital_options.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/search_options.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/search_qr_code_options.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/search_result.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/search_settings.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/sign_barcode_options.rb +47 -4
- data/lib/groupdocs_signature_cloud/models/sign_digital_options.rb +32 -4
- data/lib/groupdocs_signature_cloud/models/sign_image_options.rb +32 -4
- data/lib/groupdocs_signature_cloud/models/sign_options.rb +35 -7
- data/lib/groupdocs_signature_cloud/models/sign_qr_code_options.rb +47 -4
- data/lib/groupdocs_signature_cloud/models/sign_result.rb +20 -2
- data/lib/groupdocs_signature_cloud/models/sign_settings.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/sign_stamp_options.rb +32 -4
- data/lib/groupdocs_signature_cloud/models/sign_text_options.rb +50 -7
- data/lib/groupdocs_signature_cloud/models/signature.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/signature_appearance.rb +279 -0
- data/lib/groupdocs_signature_cloud/models/signature_font.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/solid_brush.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/stamp_line.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/storage_exist.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/storage_file.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/text_form_field_signature.rb +455 -0
- data/lib/groupdocs_signature_cloud/models/text_signature.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/texture_brush.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/time_stamp.rb +257 -0
- data/lib/groupdocs_signature_cloud/models/update_options.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/update_result.rb +20 -2
- data/lib/groupdocs_signature_cloud/models/update_settings.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/verify_barcode_options.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/verify_digital_options.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/verify_options.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/verify_qr_code_options.rb +21 -3
- data/lib/groupdocs_signature_cloud/models/verify_result.rb +20 -2
- data/lib/groupdocs_signature_cloud/models/verify_settings.rb +19 -1
- data/lib/groupdocs_signature_cloud/models/verify_text_options.rb +21 -3
- data/lib/groupdocs_signature_cloud/version.rb +2 -2
- data/lib/groupdocs_signature_cloud.rb +21 -1
- metadata +26 -20
@@ -0,0 +1,279 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="preview_result.rb">
|
4
|
+
# Copyright (c) 2003-2022 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
|
+
# Document preview result
|
32
|
+
class PreviewResult
|
33
|
+
|
34
|
+
# Input File info
|
35
|
+
attr_accessor :file_info
|
36
|
+
|
37
|
+
# Input File size
|
38
|
+
attr_accessor :size
|
39
|
+
|
40
|
+
# Count of pages
|
41
|
+
attr_accessor :pages_count
|
42
|
+
|
43
|
+
# Document preview pages
|
44
|
+
attr_accessor :pages
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:'file_info' => :'FileInfo',
|
50
|
+
:'size' => :'Size',
|
51
|
+
:'pages_count' => :'PagesCount',
|
52
|
+
:'pages' => :'Pages'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.swagger_types
|
58
|
+
{
|
59
|
+
:'file_info' => :'FileInfo',
|
60
|
+
:'size' => :'Integer',
|
61
|
+
:'pages_count' => :'Integer',
|
62
|
+
:'pages' => :'Array<PreviewPage>'
|
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.key?(:'FileInfo')
|
75
|
+
self.file_info = attributes[:'FileInfo']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'Size')
|
79
|
+
self.size = attributes[:'Size']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'PagesCount')
|
83
|
+
self.pages_count = attributes[:'PagesCount']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'Pages')
|
87
|
+
if (value = attributes[:'Pages']).is_a?(Array)
|
88
|
+
self.pages = value
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
95
|
+
# @return Array for valid properies with the reasons
|
96
|
+
def list_invalid_properties
|
97
|
+
invalid_properties = []
|
98
|
+
if @size.nil?
|
99
|
+
invalid_properties.push("invalid value for 'size', size cannot be nil.")
|
100
|
+
end
|
101
|
+
|
102
|
+
if @pages_count.nil?
|
103
|
+
invalid_properties.push("invalid value for 'pages_count', pages_count cannot be nil.")
|
104
|
+
end
|
105
|
+
|
106
|
+
return invalid_properties
|
107
|
+
end
|
108
|
+
|
109
|
+
# Check to see if the all the properties in the model are valid
|
110
|
+
# @return true if the model is valid
|
111
|
+
def valid?
|
112
|
+
return false if @size.nil?
|
113
|
+
return false if @pages_count.nil?
|
114
|
+
return true
|
115
|
+
end
|
116
|
+
|
117
|
+
# Checks equality by comparing each attribute.
|
118
|
+
# @param [Object] Object to be compared
|
119
|
+
def ==(other)
|
120
|
+
return true if self.equal?(other)
|
121
|
+
self.class == other.class &&
|
122
|
+
file_info == other.file_info &&
|
123
|
+
size == other.size &&
|
124
|
+
pages_count == other.pages_count &&
|
125
|
+
pages == other.pages
|
126
|
+
end
|
127
|
+
|
128
|
+
# @see the `==` method
|
129
|
+
# @param [Object] Object to be compared
|
130
|
+
def eql?(other)
|
131
|
+
self == other
|
132
|
+
end
|
133
|
+
|
134
|
+
# Calculates hash code according to all attributes.
|
135
|
+
# @return [Fixnum] Hash code
|
136
|
+
def hash
|
137
|
+
[file_info, size, pages_count, pages].hash
|
138
|
+
end
|
139
|
+
|
140
|
+
# Downcases first letter.
|
141
|
+
# @return downcased string
|
142
|
+
def uncap(str)
|
143
|
+
str[0, 1].downcase + str[1..-1]
|
144
|
+
end
|
145
|
+
|
146
|
+
# Builds the object from hash
|
147
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
148
|
+
# @return [Object] Returns the model itself
|
149
|
+
def build_from_hash(attributes)
|
150
|
+
return nil unless attributes.is_a?(Hash)
|
151
|
+
self.class.swagger_types.each_pair do |key, type|
|
152
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
153
|
+
value = attributes[pname]
|
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 value.is_a?(Array)
|
158
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
159
|
+
end
|
160
|
+
elsif !value.nil?
|
161
|
+
self.send("#{key}=", _deserialize(type, value))
|
162
|
+
end
|
163
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
164
|
+
end
|
165
|
+
|
166
|
+
self
|
167
|
+
end
|
168
|
+
|
169
|
+
# Deserializes the data based on type
|
170
|
+
# @param string type Data type
|
171
|
+
# @param string value Value to be deserialized
|
172
|
+
# @return [Object] Deserialized data
|
173
|
+
def _deserialize(type, value)
|
174
|
+
case type.to_sym
|
175
|
+
when :DateTime
|
176
|
+
Date.parse value
|
177
|
+
when :Date
|
178
|
+
Date.parse value
|
179
|
+
when :String
|
180
|
+
value.to_s
|
181
|
+
when :Integer
|
182
|
+
value.to_i
|
183
|
+
when :Float
|
184
|
+
value.to_f
|
185
|
+
when :BOOLEAN
|
186
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
187
|
+
true
|
188
|
+
else
|
189
|
+
false
|
190
|
+
end
|
191
|
+
when :Object
|
192
|
+
# generic object (usually a Hash), return directly
|
193
|
+
value
|
194
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
195
|
+
inner_type = Regexp.last_match[:inner_type]
|
196
|
+
value.map { |v| _deserialize(inner_type, v) }
|
197
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
198
|
+
k_type = Regexp.last_match[:k_type]
|
199
|
+
v_type = Regexp.last_match[:v_type]
|
200
|
+
{}.tap do |hash|
|
201
|
+
value.each do |k, v|
|
202
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
else
|
206
|
+
# model
|
207
|
+
# Signature type fix
|
208
|
+
ttype = type
|
209
|
+
if value.is_a?(Hash) and !value[:signatureType].nil?
|
210
|
+
ttype = value[:signatureType] + 'Signature'
|
211
|
+
if value[:signatureType] == 'FormField' and !value[:type].nil?
|
212
|
+
type = value[:type]
|
213
|
+
if type == 'Checkbox'
|
214
|
+
ttype = 'CheckboxFormFieldSignature'
|
215
|
+
end
|
216
|
+
if type == 'Text'
|
217
|
+
ttype = 'TextFormFieldSignature'
|
218
|
+
end
|
219
|
+
if type == 'Combobox'
|
220
|
+
ttype = 'ComboboxFormFieldSignature'
|
221
|
+
end
|
222
|
+
if type == 'DigitalSignature'
|
223
|
+
ttype = 'DigitalFormFieldSignature'
|
224
|
+
end
|
225
|
+
if type == 'Radio'
|
226
|
+
ttype = 'RadioButtonFormFieldSignature'
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
temp_model = GroupDocsSignatureCloud.const_get(ttype).new
|
231
|
+
temp_model.build_from_hash(value)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
# Returns the string representation of the object
|
236
|
+
# @return [String] String presentation of the object
|
237
|
+
def to_s
|
238
|
+
to_hash.to_s
|
239
|
+
end
|
240
|
+
|
241
|
+
# to_body is an alias to to_hash (backward compatibility)
|
242
|
+
# @return [Hash] Returns the object in the form of hash
|
243
|
+
def to_body
|
244
|
+
to_hash
|
245
|
+
end
|
246
|
+
|
247
|
+
# Returns the object in the form of hash
|
248
|
+
# @return [Hash] Returns the object in the form of hash
|
249
|
+
def to_hash
|
250
|
+
hash = {}
|
251
|
+
self.class.attribute_map.each_pair do |attr, param|
|
252
|
+
value = self.send(attr)
|
253
|
+
next if value.nil?
|
254
|
+
hash[param] = _to_hash(value)
|
255
|
+
end
|
256
|
+
hash
|
257
|
+
end
|
258
|
+
|
259
|
+
# Outputs non-array value in the form of hash
|
260
|
+
# For object, use to_hash. Otherwise, just return the value
|
261
|
+
# @param [Object] value Any valid value
|
262
|
+
# @return [Hash] Returns the value in the form of hash
|
263
|
+
def _to_hash(value)
|
264
|
+
if value.is_a?(Array)
|
265
|
+
value.compact.map { |v| _to_hash(v) }
|
266
|
+
elsif value.is_a?(Hash)
|
267
|
+
{}.tap do |hash|
|
268
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
269
|
+
end
|
270
|
+
elsif value.respond_to? :to_hash
|
271
|
+
value.to_hash
|
272
|
+
else
|
273
|
+
value
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
end
|
278
|
+
|
279
|
+
end
|
@@ -0,0 +1,356 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="preview_settings.rb">
|
4
|
+
# Copyright (c) 2003-2022 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
|
+
# Defines preview request settings
|
32
|
+
class PreviewSettings
|
33
|
+
|
34
|
+
# File info
|
35
|
+
attr_accessor :file_info
|
36
|
+
|
37
|
+
# Preview images width
|
38
|
+
attr_accessor :width
|
39
|
+
|
40
|
+
# Preview images height
|
41
|
+
attr_accessor :height
|
42
|
+
|
43
|
+
# Preview page numbers
|
44
|
+
attr_accessor :page_numbers
|
45
|
+
|
46
|
+
# Preview format
|
47
|
+
attr_accessor :preview_format
|
48
|
+
|
49
|
+
# Flag to hide signatures from page preview image. Only signatures are marked as IsSignature will be hidden from generated document page image
|
50
|
+
attr_accessor :hide_signatures
|
51
|
+
|
52
|
+
# Set path for output pages. If not set then default path used.
|
53
|
+
attr_accessor :output_path
|
54
|
+
class EnumAttributeValidator
|
55
|
+
attr_reader :datatype
|
56
|
+
attr_reader :allowable_values
|
57
|
+
|
58
|
+
def initialize(datatype, allowable_values)
|
59
|
+
@allowable_values = allowable_values.map do |value|
|
60
|
+
case datatype.to_s
|
61
|
+
when /Integer/i
|
62
|
+
value.to_i
|
63
|
+
when /Float/i
|
64
|
+
value.to_f
|
65
|
+
else
|
66
|
+
value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def valid?(value)
|
72
|
+
!value || allowable_values.include?(value)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
77
|
+
def self.attribute_map
|
78
|
+
{
|
79
|
+
:'file_info' => :'FileInfo',
|
80
|
+
:'width' => :'Width',
|
81
|
+
:'height' => :'Height',
|
82
|
+
:'page_numbers' => :'PageNumbers',
|
83
|
+
:'preview_format' => :'PreviewFormat',
|
84
|
+
:'hide_signatures' => :'HideSignatures',
|
85
|
+
:'output_path' => :'OutputPath'
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
# Attribute type mapping.
|
90
|
+
def self.swagger_types
|
91
|
+
{
|
92
|
+
:'file_info' => :'FileInfo',
|
93
|
+
:'width' => :'Integer',
|
94
|
+
:'height' => :'Integer',
|
95
|
+
:'page_numbers' => :'Array<Integer>',
|
96
|
+
:'preview_format' => :'String',
|
97
|
+
:'hide_signatures' => :'BOOLEAN',
|
98
|
+
:'output_path' => :'String'
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
# Initializes the object
|
103
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
104
|
+
def initialize(attributes = {})
|
105
|
+
return unless attributes.is_a?(Hash)
|
106
|
+
|
107
|
+
# convert string to symbol for hash key
|
108
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
109
|
+
|
110
|
+
if attributes.key?(:'FileInfo')
|
111
|
+
self.file_info = attributes[:'FileInfo']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'Width')
|
115
|
+
self.width = attributes[:'Width']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'Height')
|
119
|
+
self.height = attributes[:'Height']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.key?(:'PageNumbers')
|
123
|
+
if (value = attributes[:'PageNumbers']).is_a?(Array)
|
124
|
+
self.page_numbers = value
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'PreviewFormat')
|
129
|
+
self.preview_format = attributes[:'PreviewFormat']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'HideSignatures')
|
133
|
+
self.hide_signatures = attributes[:'HideSignatures']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'OutputPath')
|
137
|
+
self.output_path = attributes[:'OutputPath']
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
143
|
+
# @return Array for valid properies with the reasons
|
144
|
+
def list_invalid_properties
|
145
|
+
invalid_properties = []
|
146
|
+
if @width.nil?
|
147
|
+
invalid_properties.push("invalid value for 'width', width cannot be nil.")
|
148
|
+
end
|
149
|
+
|
150
|
+
if @height.nil?
|
151
|
+
invalid_properties.push("invalid value for 'height', height cannot be nil.")
|
152
|
+
end
|
153
|
+
|
154
|
+
if @preview_format.nil?
|
155
|
+
invalid_properties.push("invalid value for 'preview_format', preview_format cannot be nil.")
|
156
|
+
end
|
157
|
+
|
158
|
+
if @hide_signatures.nil?
|
159
|
+
invalid_properties.push("invalid value for 'hide_signatures', hide_signatures cannot be nil.")
|
160
|
+
end
|
161
|
+
|
162
|
+
return invalid_properties
|
163
|
+
end
|
164
|
+
|
165
|
+
# Check to see if the all the properties in the model are valid
|
166
|
+
# @return true if the model is valid
|
167
|
+
def valid?
|
168
|
+
return false if @width.nil?
|
169
|
+
return false if @height.nil?
|
170
|
+
return false if @preview_format.nil?
|
171
|
+
preview_format_validator = EnumAttributeValidator.new('String', ["PNG", "JPEG", "BMP"])
|
172
|
+
return false unless preview_format_validator.valid?(@preview_format)
|
173
|
+
return false if @hide_signatures.nil?
|
174
|
+
return true
|
175
|
+
end
|
176
|
+
|
177
|
+
# Custom attribute writer method checking allowed values (enum).
|
178
|
+
# @param [Object] preview_format Object to be assigned
|
179
|
+
def preview_format=(preview_format)
|
180
|
+
validator = EnumAttributeValidator.new('String', ["PNG", "JPEG", "BMP"])
|
181
|
+
if preview_format.to_i == 0
|
182
|
+
unless validator.valid?(preview_format)
|
183
|
+
raise ArgumentError, "invalid value for 'preview_format', must be one of #{validator.allowable_values}."
|
184
|
+
end
|
185
|
+
@preview_format = preview_format
|
186
|
+
else
|
187
|
+
@preview_format = validator.allowable_values[preview_format.to_i]
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Checks equality by comparing each attribute.
|
192
|
+
# @param [Object] Object to be compared
|
193
|
+
def ==(other)
|
194
|
+
return true if self.equal?(other)
|
195
|
+
self.class == other.class &&
|
196
|
+
file_info == other.file_info &&
|
197
|
+
width == other.width &&
|
198
|
+
height == other.height &&
|
199
|
+
page_numbers == other.page_numbers &&
|
200
|
+
preview_format == other.preview_format &&
|
201
|
+
hide_signatures == other.hide_signatures &&
|
202
|
+
output_path == other.output_path
|
203
|
+
end
|
204
|
+
|
205
|
+
# @see the `==` method
|
206
|
+
# @param [Object] Object to be compared
|
207
|
+
def eql?(other)
|
208
|
+
self == other
|
209
|
+
end
|
210
|
+
|
211
|
+
# Calculates hash code according to all attributes.
|
212
|
+
# @return [Fixnum] Hash code
|
213
|
+
def hash
|
214
|
+
[file_info, width, height, page_numbers, preview_format, hide_signatures, output_path].hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Downcases first letter.
|
218
|
+
# @return downcased string
|
219
|
+
def uncap(str)
|
220
|
+
str[0, 1].downcase + str[1..-1]
|
221
|
+
end
|
222
|
+
|
223
|
+
# Builds the object from hash
|
224
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
225
|
+
# @return [Object] Returns the model itself
|
226
|
+
def build_from_hash(attributes)
|
227
|
+
return nil unless attributes.is_a?(Hash)
|
228
|
+
self.class.swagger_types.each_pair do |key, type|
|
229
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
230
|
+
value = attributes[pname]
|
231
|
+
if type =~ /\AArray<(.*)>/i
|
232
|
+
# check to ensure the input is an array given that the the attribute
|
233
|
+
# is documented as an array but the input is not
|
234
|
+
if value.is_a?(Array)
|
235
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
236
|
+
end
|
237
|
+
elsif !value.nil?
|
238
|
+
self.send("#{key}=", _deserialize(type, value))
|
239
|
+
end
|
240
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
241
|
+
end
|
242
|
+
|
243
|
+
self
|
244
|
+
end
|
245
|
+
|
246
|
+
# Deserializes the data based on type
|
247
|
+
# @param string type Data type
|
248
|
+
# @param string value Value to be deserialized
|
249
|
+
# @return [Object] Deserialized data
|
250
|
+
def _deserialize(type, value)
|
251
|
+
case type.to_sym
|
252
|
+
when :DateTime
|
253
|
+
Date.parse value
|
254
|
+
when :Date
|
255
|
+
Date.parse value
|
256
|
+
when :String
|
257
|
+
value.to_s
|
258
|
+
when :Integer
|
259
|
+
value.to_i
|
260
|
+
when :Float
|
261
|
+
value.to_f
|
262
|
+
when :BOOLEAN
|
263
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
264
|
+
true
|
265
|
+
else
|
266
|
+
false
|
267
|
+
end
|
268
|
+
when :Object
|
269
|
+
# generic object (usually a Hash), return directly
|
270
|
+
value
|
271
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
272
|
+
inner_type = Regexp.last_match[:inner_type]
|
273
|
+
value.map { |v| _deserialize(inner_type, v) }
|
274
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
275
|
+
k_type = Regexp.last_match[:k_type]
|
276
|
+
v_type = Regexp.last_match[:v_type]
|
277
|
+
{}.tap do |hash|
|
278
|
+
value.each do |k, v|
|
279
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
else
|
283
|
+
# model
|
284
|
+
# Signature type fix
|
285
|
+
ttype = type
|
286
|
+
if value.is_a?(Hash) and !value[:signatureType].nil?
|
287
|
+
ttype = value[:signatureType] + 'Signature'
|
288
|
+
if value[:signatureType] == 'FormField' and !value[:type].nil?
|
289
|
+
type = value[:type]
|
290
|
+
if type == 'Checkbox'
|
291
|
+
ttype = 'CheckboxFormFieldSignature'
|
292
|
+
end
|
293
|
+
if type == 'Text'
|
294
|
+
ttype = 'TextFormFieldSignature'
|
295
|
+
end
|
296
|
+
if type == 'Combobox'
|
297
|
+
ttype = 'ComboboxFormFieldSignature'
|
298
|
+
end
|
299
|
+
if type == 'DigitalSignature'
|
300
|
+
ttype = 'DigitalFormFieldSignature'
|
301
|
+
end
|
302
|
+
if type == 'Radio'
|
303
|
+
ttype = 'RadioButtonFormFieldSignature'
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
temp_model = GroupDocsSignatureCloud.const_get(ttype).new
|
308
|
+
temp_model.build_from_hash(value)
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
# Returns the string representation of the object
|
313
|
+
# @return [String] String presentation of the object
|
314
|
+
def to_s
|
315
|
+
to_hash.to_s
|
316
|
+
end
|
317
|
+
|
318
|
+
# to_body is an alias to to_hash (backward compatibility)
|
319
|
+
# @return [Hash] Returns the object in the form of hash
|
320
|
+
def to_body
|
321
|
+
to_hash
|
322
|
+
end
|
323
|
+
|
324
|
+
# Returns the object in the form of hash
|
325
|
+
# @return [Hash] Returns the object in the form of hash
|
326
|
+
def to_hash
|
327
|
+
hash = {}
|
328
|
+
self.class.attribute_map.each_pair do |attr, param|
|
329
|
+
value = self.send(attr)
|
330
|
+
next if value.nil?
|
331
|
+
hash[param] = _to_hash(value)
|
332
|
+
end
|
333
|
+
hash
|
334
|
+
end
|
335
|
+
|
336
|
+
# Outputs non-array value in the form of hash
|
337
|
+
# For object, use to_hash. Otherwise, just return the value
|
338
|
+
# @param [Object] value Any valid value
|
339
|
+
# @return [Hash] Returns the value in the form of hash
|
340
|
+
def _to_hash(value)
|
341
|
+
if value.is_a?(Array)
|
342
|
+
value.compact.map { |v| _to_hash(v) }
|
343
|
+
elsif value.is_a?(Hash)
|
344
|
+
{}.tap do |hash|
|
345
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
346
|
+
end
|
347
|
+
elsif value.respond_to? :to_hash
|
348
|
+
value.to_hash
|
349
|
+
else
|
350
|
+
value
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
end
|
355
|
+
|
356
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# --------------------------------------------------------------------------------------------------------------------
|
3
3
|
# <copyright company="Aspose Pty Ltd" file="qr_code_signature.rb">
|
4
|
-
# Copyright (c) 2003-
|
4
|
+
# Copyright (c) 2003-2022 Aspose Pty Ltd
|
5
5
|
# </copyright>
|
6
6
|
# <summary>
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -234,7 +234,7 @@ module GroupDocsSignatureCloud
|
|
234
234
|
# @return true if the model is valid
|
235
235
|
def valid?
|
236
236
|
return false if @signature_type.nil?
|
237
|
-
signature_type_validator = EnumAttributeValidator.new('String', ["None", "Text", "Image", "Digital", "Barcode", "QRCode", "Stamp"])
|
237
|
+
signature_type_validator = EnumAttributeValidator.new('String', ["None", "Text", "Image", "Digital", "Barcode", "QRCode", "Stamp", "FormField", "Metadata"])
|
238
238
|
return false unless signature_type_validator.valid?(@signature_type)
|
239
239
|
return false if @is_signature.nil?
|
240
240
|
return false if @created_on.nil?
|
@@ -249,7 +249,7 @@ module GroupDocsSignatureCloud
|
|
249
249
|
# Custom attribute writer method checking allowed values (enum).
|
250
250
|
# @param [Object] signature_type Object to be assigned
|
251
251
|
def signature_type=(signature_type)
|
252
|
-
validator = EnumAttributeValidator.new('String', ["None", "Text", "Image", "Digital", "Barcode", "QRCode", "Stamp"])
|
252
|
+
validator = EnumAttributeValidator.new('String', ["None", "Text", "Image", "Digital", "Barcode", "QRCode", "Stamp", "FormField", "Metadata"])
|
253
253
|
if signature_type.to_i == 0
|
254
254
|
unless validator.valid?(signature_type)
|
255
255
|
raise ArgumentError, "invalid value for 'signature_type', must be one of #{validator.allowable_values}."
|
@@ -363,6 +363,24 @@ module GroupDocsSignatureCloud
|
|
363
363
|
ttype = type
|
364
364
|
if value.is_a?(Hash) and !value[:signatureType].nil?
|
365
365
|
ttype = value[:signatureType] + 'Signature'
|
366
|
+
if value[:signatureType] == 'FormField' and !value[:type].nil?
|
367
|
+
type = value[:type]
|
368
|
+
if type == 'Checkbox'
|
369
|
+
ttype = 'CheckboxFormFieldSignature'
|
370
|
+
end
|
371
|
+
if type == 'Text'
|
372
|
+
ttype = 'TextFormFieldSignature'
|
373
|
+
end
|
374
|
+
if type == 'Combobox'
|
375
|
+
ttype = 'ComboboxFormFieldSignature'
|
376
|
+
end
|
377
|
+
if type == 'DigitalSignature'
|
378
|
+
ttype = 'DigitalFormFieldSignature'
|
379
|
+
end
|
380
|
+
if type == 'Radio'
|
381
|
+
ttype = 'RadioButtonFormFieldSignature'
|
382
|
+
end
|
383
|
+
end
|
366
384
|
end
|
367
385
|
temp_model = GroupDocsSignatureCloud.const_get(ttype).new
|
368
386
|
temp_model.build_from_hash(value)
|