docusign_admin 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/lib/docusign_admin/api/accounts_api.rb +55 -0
- data/lib/docusign_admin/api/bulk_imports_api.rb +28 -17
- data/lib/docusign_admin/api/organizations_api.rb +79 -0
- data/lib/docusign_admin/api/provision_asset_group_api.rb +280 -0
- data/lib/docusign_admin/client/api_client.rb +3 -6
- data/lib/docusign_admin/models/asset_group_account_clone.rb +370 -0
- data/lib/docusign_admin/models/asset_group_account_clone_source_account.rb +219 -0
- data/lib/docusign_admin/models/asset_group_account_clone_target_account.rb +234 -0
- data/lib/docusign_admin/models/asset_group_account_clone_target_account_admin.rb +248 -0
- data/lib/docusign_admin/models/asset_group_account_clones.rb +186 -0
- data/lib/docusign_admin/models/asset_group_account_response.rb +254 -0
- data/lib/docusign_admin/models/asset_group_accounts_response.rb +186 -0
- data/lib/docusign_admin/models/clone_error_details.rb +204 -0
- data/lib/docusign_admin/models/individual_membership_data_redaction_request.rb +183 -0
- data/lib/docusign_admin/models/individual_user_data_redaction_request.rb +194 -0
- data/lib/docusign_admin/models/individual_user_data_redaction_response.rb +237 -0
- data/lib/docusign_admin/models/membership_data_redaction_request.rb +183 -0
- data/lib/docusign_admin/models/membership_data_redaction_response.rb +226 -0
- data/lib/docusign_admin/version.rb +1 -1
- data/lib/docusign_admin.rb +15 -0
- metadata +17 -2
@@ -0,0 +1,370 @@
|
|
1
|
+
=begin
|
2
|
+
#DocuSign Admin API
|
3
|
+
|
4
|
+
#An API for an organization administrator to manage organizations, accounts and users
|
5
|
+
|
6
|
+
OpenAPI spec version: v2.1
|
7
|
+
Contact: devcenter@docusign.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
module DocuSign_Admin
|
15
|
+
class AssetGroupAccountClone
|
16
|
+
# The source account to be cloned from.
|
17
|
+
attr_accessor :source_account
|
18
|
+
|
19
|
+
# The target account to clone to.
|
20
|
+
attr_accessor :target_account
|
21
|
+
|
22
|
+
# The account clone work id.
|
23
|
+
attr_accessor :asset_group_work_id
|
24
|
+
|
25
|
+
# The asset group id the accounts belong to.
|
26
|
+
attr_accessor :asset_group_id
|
27
|
+
|
28
|
+
# The type of asset group work.
|
29
|
+
attr_accessor :asset_group_work_type
|
30
|
+
|
31
|
+
# The clone status.
|
32
|
+
attr_accessor :status
|
33
|
+
|
34
|
+
# The account entitlement/setting mirror request id created by the clone work.
|
35
|
+
attr_accessor :clone_request_id
|
36
|
+
|
37
|
+
# The order id created by the clone work.
|
38
|
+
attr_accessor :order_id
|
39
|
+
|
40
|
+
# The number of times the work has been worked on.
|
41
|
+
attr_accessor :attempts
|
42
|
+
|
43
|
+
# The date the account clone work is created.
|
44
|
+
attr_accessor :created_date
|
45
|
+
|
46
|
+
# The name of the creator of the account clone work.
|
47
|
+
attr_accessor :created_by_name
|
48
|
+
|
49
|
+
# The email of the creator of the account clone work.
|
50
|
+
attr_accessor :created_by_email
|
51
|
+
|
52
|
+
# The message associated with the account clone work.
|
53
|
+
attr_accessor :message
|
54
|
+
|
55
|
+
# The processing failures if the work is in PendingError/ProcessingError status.
|
56
|
+
attr_accessor :clone_processing_failure_details
|
57
|
+
|
58
|
+
class EnumAttributeValidator
|
59
|
+
attr_reader :datatype
|
60
|
+
attr_reader :allowable_values
|
61
|
+
|
62
|
+
def initialize(datatype, allowable_values)
|
63
|
+
@allowable_values = allowable_values.map do |value|
|
64
|
+
case datatype.to_s
|
65
|
+
when /Integer/i
|
66
|
+
value.to_i
|
67
|
+
when /Float/i
|
68
|
+
value.to_f
|
69
|
+
else
|
70
|
+
value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def valid?(value)
|
76
|
+
!value || allowable_values.include?(value)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
81
|
+
def self.attribute_map
|
82
|
+
{
|
83
|
+
:'source_account' => :'sourceAccount',
|
84
|
+
:'target_account' => :'targetAccount',
|
85
|
+
:'asset_group_work_id' => :'assetGroupWorkId',
|
86
|
+
:'asset_group_id' => :'assetGroupId',
|
87
|
+
:'asset_group_work_type' => :'assetGroupWorkType',
|
88
|
+
:'status' => :'status',
|
89
|
+
:'clone_request_id' => :'cloneRequestId',
|
90
|
+
:'order_id' => :'orderId',
|
91
|
+
:'attempts' => :'attempts',
|
92
|
+
:'created_date' => :'createdDate',
|
93
|
+
:'created_by_name' => :'createdByName',
|
94
|
+
:'created_by_email' => :'createdByEmail',
|
95
|
+
:'message' => :'message',
|
96
|
+
:'clone_processing_failure_details' => :'cloneProcessingFailureDetails'
|
97
|
+
}
|
98
|
+
end
|
99
|
+
|
100
|
+
# Attribute type mapping.
|
101
|
+
def self.swagger_types
|
102
|
+
{
|
103
|
+
:'source_account' => :'AssetGroupAccountCloneSourceAccount',
|
104
|
+
:'target_account' => :'AssetGroupAccountCloneTargetAccount',
|
105
|
+
:'asset_group_work_id' => :'String',
|
106
|
+
:'asset_group_id' => :'String',
|
107
|
+
:'asset_group_work_type' => :'String',
|
108
|
+
:'status' => :'String',
|
109
|
+
:'clone_request_id' => :'String',
|
110
|
+
:'order_id' => :'String',
|
111
|
+
:'attempts' => :'Integer',
|
112
|
+
:'created_date' => :'DateTime',
|
113
|
+
:'created_by_name' => :'String',
|
114
|
+
:'created_by_email' => :'String',
|
115
|
+
:'message' => :'String',
|
116
|
+
:'clone_processing_failure_details' => :'CloneErrorDetails'
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
120
|
+
# Initializes the object
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
def initialize(attributes = {})
|
123
|
+
return unless attributes.is_a?(Hash)
|
124
|
+
|
125
|
+
# convert string to symbol for hash key
|
126
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
127
|
+
|
128
|
+
if attributes.has_key?(:'sourceAccount')
|
129
|
+
self.source_account = attributes[:'sourceAccount']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.has_key?(:'targetAccount')
|
133
|
+
self.target_account = attributes[:'targetAccount']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.has_key?(:'assetGroupWorkId')
|
137
|
+
self.asset_group_work_id = attributes[:'assetGroupWorkId']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.has_key?(:'assetGroupId')
|
141
|
+
self.asset_group_id = attributes[:'assetGroupId']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.has_key?(:'assetGroupWorkType')
|
145
|
+
self.asset_group_work_type = attributes[:'assetGroupWorkType']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.has_key?(:'status')
|
149
|
+
self.status = attributes[:'status']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.has_key?(:'cloneRequestId')
|
153
|
+
self.clone_request_id = attributes[:'cloneRequestId']
|
154
|
+
end
|
155
|
+
|
156
|
+
if attributes.has_key?(:'orderId')
|
157
|
+
self.order_id = attributes[:'orderId']
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes.has_key?(:'attempts')
|
161
|
+
self.attempts = attributes[:'attempts']
|
162
|
+
end
|
163
|
+
|
164
|
+
if attributes.has_key?(:'createdDate')
|
165
|
+
self.created_date = attributes[:'createdDate']
|
166
|
+
end
|
167
|
+
|
168
|
+
if attributes.has_key?(:'createdByName')
|
169
|
+
self.created_by_name = attributes[:'createdByName']
|
170
|
+
end
|
171
|
+
|
172
|
+
if attributes.has_key?(:'createdByEmail')
|
173
|
+
self.created_by_email = attributes[:'createdByEmail']
|
174
|
+
end
|
175
|
+
|
176
|
+
if attributes.has_key?(:'message')
|
177
|
+
self.message = attributes[:'message']
|
178
|
+
end
|
179
|
+
|
180
|
+
if attributes.has_key?(:'cloneProcessingFailureDetails')
|
181
|
+
self.clone_processing_failure_details = attributes[:'cloneProcessingFailureDetails']
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
186
|
+
# @return Array for valid properties with the reasons
|
187
|
+
def list_invalid_properties
|
188
|
+
invalid_properties = Array.new
|
189
|
+
if @source_account.nil?
|
190
|
+
invalid_properties.push('invalid value for "source_account", source_account cannot be nil.')
|
191
|
+
end
|
192
|
+
|
193
|
+
if @target_account.nil?
|
194
|
+
invalid_properties.push('invalid value for "target_account", target_account cannot be nil.')
|
195
|
+
end
|
196
|
+
|
197
|
+
invalid_properties
|
198
|
+
end
|
199
|
+
|
200
|
+
# Check to see if the all the properties in the model are valid
|
201
|
+
# @return true if the model is valid
|
202
|
+
def valid?
|
203
|
+
return false if @source_account.nil?
|
204
|
+
return false if @target_account.nil?
|
205
|
+
asset_group_work_type_validator = EnumAttributeValidator.new('String', ['Undefined', 'GroupAssetFulfillment', 'AccountAssetFulfillment', 'AccountAssetClone', 'AccountAssetCreate'])
|
206
|
+
return false unless asset_group_work_type_validator.valid?(@asset_group_work_type)
|
207
|
+
status_validator = EnumAttributeValidator.new('String', ['Undefined', 'Pending', 'Processing', 'PendingError', 'ProcessingError', 'Completed', 'Canceled', 'PermanentFailure'])
|
208
|
+
return false unless status_validator.valid?(@status)
|
209
|
+
true
|
210
|
+
end
|
211
|
+
|
212
|
+
# Custom attribute writer method checking allowed values (enum).
|
213
|
+
# @param [Object] asset_group_work_type Object to be assigned
|
214
|
+
def asset_group_work_type=(asset_group_work_type)
|
215
|
+
validator = EnumAttributeValidator.new('String', ['Undefined', 'GroupAssetFulfillment', 'AccountAssetFulfillment', 'AccountAssetClone', 'AccountAssetCreate'])
|
216
|
+
unless validator.valid?(asset_group_work_type)
|
217
|
+
fail ArgumentError, 'invalid value for "asset_group_work_type", must be one of #{validator.allowable_values}.'
|
218
|
+
end
|
219
|
+
@asset_group_work_type = asset_group_work_type
|
220
|
+
end
|
221
|
+
|
222
|
+
# Custom attribute writer method checking allowed values (enum).
|
223
|
+
# @param [Object] status Object to be assigned
|
224
|
+
def status=(status)
|
225
|
+
validator = EnumAttributeValidator.new('String', ['Undefined', 'Pending', 'Processing', 'PendingError', 'ProcessingError', 'Completed', 'Canceled', 'PermanentFailure'])
|
226
|
+
unless validator.valid?(status)
|
227
|
+
fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
|
228
|
+
end
|
229
|
+
@status = status
|
230
|
+
end
|
231
|
+
|
232
|
+
# Checks equality by comparing each attribute.
|
233
|
+
# @param [Object] Object to be compared
|
234
|
+
def ==(o)
|
235
|
+
return true if self.equal?(o)
|
236
|
+
self.class == o.class &&
|
237
|
+
source_account == o.source_account &&
|
238
|
+
target_account == o.target_account &&
|
239
|
+
asset_group_work_id == o.asset_group_work_id &&
|
240
|
+
asset_group_id == o.asset_group_id &&
|
241
|
+
asset_group_work_type == o.asset_group_work_type &&
|
242
|
+
status == o.status &&
|
243
|
+
clone_request_id == o.clone_request_id &&
|
244
|
+
order_id == o.order_id &&
|
245
|
+
attempts == o.attempts &&
|
246
|
+
created_date == o.created_date &&
|
247
|
+
created_by_name == o.created_by_name &&
|
248
|
+
created_by_email == o.created_by_email &&
|
249
|
+
message == o.message &&
|
250
|
+
clone_processing_failure_details == o.clone_processing_failure_details
|
251
|
+
end
|
252
|
+
|
253
|
+
# @see the `==` method
|
254
|
+
# @param [Object] Object to be compared
|
255
|
+
def eql?(o)
|
256
|
+
self == o
|
257
|
+
end
|
258
|
+
|
259
|
+
# Calculates hash code according to all attributes.
|
260
|
+
# @return [Fixnum] Hash code
|
261
|
+
def hash
|
262
|
+
[source_account, target_account, asset_group_work_id, asset_group_id, asset_group_work_type, status, clone_request_id, order_id, attempts, created_date, created_by_name, created_by_email, message, clone_processing_failure_details].hash
|
263
|
+
end
|
264
|
+
|
265
|
+
# Builds the object from hash
|
266
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
267
|
+
# @return [Object] Returns the model itself
|
268
|
+
def build_from_hash(attributes)
|
269
|
+
return nil unless attributes.is_a?(Hash)
|
270
|
+
self.class.swagger_types.each_pair do |key, type|
|
271
|
+
if type =~ /\AArray<(.*)>/i
|
272
|
+
# check to ensure the input is an array given that the attribute
|
273
|
+
# is documented as an array but the input is not
|
274
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
275
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
276
|
+
end
|
277
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
278
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
279
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
280
|
+
end
|
281
|
+
|
282
|
+
self
|
283
|
+
end
|
284
|
+
|
285
|
+
# Deserializes the data based on type
|
286
|
+
# @param string type Data type
|
287
|
+
# @param string value Value to be deserialized
|
288
|
+
# @return [Object] Deserialized data
|
289
|
+
def _deserialize(type, value)
|
290
|
+
case type.to_sym
|
291
|
+
when :DateTime
|
292
|
+
DateTime.parse(value)
|
293
|
+
when :Date
|
294
|
+
Date.parse(value)
|
295
|
+
when :String
|
296
|
+
value.to_s
|
297
|
+
when :Integer
|
298
|
+
value.to_i
|
299
|
+
when :Float
|
300
|
+
value.to_f
|
301
|
+
when :BOOLEAN
|
302
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
303
|
+
true
|
304
|
+
else
|
305
|
+
false
|
306
|
+
end
|
307
|
+
when :Object
|
308
|
+
# generic object (usually a Hash), return directly
|
309
|
+
value
|
310
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
311
|
+
inner_type = Regexp.last_match[:inner_type]
|
312
|
+
value.map { |v| _deserialize(inner_type, v) }
|
313
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
314
|
+
k_type = Regexp.last_match[:k_type]
|
315
|
+
v_type = Regexp.last_match[:v_type]
|
316
|
+
{}.tap do |hash|
|
317
|
+
value.each do |k, v|
|
318
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
319
|
+
end
|
320
|
+
end
|
321
|
+
else # model
|
322
|
+
temp_model = DocuSign_Admin.const_get(type).new
|
323
|
+
temp_model.build_from_hash(value)
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
# Returns the string representation of the object
|
328
|
+
# @return [String] String presentation of the object
|
329
|
+
def to_s
|
330
|
+
to_hash.to_s
|
331
|
+
end
|
332
|
+
|
333
|
+
# to_body is an alias to to_hash (backward compatibility)
|
334
|
+
# @return [Hash] Returns the object in the form of hash
|
335
|
+
def to_body
|
336
|
+
to_hash
|
337
|
+
end
|
338
|
+
|
339
|
+
# Returns the object in the form of hash
|
340
|
+
# @return [Hash] Returns the object in the form of hash
|
341
|
+
def to_hash
|
342
|
+
hash = {}
|
343
|
+
self.class.attribute_map.each_pair do |attr, param|
|
344
|
+
value = self.send(attr)
|
345
|
+
next if value.nil?
|
346
|
+
hash[param] = _to_hash(value)
|
347
|
+
end
|
348
|
+
hash
|
349
|
+
end
|
350
|
+
|
351
|
+
# Outputs non-array value in the form of hash
|
352
|
+
# For object, use to_hash. Otherwise, just return the value
|
353
|
+
# @param [Object] value Any valid value
|
354
|
+
# @return [Hash] Returns the value in the form of hash
|
355
|
+
def _to_hash(value)
|
356
|
+
if value.is_a?(Array)
|
357
|
+
value.compact.map { |v| _to_hash(v) }
|
358
|
+
elsif value.is_a?(Hash)
|
359
|
+
{}.tap do |hash|
|
360
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
361
|
+
end
|
362
|
+
elsif value.respond_to? :to_hash
|
363
|
+
value.to_hash
|
364
|
+
else
|
365
|
+
value
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
end
|
370
|
+
end
|
@@ -0,0 +1,219 @@
|
|
1
|
+
=begin
|
2
|
+
#DocuSign Admin API
|
3
|
+
|
4
|
+
#An API for an organization administrator to manage organizations, accounts and users
|
5
|
+
|
6
|
+
OpenAPI spec version: v2.1
|
7
|
+
Contact: devcenter@docusign.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
module DocuSign_Admin
|
15
|
+
class AssetGroupAccountCloneSourceAccount
|
16
|
+
# The source account id to clone from.
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
# The external account id of the source account.
|
20
|
+
attr_accessor :external_account_id
|
21
|
+
|
22
|
+
# The site the source account is on.
|
23
|
+
attr_accessor :site
|
24
|
+
|
25
|
+
# The name of the source account.
|
26
|
+
attr_accessor :name
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'id' => :'id',
|
32
|
+
:'external_account_id' => :'externalAccountId',
|
33
|
+
:'site' => :'site',
|
34
|
+
:'name' => :'name'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.swagger_types
|
40
|
+
{
|
41
|
+
:'id' => :'String',
|
42
|
+
:'external_account_id' => :'Integer',
|
43
|
+
:'site' => :'String',
|
44
|
+
:'name' => :'String'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Initializes the object
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
50
|
+
def initialize(attributes = {})
|
51
|
+
return unless attributes.is_a?(Hash)
|
52
|
+
|
53
|
+
# convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
55
|
+
|
56
|
+
if attributes.has_key?(:'id')
|
57
|
+
self.id = attributes[:'id']
|
58
|
+
end
|
59
|
+
|
60
|
+
if attributes.has_key?(:'externalAccountId')
|
61
|
+
self.external_account_id = attributes[:'externalAccountId']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.has_key?(:'site')
|
65
|
+
self.site = attributes[:'site']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'name')
|
69
|
+
self.name = attributes[:'name']
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
74
|
+
# @return Array for valid properties with the reasons
|
75
|
+
def list_invalid_properties
|
76
|
+
invalid_properties = Array.new
|
77
|
+
if @id.nil?
|
78
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
79
|
+
end
|
80
|
+
|
81
|
+
invalid_properties
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check to see if the all the properties in the model are valid
|
85
|
+
# @return true if the model is valid
|
86
|
+
def valid?
|
87
|
+
return false if @id.nil?
|
88
|
+
true
|
89
|
+
end
|
90
|
+
|
91
|
+
# Checks equality by comparing each attribute.
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def ==(o)
|
94
|
+
return true if self.equal?(o)
|
95
|
+
self.class == o.class &&
|
96
|
+
id == o.id &&
|
97
|
+
external_account_id == o.external_account_id &&
|
98
|
+
site == o.site &&
|
99
|
+
name == o.name
|
100
|
+
end
|
101
|
+
|
102
|
+
# @see the `==` method
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def eql?(o)
|
105
|
+
self == o
|
106
|
+
end
|
107
|
+
|
108
|
+
# Calculates hash code according to all attributes.
|
109
|
+
# @return [Fixnum] Hash code
|
110
|
+
def hash
|
111
|
+
[id, external_account_id, site, name].hash
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def build_from_hash(attributes)
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
119
|
+
self.class.swagger_types.each_pair do |key, type|
|
120
|
+
if type =~ /\AArray<(.*)>/i
|
121
|
+
# check to ensure the input is an array given that the attribute
|
122
|
+
# is documented as an array but the input is not
|
123
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
124
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
125
|
+
end
|
126
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
127
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
128
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
129
|
+
end
|
130
|
+
|
131
|
+
self
|
132
|
+
end
|
133
|
+
|
134
|
+
# Deserializes the data based on type
|
135
|
+
# @param string type Data type
|
136
|
+
# @param string value Value to be deserialized
|
137
|
+
# @return [Object] Deserialized data
|
138
|
+
def _deserialize(type, value)
|
139
|
+
case type.to_sym
|
140
|
+
when :DateTime
|
141
|
+
DateTime.parse(value)
|
142
|
+
when :Date
|
143
|
+
Date.parse(value)
|
144
|
+
when :String
|
145
|
+
value.to_s
|
146
|
+
when :Integer
|
147
|
+
value.to_i
|
148
|
+
when :Float
|
149
|
+
value.to_f
|
150
|
+
when :BOOLEAN
|
151
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
152
|
+
true
|
153
|
+
else
|
154
|
+
false
|
155
|
+
end
|
156
|
+
when :Object
|
157
|
+
# generic object (usually a Hash), return directly
|
158
|
+
value
|
159
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
160
|
+
inner_type = Regexp.last_match[:inner_type]
|
161
|
+
value.map { |v| _deserialize(inner_type, v) }
|
162
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
163
|
+
k_type = Regexp.last_match[:k_type]
|
164
|
+
v_type = Regexp.last_match[:v_type]
|
165
|
+
{}.tap do |hash|
|
166
|
+
value.each do |k, v|
|
167
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
else # model
|
171
|
+
temp_model = DocuSign_Admin.const_get(type).new
|
172
|
+
temp_model.build_from_hash(value)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
# Returns the string representation of the object
|
177
|
+
# @return [String] String presentation of the object
|
178
|
+
def to_s
|
179
|
+
to_hash.to_s
|
180
|
+
end
|
181
|
+
|
182
|
+
# to_body is an alias to to_hash (backward compatibility)
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
184
|
+
def to_body
|
185
|
+
to_hash
|
186
|
+
end
|
187
|
+
|
188
|
+
# Returns the object in the form of hash
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_hash
|
191
|
+
hash = {}
|
192
|
+
self.class.attribute_map.each_pair do |attr, param|
|
193
|
+
value = self.send(attr)
|
194
|
+
next if value.nil?
|
195
|
+
hash[param] = _to_hash(value)
|
196
|
+
end
|
197
|
+
hash
|
198
|
+
end
|
199
|
+
|
200
|
+
# Outputs non-array value in the form of hash
|
201
|
+
# For object, use to_hash. Otherwise, just return the value
|
202
|
+
# @param [Object] value Any valid value
|
203
|
+
# @return [Hash] Returns the value in the form of hash
|
204
|
+
def _to_hash(value)
|
205
|
+
if value.is_a?(Array)
|
206
|
+
value.compact.map { |v| _to_hash(v) }
|
207
|
+
elsif value.is_a?(Hash)
|
208
|
+
{}.tap do |hash|
|
209
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
210
|
+
end
|
211
|
+
elsif value.respond_to? :to_hash
|
212
|
+
value.to_hash
|
213
|
+
else
|
214
|
+
value
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
end
|