docusign_esign 3.5.0 → 3.6.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/docusign_esign-2.6.0.gem +0 -0
- data/docusign_esign-2.7.0.rc1.gem +0 -0
- data/docusign_esign-3.5.0.gem +0 -0
- data/lib/docusign_esign.rb +10 -0
- data/lib/docusign_esign/api/accounts_api.rb +556 -4
- data/lib/docusign_esign/api/envelopes_api.rb +56 -2
- data/lib/docusign_esign/models/account_settings_information.rb +20 -1
- data/lib/docusign_esign/models/account_signature.rb +497 -0
- data/lib/docusign_esign/models/account_signature_definition.rb +338 -0
- data/lib/docusign_esign/models/account_signatures_information.rb +187 -0
- data/lib/docusign_esign/models/correct_view_request.rb +14 -4
- data/lib/docusign_esign/models/in_person_signer.rb +11 -1
- data/lib/docusign_esign/models/notary_certificate.rb +869 -0
- data/lib/docusign_esign/models/notary_recipient.rb +1097 -0
- data/lib/docusign_esign/models/notary_seal.rb +983 -0
- data/lib/docusign_esign/models/recipients.rb +13 -1
- data/lib/docusign_esign/models/signature_group.rb +205 -0
- data/lib/docusign_esign/models/signature_group_def.rb +195 -0
- data/lib/docusign_esign/models/signature_user.rb +215 -0
- data/lib/docusign_esign/models/signature_user_def.rb +205 -0
- data/lib/docusign_esign/models/signer.rb +11 -1
- data/lib/docusign_esign/models/tabs.rb +25 -1
- data/lib/docusign_esign/models/template_recipients.rb +13 -1
- data/lib/docusign_esign/models/template_tabs.rb +25 -1
- data/lib/docusign_esign/models/user_account_management_granular_information.rb +20 -1
- data/lib/docusign_esign/models/witness.rb +11 -1
- data/lib/docusign_esign/version.rb +1 -1
- data/tests/Gemfile.lock +1 -1
- metadata +17 -4
@@ -0,0 +1,338 @@
|
|
1
|
+
=begin
|
2
|
+
#DocuSign REST API
|
3
|
+
|
4
|
+
#The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
|
5
|
+
|
6
|
+
OpenAPI spec version: v2.1
|
7
|
+
Contact: devcenter@docusign.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.13-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module DocuSign_eSign
|
16
|
+
class AccountSignatureDefinition
|
17
|
+
attr_accessor :date_stamp_properties
|
18
|
+
|
19
|
+
#
|
20
|
+
attr_accessor :disallow_user_resize_stamp
|
21
|
+
|
22
|
+
#
|
23
|
+
attr_accessor :external_id
|
24
|
+
|
25
|
+
#
|
26
|
+
attr_accessor :image_type
|
27
|
+
|
28
|
+
#
|
29
|
+
attr_accessor :is_default
|
30
|
+
|
31
|
+
#
|
32
|
+
attr_accessor :nrds_id
|
33
|
+
|
34
|
+
#
|
35
|
+
attr_accessor :nrds_last_name
|
36
|
+
|
37
|
+
#
|
38
|
+
attr_accessor :phonetic_name
|
39
|
+
|
40
|
+
#
|
41
|
+
attr_accessor :signature_font
|
42
|
+
|
43
|
+
#
|
44
|
+
attr_accessor :signature_groups
|
45
|
+
|
46
|
+
# Specifies the signature ID associated with the signature name. You can use the signature ID in the URI in place of the signature name, and the value stored in the `signatureName` property in the body is used. This allows the use of special characters (such as \"&\", \"<\", \">\") in a the signature name. Note that with each update to signatures, the returned signature ID might change, so the caller will need to trigger off the signature name to get the new signature ID.
|
47
|
+
attr_accessor :signature_id
|
48
|
+
|
49
|
+
#
|
50
|
+
attr_accessor :signature_initials
|
51
|
+
|
52
|
+
# Specifies the user signature name.
|
53
|
+
attr_accessor :signature_name
|
54
|
+
|
55
|
+
#
|
56
|
+
attr_accessor :signature_users
|
57
|
+
|
58
|
+
#
|
59
|
+
attr_accessor :stamp_format
|
60
|
+
|
61
|
+
#
|
62
|
+
attr_accessor :stamp_size_mm
|
63
|
+
|
64
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
65
|
+
def self.attribute_map
|
66
|
+
{
|
67
|
+
:'date_stamp_properties' => :'dateStampProperties',
|
68
|
+
:'disallow_user_resize_stamp' => :'disallowUserResizeStamp',
|
69
|
+
:'external_id' => :'externalID',
|
70
|
+
:'image_type' => :'imageType',
|
71
|
+
:'is_default' => :'isDefault',
|
72
|
+
:'nrds_id' => :'nrdsId',
|
73
|
+
:'nrds_last_name' => :'nrdsLastName',
|
74
|
+
:'phonetic_name' => :'phoneticName',
|
75
|
+
:'signature_font' => :'signatureFont',
|
76
|
+
:'signature_groups' => :'signatureGroups',
|
77
|
+
:'signature_id' => :'signatureId',
|
78
|
+
:'signature_initials' => :'signatureInitials',
|
79
|
+
:'signature_name' => :'signatureName',
|
80
|
+
:'signature_users' => :'signatureUsers',
|
81
|
+
:'stamp_format' => :'stampFormat',
|
82
|
+
:'stamp_size_mm' => :'stampSizeMM'
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
# Attribute type mapping.
|
87
|
+
def self.swagger_types
|
88
|
+
{
|
89
|
+
:'date_stamp_properties' => :'DateStampProperties',
|
90
|
+
:'disallow_user_resize_stamp' => :'String',
|
91
|
+
:'external_id' => :'String',
|
92
|
+
:'image_type' => :'String',
|
93
|
+
:'is_default' => :'String',
|
94
|
+
:'nrds_id' => :'String',
|
95
|
+
:'nrds_last_name' => :'String',
|
96
|
+
:'phonetic_name' => :'String',
|
97
|
+
:'signature_font' => :'String',
|
98
|
+
:'signature_groups' => :'Array<SignatureGroupDef>',
|
99
|
+
:'signature_id' => :'String',
|
100
|
+
:'signature_initials' => :'String',
|
101
|
+
:'signature_name' => :'String',
|
102
|
+
:'signature_users' => :'Array<SignatureUserDef>',
|
103
|
+
:'stamp_format' => :'String',
|
104
|
+
:'stamp_size_mm' => :'String'
|
105
|
+
}
|
106
|
+
end
|
107
|
+
|
108
|
+
# Initializes the object
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
110
|
+
def initialize(attributes = {})
|
111
|
+
return unless attributes.is_a?(Hash)
|
112
|
+
|
113
|
+
# convert string to symbol for hash key
|
114
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
115
|
+
|
116
|
+
if attributes.has_key?(:'dateStampProperties')
|
117
|
+
self.date_stamp_properties = attributes[:'dateStampProperties']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.has_key?(:'disallowUserResizeStamp')
|
121
|
+
self.disallow_user_resize_stamp = attributes[:'disallowUserResizeStamp']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.has_key?(:'externalID')
|
125
|
+
self.external_id = attributes[:'externalID']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.has_key?(:'imageType')
|
129
|
+
self.image_type = attributes[:'imageType']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.has_key?(:'isDefault')
|
133
|
+
self.is_default = attributes[:'isDefault']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.has_key?(:'nrdsId')
|
137
|
+
self.nrds_id = attributes[:'nrdsId']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.has_key?(:'nrdsLastName')
|
141
|
+
self.nrds_last_name = attributes[:'nrdsLastName']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.has_key?(:'phoneticName')
|
145
|
+
self.phonetic_name = attributes[:'phoneticName']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.has_key?(:'signatureFont')
|
149
|
+
self.signature_font = attributes[:'signatureFont']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.has_key?(:'signatureGroups')
|
153
|
+
if (value = attributes[:'signatureGroups']).is_a?(Array)
|
154
|
+
self.signature_groups = value
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.has_key?(:'signatureId')
|
159
|
+
self.signature_id = attributes[:'signatureId']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.has_key?(:'signatureInitials')
|
163
|
+
self.signature_initials = attributes[:'signatureInitials']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.has_key?(:'signatureName')
|
167
|
+
self.signature_name = attributes[:'signatureName']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.has_key?(:'signatureUsers')
|
171
|
+
if (value = attributes[:'signatureUsers']).is_a?(Array)
|
172
|
+
self.signature_users = value
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
if attributes.has_key?(:'stampFormat')
|
177
|
+
self.stamp_format = attributes[:'stampFormat']
|
178
|
+
end
|
179
|
+
|
180
|
+
if attributes.has_key?(:'stampSizeMM')
|
181
|
+
self.stamp_size_mm = attributes[:'stampSizeMM']
|
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
|
+
invalid_properties
|
190
|
+
end
|
191
|
+
|
192
|
+
# Check to see if the all the properties in the model are valid
|
193
|
+
# @return true if the model is valid
|
194
|
+
def valid?
|
195
|
+
true
|
196
|
+
end
|
197
|
+
|
198
|
+
# Checks equality by comparing each attribute.
|
199
|
+
# @param [Object] Object to be compared
|
200
|
+
def ==(o)
|
201
|
+
return true if self.equal?(o)
|
202
|
+
self.class == o.class &&
|
203
|
+
date_stamp_properties == o.date_stamp_properties &&
|
204
|
+
disallow_user_resize_stamp == o.disallow_user_resize_stamp &&
|
205
|
+
external_id == o.external_id &&
|
206
|
+
image_type == o.image_type &&
|
207
|
+
is_default == o.is_default &&
|
208
|
+
nrds_id == o.nrds_id &&
|
209
|
+
nrds_last_name == o.nrds_last_name &&
|
210
|
+
phonetic_name == o.phonetic_name &&
|
211
|
+
signature_font == o.signature_font &&
|
212
|
+
signature_groups == o.signature_groups &&
|
213
|
+
signature_id == o.signature_id &&
|
214
|
+
signature_initials == o.signature_initials &&
|
215
|
+
signature_name == o.signature_name &&
|
216
|
+
signature_users == o.signature_users &&
|
217
|
+
stamp_format == o.stamp_format &&
|
218
|
+
stamp_size_mm == o.stamp_size_mm
|
219
|
+
end
|
220
|
+
|
221
|
+
# @see the `==` method
|
222
|
+
# @param [Object] Object to be compared
|
223
|
+
def eql?(o)
|
224
|
+
self == o
|
225
|
+
end
|
226
|
+
|
227
|
+
# Calculates hash code according to all attributes.
|
228
|
+
# @return [Fixnum] Hash code
|
229
|
+
def hash
|
230
|
+
[date_stamp_properties, disallow_user_resize_stamp, external_id, image_type, is_default, nrds_id, nrds_last_name, phonetic_name, signature_font, signature_groups, signature_id, signature_initials, signature_name, signature_users, stamp_format, stamp_size_mm].hash
|
231
|
+
end
|
232
|
+
|
233
|
+
# Builds the object from hash
|
234
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
235
|
+
# @return [Object] Returns the model itself
|
236
|
+
def build_from_hash(attributes)
|
237
|
+
return nil unless attributes.is_a?(Hash)
|
238
|
+
self.class.swagger_types.each_pair do |key, type|
|
239
|
+
if type =~ /\AArray<(.*)>/i
|
240
|
+
# check to ensure the input is an array given that the attribute
|
241
|
+
# is documented as an array but the input is not
|
242
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
243
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
244
|
+
end
|
245
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
246
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
247
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
248
|
+
end
|
249
|
+
|
250
|
+
self
|
251
|
+
end
|
252
|
+
|
253
|
+
# Deserializes the data based on type
|
254
|
+
# @param string type Data type
|
255
|
+
# @param string value Value to be deserialized
|
256
|
+
# @return [Object] Deserialized data
|
257
|
+
def _deserialize(type, value)
|
258
|
+
case type.to_sym
|
259
|
+
when :DateTime
|
260
|
+
DateTime.parse(value)
|
261
|
+
when :Date
|
262
|
+
Date.parse(value)
|
263
|
+
when :String
|
264
|
+
value.to_s
|
265
|
+
when :Integer
|
266
|
+
value.to_i
|
267
|
+
when :Float
|
268
|
+
value.to_f
|
269
|
+
when :BOOLEAN
|
270
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
271
|
+
true
|
272
|
+
else
|
273
|
+
false
|
274
|
+
end
|
275
|
+
when :Object
|
276
|
+
# generic object (usually a Hash), return directly
|
277
|
+
value
|
278
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
279
|
+
inner_type = Regexp.last_match[:inner_type]
|
280
|
+
value.map { |v| _deserialize(inner_type, v) }
|
281
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
282
|
+
k_type = Regexp.last_match[:k_type]
|
283
|
+
v_type = Regexp.last_match[:v_type]
|
284
|
+
{}.tap do |hash|
|
285
|
+
value.each do |k, v|
|
286
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
else # model
|
290
|
+
temp_model = DocuSign_eSign.const_get(type).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
|
+
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
=begin
|
2
|
+
#DocuSign REST API
|
3
|
+
|
4
|
+
#The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
|
5
|
+
|
6
|
+
OpenAPI spec version: v2.1
|
7
|
+
Contact: devcenter@docusign.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.13-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module DocuSign_eSign
|
16
|
+
class AccountSignaturesInformation
|
17
|
+
#
|
18
|
+
attr_accessor :account_signatures
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'account_signatures' => :'accountSignatures'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.swagger_types
|
29
|
+
{
|
30
|
+
:'account_signatures' => :'Array<AccountSignature>'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Initializes the object
|
35
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
36
|
+
def initialize(attributes = {})
|
37
|
+
return unless attributes.is_a?(Hash)
|
38
|
+
|
39
|
+
# convert string to symbol for hash key
|
40
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
41
|
+
|
42
|
+
if attributes.has_key?(:'accountSignatures')
|
43
|
+
if (value = attributes[:'accountSignatures']).is_a?(Array)
|
44
|
+
self.account_signatures = value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
50
|
+
# @return Array for valid properties with the reasons
|
51
|
+
def list_invalid_properties
|
52
|
+
invalid_properties = Array.new
|
53
|
+
invalid_properties
|
54
|
+
end
|
55
|
+
|
56
|
+
# Check to see if the all the properties in the model are valid
|
57
|
+
# @return true if the model is valid
|
58
|
+
def valid?
|
59
|
+
true
|
60
|
+
end
|
61
|
+
|
62
|
+
# Checks equality by comparing each attribute.
|
63
|
+
# @param [Object] Object to be compared
|
64
|
+
def ==(o)
|
65
|
+
return true if self.equal?(o)
|
66
|
+
self.class == o.class &&
|
67
|
+
account_signatures == o.account_signatures
|
68
|
+
end
|
69
|
+
|
70
|
+
# @see the `==` method
|
71
|
+
# @param [Object] Object to be compared
|
72
|
+
def eql?(o)
|
73
|
+
self == o
|
74
|
+
end
|
75
|
+
|
76
|
+
# Calculates hash code according to all attributes.
|
77
|
+
# @return [Fixnum] Hash code
|
78
|
+
def hash
|
79
|
+
[account_signatures].hash
|
80
|
+
end
|
81
|
+
|
82
|
+
# Builds the object from hash
|
83
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
84
|
+
# @return [Object] Returns the model itself
|
85
|
+
def build_from_hash(attributes)
|
86
|
+
return nil unless attributes.is_a?(Hash)
|
87
|
+
self.class.swagger_types.each_pair do |key, type|
|
88
|
+
if type =~ /\AArray<(.*)>/i
|
89
|
+
# check to ensure the input is an array given that the attribute
|
90
|
+
# is documented as an array but the input is not
|
91
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
92
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
93
|
+
end
|
94
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
95
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
96
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
97
|
+
end
|
98
|
+
|
99
|
+
self
|
100
|
+
end
|
101
|
+
|
102
|
+
# Deserializes the data based on type
|
103
|
+
# @param string type Data type
|
104
|
+
# @param string value Value to be deserialized
|
105
|
+
# @return [Object] Deserialized data
|
106
|
+
def _deserialize(type, value)
|
107
|
+
case type.to_sym
|
108
|
+
when :DateTime
|
109
|
+
DateTime.parse(value)
|
110
|
+
when :Date
|
111
|
+
Date.parse(value)
|
112
|
+
when :String
|
113
|
+
value.to_s
|
114
|
+
when :Integer
|
115
|
+
value.to_i
|
116
|
+
when :Float
|
117
|
+
value.to_f
|
118
|
+
when :BOOLEAN
|
119
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
120
|
+
true
|
121
|
+
else
|
122
|
+
false
|
123
|
+
end
|
124
|
+
when :Object
|
125
|
+
# generic object (usually a Hash), return directly
|
126
|
+
value
|
127
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
128
|
+
inner_type = Regexp.last_match[:inner_type]
|
129
|
+
value.map { |v| _deserialize(inner_type, v) }
|
130
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
131
|
+
k_type = Regexp.last_match[:k_type]
|
132
|
+
v_type = Regexp.last_match[:v_type]
|
133
|
+
{}.tap do |hash|
|
134
|
+
value.each do |k, v|
|
135
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
else # model
|
139
|
+
temp_model = DocuSign_eSign.const_get(type).new
|
140
|
+
temp_model.build_from_hash(value)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# Returns the string representation of the object
|
145
|
+
# @return [String] String presentation of the object
|
146
|
+
def to_s
|
147
|
+
to_hash.to_s
|
148
|
+
end
|
149
|
+
|
150
|
+
# to_body is an alias to to_hash (backward compatibility)
|
151
|
+
# @return [Hash] Returns the object in the form of hash
|
152
|
+
def to_body
|
153
|
+
to_hash
|
154
|
+
end
|
155
|
+
|
156
|
+
# Returns the object in the form of hash
|
157
|
+
# @return [Hash] Returns the object in the form of hash
|
158
|
+
def to_hash
|
159
|
+
hash = {}
|
160
|
+
self.class.attribute_map.each_pair do |attr, param|
|
161
|
+
value = self.send(attr)
|
162
|
+
next if value.nil?
|
163
|
+
hash[param] = _to_hash(value)
|
164
|
+
end
|
165
|
+
hash
|
166
|
+
end
|
167
|
+
|
168
|
+
# Outputs non-array value in the form of hash
|
169
|
+
# For object, use to_hash. Otherwise, just return the value
|
170
|
+
# @param [Object] value Any valid value
|
171
|
+
# @return [Hash] Returns the value in the form of hash
|
172
|
+
def _to_hash(value)
|
173
|
+
if value.is_a?(Array)
|
174
|
+
value.compact.map { |v| _to_hash(v) }
|
175
|
+
elsif value.is_a?(Hash)
|
176
|
+
{}.tap do |hash|
|
177
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
178
|
+
end
|
179
|
+
elsif value.respond_to? :to_hash
|
180
|
+
value.to_hash
|
181
|
+
else
|
182
|
+
value
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
end
|