groupdocs_signature_cloud 20.7 → 22.6

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