docusign_admin 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +10 -0
- data/docusign_admin.gemspec +8 -6
- 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/product_permission_profiles_api.rb +185 -0
- data/lib/docusign_admin/api/users_api.rb +134 -0
- data/lib/docusign_admin/client/api_client.rb +23 -20
- data/lib/docusign_admin/client/api_error.rb +2 -2
- data/lib/docusign_admin/client/auth/oauth.rb +1 -1
- data/lib/docusign_admin/models/ds_group_users_remove_request.rb +15 -9
- 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/models/remove_user_products_response.rb +222 -0
- data/lib/docusign_admin/models/user_product_permission_profiles_request.rb +204 -0
- data/lib/docusign_admin/models/user_product_profile_delete_request.rb +208 -0
- data/lib/docusign_admin/version.rb +1 -1
- data/lib/docusign_admin.rb +9 -0
- metadata +107 -82
@@ -0,0 +1,194 @@
|
|
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 IndividualUserDataRedactionRequest
|
16
|
+
attr_accessor :user_id
|
17
|
+
|
18
|
+
attr_accessor :memberships
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'user_id' => :'user_id',
|
24
|
+
:'memberships' => :'memberships'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.swagger_types
|
30
|
+
{
|
31
|
+
:'user_id' => :'String',
|
32
|
+
:'memberships' => :'Array<MembershipDataRedactionRequest>'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Initializes the object
|
37
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
38
|
+
def initialize(attributes = {})
|
39
|
+
return unless attributes.is_a?(Hash)
|
40
|
+
|
41
|
+
# convert string to symbol for hash key
|
42
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
43
|
+
|
44
|
+
if attributes.has_key?(:'user_id')
|
45
|
+
self.user_id = attributes[:'user_id']
|
46
|
+
end
|
47
|
+
|
48
|
+
if attributes.has_key?(:'memberships')
|
49
|
+
if (value = attributes[:'memberships']).is_a?(Array)
|
50
|
+
self.memberships = value
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
56
|
+
# @return Array for valid properties with the reasons
|
57
|
+
def list_invalid_properties
|
58
|
+
invalid_properties = Array.new
|
59
|
+
invalid_properties
|
60
|
+
end
|
61
|
+
|
62
|
+
# Check to see if the all the properties in the model are valid
|
63
|
+
# @return true if the model is valid
|
64
|
+
def valid?
|
65
|
+
true
|
66
|
+
end
|
67
|
+
|
68
|
+
# Checks equality by comparing each attribute.
|
69
|
+
# @param [Object] Object to be compared
|
70
|
+
def ==(o)
|
71
|
+
return true if self.equal?(o)
|
72
|
+
self.class == o.class &&
|
73
|
+
user_id == o.user_id &&
|
74
|
+
memberships == o.memberships
|
75
|
+
end
|
76
|
+
|
77
|
+
# @see the `==` method
|
78
|
+
# @param [Object] Object to be compared
|
79
|
+
def eql?(o)
|
80
|
+
self == o
|
81
|
+
end
|
82
|
+
|
83
|
+
# Calculates hash code according to all attributes.
|
84
|
+
# @return [Fixnum] Hash code
|
85
|
+
def hash
|
86
|
+
[user_id, memberships].hash
|
87
|
+
end
|
88
|
+
|
89
|
+
# Builds the object from hash
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
+
# @return [Object] Returns the model itself
|
92
|
+
def build_from_hash(attributes)
|
93
|
+
return nil unless attributes.is_a?(Hash)
|
94
|
+
self.class.swagger_types.each_pair do |key, type|
|
95
|
+
if type =~ /\AArray<(.*)>/i
|
96
|
+
# check to ensure the input is an array given that the attribute
|
97
|
+
# is documented as an array but the input is not
|
98
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
99
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
100
|
+
end
|
101
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
102
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
103
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
104
|
+
end
|
105
|
+
|
106
|
+
self
|
107
|
+
end
|
108
|
+
|
109
|
+
# Deserializes the data based on type
|
110
|
+
# @param string type Data type
|
111
|
+
# @param string value Value to be deserialized
|
112
|
+
# @return [Object] Deserialized data
|
113
|
+
def _deserialize(type, value)
|
114
|
+
case type.to_sym
|
115
|
+
when :DateTime
|
116
|
+
DateTime.parse(value)
|
117
|
+
when :Date
|
118
|
+
Date.parse(value)
|
119
|
+
when :String
|
120
|
+
value.to_s
|
121
|
+
when :Integer
|
122
|
+
value.to_i
|
123
|
+
when :Float
|
124
|
+
value.to_f
|
125
|
+
when :BOOLEAN
|
126
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
127
|
+
true
|
128
|
+
else
|
129
|
+
false
|
130
|
+
end
|
131
|
+
when :Object
|
132
|
+
# generic object (usually a Hash), return directly
|
133
|
+
value
|
134
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
135
|
+
inner_type = Regexp.last_match[:inner_type]
|
136
|
+
value.map { |v| _deserialize(inner_type, v) }
|
137
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
138
|
+
k_type = Regexp.last_match[:k_type]
|
139
|
+
v_type = Regexp.last_match[:v_type]
|
140
|
+
{}.tap do |hash|
|
141
|
+
value.each do |k, v|
|
142
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
else # model
|
146
|
+
temp_model = DocuSign_Admin.const_get(type).new
|
147
|
+
temp_model.build_from_hash(value)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# Returns the string representation of the object
|
152
|
+
# @return [String] String presentation of the object
|
153
|
+
def to_s
|
154
|
+
to_hash.to_s
|
155
|
+
end
|
156
|
+
|
157
|
+
# to_body is an alias to to_hash (backward compatibility)
|
158
|
+
# @return [Hash] Returns the object in the form of hash
|
159
|
+
def to_body
|
160
|
+
to_hash
|
161
|
+
end
|
162
|
+
|
163
|
+
# Returns the object in the form of hash
|
164
|
+
# @return [Hash] Returns the object in the form of hash
|
165
|
+
def to_hash
|
166
|
+
hash = {}
|
167
|
+
self.class.attribute_map.each_pair do |attr, param|
|
168
|
+
value = self.send(attr)
|
169
|
+
next if value.nil?
|
170
|
+
hash[param] = _to_hash(value)
|
171
|
+
end
|
172
|
+
hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Outputs non-array value in the form of hash
|
176
|
+
# For object, use to_hash. Otherwise, just return the value
|
177
|
+
# @param [Object] value Any valid value
|
178
|
+
# @return [Hash] Returns the value in the form of hash
|
179
|
+
def _to_hash(value)
|
180
|
+
if value.is_a?(Array)
|
181
|
+
value.compact.map { |v| _to_hash(v) }
|
182
|
+
elsif value.is_a?(Hash)
|
183
|
+
{}.tap do |hash|
|
184
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
185
|
+
end
|
186
|
+
elsif value.respond_to? :to_hash
|
187
|
+
value.to_hash
|
188
|
+
else
|
189
|
+
value
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
end
|
194
|
+
end
|
@@ -0,0 +1,237 @@
|
|
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 IndividualUserDataRedactionResponse
|
16
|
+
attr_accessor :user_id
|
17
|
+
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
attr_accessor :membership_results
|
21
|
+
|
22
|
+
class EnumAttributeValidator
|
23
|
+
attr_reader :datatype
|
24
|
+
attr_reader :allowable_values
|
25
|
+
|
26
|
+
def initialize(datatype, allowable_values)
|
27
|
+
@allowable_values = allowable_values.map do |value|
|
28
|
+
case datatype.to_s
|
29
|
+
when /Integer/i
|
30
|
+
value.to_i
|
31
|
+
when /Float/i
|
32
|
+
value.to_f
|
33
|
+
else
|
34
|
+
value
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def valid?(value)
|
40
|
+
!value || allowable_values.include?(value)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
45
|
+
def self.attribute_map
|
46
|
+
{
|
47
|
+
:'user_id' => :'user_id',
|
48
|
+
:'status' => :'status',
|
49
|
+
:'membership_results' => :'membership_results'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.swagger_types
|
55
|
+
{
|
56
|
+
:'user_id' => :'String',
|
57
|
+
:'status' => :'String',
|
58
|
+
:'membership_results' => :'Array<MembershipDataRedactionResponse>'
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
# Initializes the object
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
|
+
def initialize(attributes = {})
|
65
|
+
return unless attributes.is_a?(Hash)
|
66
|
+
|
67
|
+
# convert string to symbol for hash key
|
68
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
69
|
+
|
70
|
+
if attributes.has_key?(:'user_id')
|
71
|
+
self.user_id = attributes[:'user_id']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:'status')
|
75
|
+
self.status = attributes[:'status']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.has_key?(:'membership_results')
|
79
|
+
if (value = attributes[:'membership_results']).is_a?(Array)
|
80
|
+
self.membership_results = value
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
86
|
+
# @return Array for valid properties with the reasons
|
87
|
+
def list_invalid_properties
|
88
|
+
invalid_properties = Array.new
|
89
|
+
invalid_properties
|
90
|
+
end
|
91
|
+
|
92
|
+
# Check to see if the all the properties in the model are valid
|
93
|
+
# @return true if the model is valid
|
94
|
+
def valid?
|
95
|
+
status_validator = EnumAttributeValidator.new('String', ['unknown', 'pending', 'failure', 'success', 'already_redacted'])
|
96
|
+
return false unless status_validator.valid?(@status)
|
97
|
+
true
|
98
|
+
end
|
99
|
+
|
100
|
+
# Custom attribute writer method checking allowed values (enum).
|
101
|
+
# @param [Object] status Object to be assigned
|
102
|
+
def status=(status)
|
103
|
+
validator = EnumAttributeValidator.new('String', ['unknown', 'pending', 'failure', 'success', 'already_redacted'])
|
104
|
+
unless validator.valid?(status)
|
105
|
+
fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
|
106
|
+
end
|
107
|
+
@status = status
|
108
|
+
end
|
109
|
+
|
110
|
+
# Checks equality by comparing each attribute.
|
111
|
+
# @param [Object] Object to be compared
|
112
|
+
def ==(o)
|
113
|
+
return true if self.equal?(o)
|
114
|
+
self.class == o.class &&
|
115
|
+
user_id == o.user_id &&
|
116
|
+
status == o.status &&
|
117
|
+
membership_results == o.membership_results
|
118
|
+
end
|
119
|
+
|
120
|
+
# @see the `==` method
|
121
|
+
# @param [Object] Object to be compared
|
122
|
+
def eql?(o)
|
123
|
+
self == o
|
124
|
+
end
|
125
|
+
|
126
|
+
# Calculates hash code according to all attributes.
|
127
|
+
# @return [Fixnum] Hash code
|
128
|
+
def hash
|
129
|
+
[user_id, status, membership_results].hash
|
130
|
+
end
|
131
|
+
|
132
|
+
# Builds the object from hash
|
133
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
134
|
+
# @return [Object] Returns the model itself
|
135
|
+
def build_from_hash(attributes)
|
136
|
+
return nil unless attributes.is_a?(Hash)
|
137
|
+
self.class.swagger_types.each_pair do |key, type|
|
138
|
+
if type =~ /\AArray<(.*)>/i
|
139
|
+
# check to ensure the input is an array given that the attribute
|
140
|
+
# is documented as an array but the input is not
|
141
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
142
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
143
|
+
end
|
144
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
145
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
146
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
147
|
+
end
|
148
|
+
|
149
|
+
self
|
150
|
+
end
|
151
|
+
|
152
|
+
# Deserializes the data based on type
|
153
|
+
# @param string type Data type
|
154
|
+
# @param string value Value to be deserialized
|
155
|
+
# @return [Object] Deserialized data
|
156
|
+
def _deserialize(type, value)
|
157
|
+
case type.to_sym
|
158
|
+
when :DateTime
|
159
|
+
DateTime.parse(value)
|
160
|
+
when :Date
|
161
|
+
Date.parse(value)
|
162
|
+
when :String
|
163
|
+
value.to_s
|
164
|
+
when :Integer
|
165
|
+
value.to_i
|
166
|
+
when :Float
|
167
|
+
value.to_f
|
168
|
+
when :BOOLEAN
|
169
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
170
|
+
true
|
171
|
+
else
|
172
|
+
false
|
173
|
+
end
|
174
|
+
when :Object
|
175
|
+
# generic object (usually a Hash), return directly
|
176
|
+
value
|
177
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
178
|
+
inner_type = Regexp.last_match[:inner_type]
|
179
|
+
value.map { |v| _deserialize(inner_type, v) }
|
180
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
181
|
+
k_type = Regexp.last_match[:k_type]
|
182
|
+
v_type = Regexp.last_match[:v_type]
|
183
|
+
{}.tap do |hash|
|
184
|
+
value.each do |k, v|
|
185
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
else # model
|
189
|
+
temp_model = DocuSign_Admin.const_get(type).new
|
190
|
+
temp_model.build_from_hash(value)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the string representation of the object
|
195
|
+
# @return [String] String presentation of the object
|
196
|
+
def to_s
|
197
|
+
to_hash.to_s
|
198
|
+
end
|
199
|
+
|
200
|
+
# to_body is an alias to to_hash (backward compatibility)
|
201
|
+
# @return [Hash] Returns the object in the form of hash
|
202
|
+
def to_body
|
203
|
+
to_hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# Returns the object in the form of hash
|
207
|
+
# @return [Hash] Returns the object in the form of hash
|
208
|
+
def to_hash
|
209
|
+
hash = {}
|
210
|
+
self.class.attribute_map.each_pair do |attr, param|
|
211
|
+
value = self.send(attr)
|
212
|
+
next if value.nil?
|
213
|
+
hash[param] = _to_hash(value)
|
214
|
+
end
|
215
|
+
hash
|
216
|
+
end
|
217
|
+
|
218
|
+
# Outputs non-array value in the form of hash
|
219
|
+
# For object, use to_hash. Otherwise, just return the value
|
220
|
+
# @param [Object] value Any valid value
|
221
|
+
# @return [Hash] Returns the value in the form of hash
|
222
|
+
def _to_hash(value)
|
223
|
+
if value.is_a?(Array)
|
224
|
+
value.compact.map { |v| _to_hash(v) }
|
225
|
+
elsif value.is_a?(Hash)
|
226
|
+
{}.tap do |hash|
|
227
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
228
|
+
end
|
229
|
+
elsif value.respond_to? :to_hash
|
230
|
+
value.to_hash
|
231
|
+
else
|
232
|
+
value
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
237
|
+
end
|
@@ -0,0 +1,183 @@
|
|
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 MembershipDataRedactionRequest
|
16
|
+
attr_accessor :account_id
|
17
|
+
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
19
|
+
def self.attribute_map
|
20
|
+
{
|
21
|
+
:'account_id' => :'account_id'
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
# Attribute type mapping.
|
26
|
+
def self.swagger_types
|
27
|
+
{
|
28
|
+
:'account_id' => :'String'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Initializes the object
|
33
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
34
|
+
def initialize(attributes = {})
|
35
|
+
return unless attributes.is_a?(Hash)
|
36
|
+
|
37
|
+
# convert string to symbol for hash key
|
38
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
39
|
+
|
40
|
+
if attributes.has_key?(:'account_id')
|
41
|
+
self.account_id = attributes[:'account_id']
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
46
|
+
# @return Array for valid properties with the reasons
|
47
|
+
def list_invalid_properties
|
48
|
+
invalid_properties = Array.new
|
49
|
+
invalid_properties
|
50
|
+
end
|
51
|
+
|
52
|
+
# Check to see if the all the properties in the model are valid
|
53
|
+
# @return true if the model is valid
|
54
|
+
def valid?
|
55
|
+
true
|
56
|
+
end
|
57
|
+
|
58
|
+
# Checks equality by comparing each attribute.
|
59
|
+
# @param [Object] Object to be compared
|
60
|
+
def ==(o)
|
61
|
+
return true if self.equal?(o)
|
62
|
+
self.class == o.class &&
|
63
|
+
account_id == o.account_id
|
64
|
+
end
|
65
|
+
|
66
|
+
# @see the `==` method
|
67
|
+
# @param [Object] Object to be compared
|
68
|
+
def eql?(o)
|
69
|
+
self == o
|
70
|
+
end
|
71
|
+
|
72
|
+
# Calculates hash code according to all attributes.
|
73
|
+
# @return [Fixnum] Hash code
|
74
|
+
def hash
|
75
|
+
[account_id].hash
|
76
|
+
end
|
77
|
+
|
78
|
+
# Builds the object from hash
|
79
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
80
|
+
# @return [Object] Returns the model itself
|
81
|
+
def build_from_hash(attributes)
|
82
|
+
return nil unless attributes.is_a?(Hash)
|
83
|
+
self.class.swagger_types.each_pair do |key, type|
|
84
|
+
if type =~ /\AArray<(.*)>/i
|
85
|
+
# check to ensure the input is an array given that the attribute
|
86
|
+
# is documented as an array but the input is not
|
87
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
88
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
89
|
+
end
|
90
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
91
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
92
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
93
|
+
end
|
94
|
+
|
95
|
+
self
|
96
|
+
end
|
97
|
+
|
98
|
+
# Deserializes the data based on type
|
99
|
+
# @param string type Data type
|
100
|
+
# @param string value Value to be deserialized
|
101
|
+
# @return [Object] Deserialized data
|
102
|
+
def _deserialize(type, value)
|
103
|
+
case type.to_sym
|
104
|
+
when :DateTime
|
105
|
+
DateTime.parse(value)
|
106
|
+
when :Date
|
107
|
+
Date.parse(value)
|
108
|
+
when :String
|
109
|
+
value.to_s
|
110
|
+
when :Integer
|
111
|
+
value.to_i
|
112
|
+
when :Float
|
113
|
+
value.to_f
|
114
|
+
when :BOOLEAN
|
115
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
116
|
+
true
|
117
|
+
else
|
118
|
+
false
|
119
|
+
end
|
120
|
+
when :Object
|
121
|
+
# generic object (usually a Hash), return directly
|
122
|
+
value
|
123
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
124
|
+
inner_type = Regexp.last_match[:inner_type]
|
125
|
+
value.map { |v| _deserialize(inner_type, v) }
|
126
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
127
|
+
k_type = Regexp.last_match[:k_type]
|
128
|
+
v_type = Regexp.last_match[:v_type]
|
129
|
+
{}.tap do |hash|
|
130
|
+
value.each do |k, v|
|
131
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
else # model
|
135
|
+
temp_model = DocuSign_Admin.const_get(type).new
|
136
|
+
temp_model.build_from_hash(value)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# Returns the string representation of the object
|
141
|
+
# @return [String] String presentation of the object
|
142
|
+
def to_s
|
143
|
+
to_hash.to_s
|
144
|
+
end
|
145
|
+
|
146
|
+
# to_body is an alias to to_hash (backward compatibility)
|
147
|
+
# @return [Hash] Returns the object in the form of hash
|
148
|
+
def to_body
|
149
|
+
to_hash
|
150
|
+
end
|
151
|
+
|
152
|
+
# Returns the object in the form of hash
|
153
|
+
# @return [Hash] Returns the object in the form of hash
|
154
|
+
def to_hash
|
155
|
+
hash = {}
|
156
|
+
self.class.attribute_map.each_pair do |attr, param|
|
157
|
+
value = self.send(attr)
|
158
|
+
next if value.nil?
|
159
|
+
hash[param] = _to_hash(value)
|
160
|
+
end
|
161
|
+
hash
|
162
|
+
end
|
163
|
+
|
164
|
+
# Outputs non-array value in the form of hash
|
165
|
+
# For object, use to_hash. Otherwise, just return the value
|
166
|
+
# @param [Object] value Any valid value
|
167
|
+
# @return [Hash] Returns the value in the form of hash
|
168
|
+
def _to_hash(value)
|
169
|
+
if value.is_a?(Array)
|
170
|
+
value.compact.map { |v| _to_hash(v) }
|
171
|
+
elsif value.is_a?(Hash)
|
172
|
+
{}.tap do |hash|
|
173
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
174
|
+
end
|
175
|
+
elsif value.respond_to? :to_hash
|
176
|
+
value.to_hash
|
177
|
+
else
|
178
|
+
value
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
end
|