purecloudplatformclientv2 14.0.0 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/docs/CertificateDetails.md +1 -1
- data/docs/DomainOrganizationRole.md +1 -1
- data/docs/DomainOrganizationRoleCreate.md +1 -1
- data/docs/DomainOrganizationRoleUpdate.md +1 -1
- data/docs/Edge.md +1 -0
- data/docs/JsonNode.md +2 -2
- data/docs/LicenseApi.md +120 -0
- data/docs/LicenseOrgToggle.md +14 -0
- data/docs/OAuthClient.md +4 -0
- data/docs/OAuthClientListing.md +4 -0
- data/docs/OrgOAuthClient.md +4 -0
- data/docs/OutOfOffice.md +1 -0
- data/docs/UsersApi.md +2 -2
- data/docs/VoicemailApi.md +77 -14
- data/docs/VoicemailMessage.md +1 -0
- data/docs/VoicemailRetentionPolicy.md +14 -0
- data/lib/purecloudplatformclientv2.rb +2 -0
- data/lib/purecloudplatformclientv2/api/license_api.rb +130 -0
- data/lib/purecloudplatformclientv2/api/users_api.rb +2 -2
- data/lib/purecloudplatformclientv2/api/voicemail_api.rb +87 -12
- data/lib/purecloudplatformclientv2/api_client.rb +1 -1
- data/lib/purecloudplatformclientv2/models/activity_code.rb +2 -2
- data/lib/purecloudplatformclientv2/models/certificate_details.rb +13 -13
- data/lib/purecloudplatformclientv2/models/domain_organization_role.rb +12 -12
- data/lib/purecloudplatformclientv2/models/domain_organization_role_create.rb +12 -12
- data/lib/purecloudplatformclientv2/models/domain_organization_role_update.rb +12 -12
- data/lib/purecloudplatformclientv2/models/edge.rb +27 -1
- data/lib/purecloudplatformclientv2/models/json_node.rb +50 -50
- data/lib/purecloudplatformclientv2/models/license_org_toggle.rb +226 -0
- data/lib/purecloudplatformclientv2/models/o_auth_client.rb +105 -1
- data/lib/purecloudplatformclientv2/models/o_auth_client_listing.rb +105 -1
- data/lib/purecloudplatformclientv2/models/org_o_auth_client.rb +105 -1
- data/lib/purecloudplatformclientv2/models/out_of_office.rb +26 -1
- data/lib/purecloudplatformclientv2/models/user_schedule_adherence.rb +4 -4
- data/lib/purecloudplatformclientv2/models/voicemail_message.rb +27 -1
- data/lib/purecloudplatformclientv2/models/voicemail_retention_policy.rb +243 -0
- data/lib/purecloudplatformclientv2/version.rb +1 -1
- metadata +6 -2
@@ -24,6 +24,18 @@ module PureCloud
|
|
24
24
|
# The name of the OAuth client.
|
25
25
|
attr_accessor :name
|
26
26
|
|
27
|
+
# Date this client was created. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ
|
28
|
+
attr_accessor :date_created
|
29
|
+
|
30
|
+
# Date this client was last modified. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ
|
31
|
+
attr_accessor :date_modified
|
32
|
+
|
33
|
+
# User that created this client
|
34
|
+
attr_accessor :created_by
|
35
|
+
|
36
|
+
# User that last modified this client
|
37
|
+
attr_accessor :modified_by
|
38
|
+
|
27
39
|
# The OAuth Grant/Client type supported by this client. Code Authorization Grant/Client type - Preferred client type where the Client ID and Secret are required to create tokens. Used where the secret can be secured. Implicit grant type - Client ID only is required to create tokens. Used in browser and mobile apps where the secret can not be secured. SAML2-Bearer extension grant type - SAML2 assertion provider for user authentication at the token endpoint. Client Credential grant type - Used to created access tokens that are tied only to the client.
|
28
40
|
attr_accessor :authorized_grant_type
|
29
41
|
|
@@ -38,6 +50,14 @@ module PureCloud
|
|
38
50
|
|
39
51
|
:'name' => :'name',
|
40
52
|
|
53
|
+
:'date_created' => :'dateCreated',
|
54
|
+
|
55
|
+
:'date_modified' => :'dateModified',
|
56
|
+
|
57
|
+
:'created_by' => :'createdBy',
|
58
|
+
|
59
|
+
:'modified_by' => :'modifiedBy',
|
60
|
+
|
41
61
|
:'authorized_grant_type' => :'authorizedGrantType',
|
42
62
|
|
43
63
|
:'organization' => :'organization'
|
@@ -53,6 +73,14 @@ module PureCloud
|
|
53
73
|
|
54
74
|
:'name' => :'String',
|
55
75
|
|
76
|
+
:'date_created' => :'DateTime',
|
77
|
+
|
78
|
+
:'date_modified' => :'DateTime',
|
79
|
+
|
80
|
+
:'created_by' => :'UriReference',
|
81
|
+
|
82
|
+
:'modified_by' => :'UriReference',
|
83
|
+
|
56
84
|
:'authorized_grant_type' => :'String',
|
57
85
|
|
58
86
|
:'organization' => :'Entity'
|
@@ -87,6 +115,42 @@ module PureCloud
|
|
87
115
|
end
|
88
116
|
|
89
117
|
|
118
|
+
if attributes.has_key?(:'dateCreated')
|
119
|
+
|
120
|
+
|
121
|
+
self.date_created = attributes[:'dateCreated']
|
122
|
+
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
if attributes.has_key?(:'dateModified')
|
128
|
+
|
129
|
+
|
130
|
+
self.date_modified = attributes[:'dateModified']
|
131
|
+
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
if attributes.has_key?(:'createdBy')
|
137
|
+
|
138
|
+
|
139
|
+
self.created_by = attributes[:'createdBy']
|
140
|
+
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
|
145
|
+
if attributes.has_key?(:'modifiedBy')
|
146
|
+
|
147
|
+
|
148
|
+
self.modified_by = attributes[:'modifiedBy']
|
149
|
+
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
|
90
154
|
if attributes.has_key?(:'authorizedGrantType')
|
91
155
|
|
92
156
|
|
@@ -129,6 +193,22 @@ module PureCloud
|
|
129
193
|
return false
|
130
194
|
end
|
131
195
|
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
132
212
|
|
133
213
|
|
134
214
|
|
@@ -164,6 +244,26 @@ module PureCloud
|
|
164
244
|
|
165
245
|
|
166
246
|
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
167
267
|
|
168
268
|
# Custom attribute writer method checking allowed values (enum).
|
169
269
|
# @param [Object] authorized_grant_type Object to be assigned
|
@@ -190,6 +290,10 @@ module PureCloud
|
|
190
290
|
self.class == o.class &&
|
191
291
|
id == o.id &&
|
192
292
|
name == o.name &&
|
293
|
+
date_created == o.date_created &&
|
294
|
+
date_modified == o.date_modified &&
|
295
|
+
created_by == o.created_by &&
|
296
|
+
modified_by == o.modified_by &&
|
193
297
|
authorized_grant_type == o.authorized_grant_type &&
|
194
298
|
organization == o.organization
|
195
299
|
end
|
@@ -203,7 +307,7 @@ module PureCloud
|
|
203
307
|
# Calculates hash code according to all attributes.
|
204
308
|
# @return [Fixnum] Hash code
|
205
309
|
def hash
|
206
|
-
[id, name, authorized_grant_type, organization].hash
|
310
|
+
[id, name, date_created, date_modified, created_by, modified_by, authorized_grant_type, organization].hash
|
207
311
|
end
|
208
312
|
|
209
313
|
# build the object from hash
|
@@ -33,6 +33,8 @@ module PureCloud
|
|
33
33
|
|
34
34
|
attr_accessor :active
|
35
35
|
|
36
|
+
attr_accessor :indefinite
|
37
|
+
|
36
38
|
# The URI for this object
|
37
39
|
attr_accessor :self_uri
|
38
40
|
|
@@ -52,6 +54,8 @@ module PureCloud
|
|
52
54
|
|
53
55
|
:'active' => :'active',
|
54
56
|
|
57
|
+
:'indefinite' => :'indefinite',
|
58
|
+
|
55
59
|
:'self_uri' => :'selfUri'
|
56
60
|
|
57
61
|
}
|
@@ -73,6 +77,8 @@ module PureCloud
|
|
73
77
|
|
74
78
|
:'active' => :'BOOLEAN',
|
75
79
|
|
80
|
+
:'indefinite' => :'BOOLEAN',
|
81
|
+
|
76
82
|
:'self_uri' => :'String'
|
77
83
|
|
78
84
|
}
|
@@ -141,6 +147,15 @@ module PureCloud
|
|
141
147
|
end
|
142
148
|
|
143
149
|
|
150
|
+
if attributes.has_key?(:'indefinite')
|
151
|
+
|
152
|
+
|
153
|
+
self.indefinite = attributes[:'indefinite']
|
154
|
+
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
|
144
159
|
if attributes.has_key?(:'selfUri')
|
145
160
|
|
146
161
|
|
@@ -188,6 +203,10 @@ module PureCloud
|
|
188
203
|
|
189
204
|
|
190
205
|
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
191
210
|
|
192
211
|
|
193
212
|
|
@@ -225,6 +244,11 @@ module PureCloud
|
|
225
244
|
|
226
245
|
|
227
246
|
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
228
252
|
|
229
253
|
|
230
254
|
|
@@ -242,6 +266,7 @@ module PureCloud
|
|
242
266
|
start_date == o.start_date &&
|
243
267
|
end_date == o.end_date &&
|
244
268
|
active == o.active &&
|
269
|
+
indefinite == o.indefinite &&
|
245
270
|
self_uri == o.self_uri
|
246
271
|
end
|
247
272
|
|
@@ -254,7 +279,7 @@ module PureCloud
|
|
254
279
|
# Calculates hash code according to all attributes.
|
255
280
|
# @return [Fixnum] Hash code
|
256
281
|
def hash
|
257
|
-
[id, name, user, start_date, end_date, active, self_uri].hash
|
282
|
+
[id, name, user, start_date, end_date, active, indefinite, self_uri].hash
|
258
283
|
end
|
259
284
|
|
260
285
|
# build the object from hash
|
@@ -297,7 +297,7 @@ module PureCloud
|
|
297
297
|
|
298
298
|
|
299
299
|
|
300
|
-
allowed_values = ["OnQueueWork", "Break", "Meal", "Meeting", "OffQueueWork", "TimeOff", "Training", "Unavailable"]
|
300
|
+
allowed_values = ["OnQueueWork", "Break", "Meal", "Meeting", "OffQueueWork", "TimeOff", "Training", "Unavailable", "Unscheduled"]
|
301
301
|
if @scheduled_activity_category && !allowed_values.include?(@scheduled_activity_category)
|
302
302
|
return false
|
303
303
|
end
|
@@ -328,7 +328,7 @@ module PureCloud
|
|
328
328
|
|
329
329
|
|
330
330
|
|
331
|
-
allowed_values = ["OnQueueWork", "Break", "Meal", "Meeting", "OffQueueWork", "TimeOff", "Training", "Unavailable"]
|
331
|
+
allowed_values = ["OnQueueWork", "Break", "Meal", "Meeting", "OffQueueWork", "TimeOff", "Training", "Unavailable", "Unscheduled"]
|
332
332
|
if @actual_activity_category && !allowed_values.include?(@actual_activity_category)
|
333
333
|
return false
|
334
334
|
end
|
@@ -392,7 +392,7 @@ module PureCloud
|
|
392
392
|
# Custom attribute writer method checking allowed values (enum).
|
393
393
|
# @param [Object] scheduled_activity_category Object to be assigned
|
394
394
|
def scheduled_activity_category=(scheduled_activity_category)
|
395
|
-
allowed_values = ["OnQueueWork", "Break", "Meal", "Meeting", "OffQueueWork", "TimeOff", "Training", "Unavailable"]
|
395
|
+
allowed_values = ["OnQueueWork", "Break", "Meal", "Meeting", "OffQueueWork", "TimeOff", "Training", "Unavailable", "Unscheduled"]
|
396
396
|
if scheduled_activity_category && !allowed_values.include?(scheduled_activity_category)
|
397
397
|
fail ArgumentError, "invalid value for 'scheduled_activity_category', must be one of #{allowed_values}."
|
398
398
|
end
|
@@ -439,7 +439,7 @@ module PureCloud
|
|
439
439
|
# Custom attribute writer method checking allowed values (enum).
|
440
440
|
# @param [Object] actual_activity_category Object to be assigned
|
441
441
|
def actual_activity_category=(actual_activity_category)
|
442
|
-
allowed_values = ["OnQueueWork", "Break", "Meal", "Meeting", "OffQueueWork", "TimeOff", "Training", "Unavailable"]
|
442
|
+
allowed_values = ["OnQueueWork", "Break", "Meal", "Meeting", "OffQueueWork", "TimeOff", "Training", "Unavailable", "Unscheduled"]
|
443
443
|
if actual_activity_category && !allowed_values.include?(actual_activity_category)
|
444
444
|
fail ArgumentError, "invalid value for 'actual_activity_category', must be one of #{allowed_values}."
|
445
445
|
end
|
@@ -69,6 +69,9 @@ module PureCloud
|
|
69
69
|
# Represents where this voicemail has been copied to
|
70
70
|
attr_accessor :copied_to
|
71
71
|
|
72
|
+
# The retention policy for this voicemail
|
73
|
+
attr_accessor :retention_policy
|
74
|
+
|
72
75
|
# The URI for this object
|
73
76
|
attr_accessor :self_uri
|
74
77
|
|
@@ -110,6 +113,8 @@ module PureCloud
|
|
110
113
|
|
111
114
|
:'copied_to' => :'copiedTo',
|
112
115
|
|
116
|
+
:'retention_policy' => :'retentionPolicy',
|
117
|
+
|
113
118
|
:'self_uri' => :'selfUri'
|
114
119
|
|
115
120
|
}
|
@@ -153,6 +158,8 @@ module PureCloud
|
|
153
158
|
|
154
159
|
:'copied_to' => :'Array<VoicemailCopyRecord>',
|
155
160
|
|
161
|
+
:'retention_policy' => :'VoicemailRetentionPolicy',
|
162
|
+
|
156
163
|
:'self_uri' => :'String'
|
157
164
|
|
158
165
|
}
|
@@ -322,6 +329,15 @@ module PureCloud
|
|
322
329
|
end
|
323
330
|
|
324
331
|
|
332
|
+
if attributes.has_key?(:'retentionPolicy')
|
333
|
+
|
334
|
+
|
335
|
+
self.retention_policy = attributes[:'retentionPolicy']
|
336
|
+
|
337
|
+
|
338
|
+
end
|
339
|
+
|
340
|
+
|
325
341
|
if attributes.has_key?(:'selfUri')
|
326
342
|
|
327
343
|
|
@@ -413,6 +429,10 @@ module PureCloud
|
|
413
429
|
|
414
430
|
|
415
431
|
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
416
436
|
|
417
437
|
|
418
438
|
|
@@ -505,6 +525,11 @@ module PureCloud
|
|
505
525
|
|
506
526
|
|
507
527
|
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
|
508
533
|
|
509
534
|
|
510
535
|
|
@@ -533,6 +558,7 @@ module PureCloud
|
|
533
558
|
queue == o.queue &&
|
534
559
|
copied_from == o.copied_from &&
|
535
560
|
copied_to == o.copied_to &&
|
561
|
+
retention_policy == o.retention_policy &&
|
536
562
|
self_uri == o.self_uri
|
537
563
|
end
|
538
564
|
|
@@ -545,7 +571,7 @@ module PureCloud
|
|
545
571
|
# Calculates hash code according to all attributes.
|
546
572
|
# @return [Fixnum] Hash code
|
547
573
|
def hash
|
548
|
-
[id, conversation, read, audio_recording_duration_seconds, audio_recording_size_bytes, created_date, modified_date, caller_address, caller_name, caller_user, deleted, note, user, group, queue, copied_from, copied_to, self_uri].hash
|
574
|
+
[id, conversation, read, audio_recording_duration_seconds, audio_recording_size_bytes, created_date, modified_date, caller_address, caller_name, caller_user, deleted, note, user, group, queue, copied_from, copied_to, retention_policy, self_uri].hash
|
549
575
|
end
|
550
576
|
|
551
577
|
# build the object from hash
|
@@ -0,0 +1,243 @@
|
|
1
|
+
=begin
|
2
|
+
PureCloud Platform API
|
3
|
+
|
4
|
+
With the PureCloud Platform API, you can control all aspects of your PureCloud environment. With the APIs you can access the system configuration, manage conversations and more.
|
5
|
+
|
6
|
+
OpenAPI spec version: v2
|
7
|
+
Contact: DeveloperEvangelists@genesys.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
|
10
|
+
License: ININ
|
11
|
+
http://www.inin.com
|
12
|
+
|
13
|
+
Terms of Service: https://developer.mypurecloud.com/tos
|
14
|
+
|
15
|
+
=end
|
16
|
+
|
17
|
+
require 'date'
|
18
|
+
|
19
|
+
module PureCloud
|
20
|
+
# Governs how the voicemail is retained when the deleted property is set to true
|
21
|
+
class VoicemailRetentionPolicy
|
22
|
+
# The retention policy type
|
23
|
+
attr_accessor :voicemail_retention_policy_type
|
24
|
+
|
25
|
+
# If retentionPolicyType == RETAIN_WITH_TTL, then this value represents the number of days for the TTL
|
26
|
+
attr_accessor :number_of_days
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
|
32
|
+
:'voicemail_retention_policy_type' => :'voicemailRetentionPolicyType',
|
33
|
+
|
34
|
+
:'number_of_days' => :'numberOfDays'
|
35
|
+
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.swagger_types
|
41
|
+
{
|
42
|
+
|
43
|
+
:'voicemail_retention_policy_type' => :'String',
|
44
|
+
|
45
|
+
:'number_of_days' => :'Integer'
|
46
|
+
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
57
|
+
|
58
|
+
|
59
|
+
if attributes.has_key?(:'voicemailRetentionPolicyType')
|
60
|
+
|
61
|
+
|
62
|
+
self.voicemail_retention_policy_type = attributes[:'voicemailRetentionPolicyType']
|
63
|
+
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
if attributes.has_key?(:'numberOfDays')
|
69
|
+
|
70
|
+
|
71
|
+
self.number_of_days = attributes[:'numberOfDays']
|
72
|
+
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properies with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
invalid_properties = Array.new
|
83
|
+
|
84
|
+
|
85
|
+
return invalid_properties
|
86
|
+
end
|
87
|
+
|
88
|
+
# Check to see if the all the properties in the model are valid
|
89
|
+
# @return true if the model is valid
|
90
|
+
def valid?
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
allowed_values = ["RETAIN_INDEFINITELY", "RETAIN_WITH_TTL", "IMMEDIATE_DELETE"]
|
95
|
+
if @voicemail_retention_policy_type && !allowed_values.include?(@voicemail_retention_policy_type)
|
96
|
+
return false
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
# Custom attribute writer method checking allowed values (enum).
|
110
|
+
# @param [Object] voicemail_retention_policy_type Object to be assigned
|
111
|
+
def voicemail_retention_policy_type=(voicemail_retention_policy_type)
|
112
|
+
allowed_values = ["RETAIN_INDEFINITELY", "RETAIN_WITH_TTL", "IMMEDIATE_DELETE"]
|
113
|
+
if voicemail_retention_policy_type && !allowed_values.include?(voicemail_retention_policy_type)
|
114
|
+
fail ArgumentError, "invalid value for 'voicemail_retention_policy_type', must be one of #{allowed_values}."
|
115
|
+
end
|
116
|
+
@voicemail_retention_policy_type = voicemail_retention_policy_type
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
# Checks equality by comparing each attribute.
|
128
|
+
# @param [Object] Object to be compared
|
129
|
+
def ==(o)
|
130
|
+
return true if self.equal?(o)
|
131
|
+
self.class == o.class &&
|
132
|
+
voicemail_retention_policy_type == o.voicemail_retention_policy_type &&
|
133
|
+
number_of_days == o.number_of_days
|
134
|
+
end
|
135
|
+
|
136
|
+
# @see the `==` method
|
137
|
+
# @param [Object] Object to be compared
|
138
|
+
def eql?(o)
|
139
|
+
self == o
|
140
|
+
end
|
141
|
+
|
142
|
+
# Calculates hash code according to all attributes.
|
143
|
+
# @return [Fixnum] Hash code
|
144
|
+
def hash
|
145
|
+
[voicemail_retention_policy_type, number_of_days].hash
|
146
|
+
end
|
147
|
+
|
148
|
+
# build the object from hash
|
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
|
+
if type =~ /^Array<(.*)>/i
|
153
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
154
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
155
|
+
else
|
156
|
+
#TODO show warning in debug mode
|
157
|
+
end
|
158
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
159
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
160
|
+
else
|
161
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
self
|
166
|
+
end
|
167
|
+
|
168
|
+
def _deserialize(type, value)
|
169
|
+
case type.to_sym
|
170
|
+
when :DateTime
|
171
|
+
DateTime.parse(value)
|
172
|
+
when :Date
|
173
|
+
Date.parse(value)
|
174
|
+
when :String
|
175
|
+
value.to_s
|
176
|
+
when :Integer
|
177
|
+
value.to_i
|
178
|
+
when :Float
|
179
|
+
value.to_f
|
180
|
+
when :BOOLEAN
|
181
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
182
|
+
true
|
183
|
+
else
|
184
|
+
false
|
185
|
+
end
|
186
|
+
when :Object
|
187
|
+
# generic object (usually a Hash), return directly
|
188
|
+
value
|
189
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
190
|
+
inner_type = Regexp.last_match[:inner_type]
|
191
|
+
value.map { |v| _deserialize(inner_type, v) }
|
192
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
193
|
+
k_type = Regexp.last_match[:k_type]
|
194
|
+
v_type = Regexp.last_match[:v_type]
|
195
|
+
{}.tap do |hash|
|
196
|
+
value.each do |k, v|
|
197
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
else # model
|
201
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
202
|
+
_model.build_from_hash(value)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
def to_s
|
207
|
+
to_hash.to_s
|
208
|
+
end
|
209
|
+
|
210
|
+
# to_body is an alias to to_body (backward compatibility))
|
211
|
+
def to_body
|
212
|
+
to_hash
|
213
|
+
end
|
214
|
+
|
215
|
+
# return the object in the form of hash
|
216
|
+
def to_hash
|
217
|
+
hash = {}
|
218
|
+
self.class.attribute_map.each_pair do |attr, param|
|
219
|
+
value = self.send(attr)
|
220
|
+
next if value.nil?
|
221
|
+
hash[param] = _to_hash(value)
|
222
|
+
end
|
223
|
+
hash
|
224
|
+
end
|
225
|
+
|
226
|
+
# Method to output non-array value in the form of hash
|
227
|
+
# For object, use to_hash. Otherwise, just return the value
|
228
|
+
def _to_hash(value)
|
229
|
+
if value.is_a?(Array)
|
230
|
+
value.compact.map{ |v| _to_hash(v) }
|
231
|
+
elsif value.is_a?(Hash)
|
232
|
+
{}.tap do |hash|
|
233
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
234
|
+
end
|
235
|
+
elsif value.respond_to? :to_hash
|
236
|
+
value.to_hash
|
237
|
+
else
|
238
|
+
value
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
end
|