purecloudplatformclientv2 27.1.0 → 28.0.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/AdditionalMessage.md +13 -0
- data/docs/AnalyticsParticipant.md +1 -0
- data/docs/ArchitectApi.md +40 -28
- data/docs/Attachment.md +5 -5
- data/docs/ConversationNotificationAttachment.md +18 -0
- data/docs/ConversationNotificationDraftAttachments.md +18 -0
- data/docs/ConversationNotificationEmail.md +1 -0
- data/docs/ConversationNotificationEmails.md +1 -0
- data/docs/ConversationsApi.md +964 -198
- data/docs/DataTable.md +17 -0
- data/docs/DataTableRowEntityListing.md +22 -0
- data/docs/DataTablesDomainEntityListing.md +22 -0
- data/docs/Document.md +1 -1
- data/docs/DomainEdgeSoftwareVersionDto.md +1 -1
- data/docs/DomainOrganizationRole.md +1 -1
- data/docs/DomainOrganizationRoleCreate.md +1 -1
- data/docs/DomainOrganizationRoleUpdate.md +1 -1
- data/docs/Email.md +1 -0
- data/docs/EmailConversationNotificationAttachment.md +18 -0
- data/docs/EmailConversationNotificationEmailMediaParticipant.md +1 -0
- data/docs/EmailConversationNotificationParticipants.md +1 -0
- data/docs/EmailMediaParticipant.md +1 -0
- data/docs/FaxDocument.md +1 -1
- data/docs/JsonNode.md +4 -4
- data/docs/MessageConversation.md +17 -0
- data/docs/MessageConversationEntityListing.md +22 -0
- data/docs/MessageData.md +25 -0
- data/docs/MessageMediaParticipant.md +44 -0
- data/docs/Question.md +1 -1
- data/docs/Recipient.md +20 -0
- data/docs/RecipientListing.md +22 -0
- data/docs/RoutingApi.md +632 -0
- data/docs/SMSAvailablePhoneNumberEntityListing.md +13 -0
- data/docs/SmsAddressProvision.md +21 -0
- data/docs/SmsAvailablePhoneNumber.md +22 -0
- data/docs/SmsPhoneNumber.md +25 -0
- data/docs/SmsPhoneNumberEntityListing.md +22 -0
- data/docs/SmsPhoneNumberProvision.md +18 -0
- data/docs/TextMessageListing.md +22 -0
- data/lib/purecloudplatformclientv2.rb +20 -0
- data/lib/purecloudplatformclientv2/api/architect_api.rb +108 -34
- data/lib/purecloudplatformclientv2/api/conversations_api.rb +1247 -317
- data/lib/purecloudplatformclientv2/api/routing_api.rb +829 -43
- data/lib/purecloudplatformclientv2/api_client.rb +1 -1
- data/lib/purecloudplatformclientv2/models/additional_message.rb +207 -0
- data/lib/purecloudplatformclientv2/models/aggregate_metric_data.rb +2 -2
- data/lib/purecloudplatformclientv2/models/analytics_participant.rb +41 -1
- data/lib/purecloudplatformclientv2/models/analytics_query_predicate.rb +4 -4
- data/lib/purecloudplatformclientv2/models/attachment.rb +5 -0
- data/lib/purecloudplatformclientv2/models/conversation_notification_attachment.rb +326 -0
- data/lib/purecloudplatformclientv2/models/conversation_notification_draft_attachments.rb +326 -0
- data/lib/purecloudplatformclientv2/models/conversation_notification_email.rb +28 -1
- data/lib/purecloudplatformclientv2/models/conversation_notification_emails.rb +28 -1
- data/lib/purecloudplatformclientv2/models/data_table.rb +306 -0
- data/lib/purecloudplatformclientv2/models/data_table_row_entity_listing.rb +428 -0
- data/lib/purecloudplatformclientv2/models/data_tables_domain_entity_listing.rb +428 -0
- data/lib/purecloudplatformclientv2/models/document.rb +12 -12
- data/lib/purecloudplatformclientv2/models/domain_edge_software_version_dto.rb +12 -12
- 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/email.rb +32 -4
- data/lib/purecloudplatformclientv2/models/email_conversation_notification_attachment.rb +326 -0
- data/lib/purecloudplatformclientv2/models/email_conversation_notification_email_media_participant.rb +31 -4
- data/lib/purecloudplatformclientv2/models/email_conversation_notification_participants.rb +31 -4
- data/lib/purecloudplatformclientv2/models/email_media_participant.rb +32 -4
- data/lib/purecloudplatformclientv2/models/fax_document.rb +12 -12
- data/lib/purecloudplatformclientv2/models/json_node.rb +72 -72
- data/lib/purecloudplatformclientv2/models/message_conversation.rb +309 -0
- data/lib/purecloudplatformclientv2/models/message_conversation_entity_listing.rb +428 -0
- data/lib/purecloudplatformclientv2/models/message_data.rb +572 -0
- data/lib/purecloudplatformclientv2/models/message_media_participant.rb +1068 -0
- data/lib/purecloudplatformclientv2/models/question.rb +13 -13
- data/lib/purecloudplatformclientv2/models/recipient.rb +383 -0
- data/lib/purecloudplatformclientv2/models/recipient_listing.rb +428 -0
- data/lib/purecloudplatformclientv2/models/sms_address_provision.rb +440 -0
- data/lib/purecloudplatformclientv2/models/sms_available_phone_number.rb +465 -0
- data/lib/purecloudplatformclientv2/models/sms_available_phone_number_entity_listing.rb +203 -0
- data/lib/purecloudplatformclientv2/models/sms_phone_number.rb +546 -0
- data/lib/purecloudplatformclientv2/models/sms_phone_number_entity_listing.rb +428 -0
- data/lib/purecloudplatformclientv2/models/sms_phone_number_provision.rb +360 -0
- data/lib/purecloudplatformclientv2/models/text_message_listing.rb +428 -0
- data/lib/purecloudplatformclientv2/version.rb +1 -1
- metadata +42 -2
|
@@ -0,0 +1,572 @@
|
|
|
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
|
+
class MessageData
|
|
21
|
+
# The globally unique identifier for the object.
|
|
22
|
+
attr_accessor :id
|
|
23
|
+
|
|
24
|
+
attr_accessor :name
|
|
25
|
+
|
|
26
|
+
# The unique identifier of the message from provider
|
|
27
|
+
attr_accessor :provider_message_id
|
|
28
|
+
|
|
29
|
+
# The time when the message was received or sent. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ
|
|
30
|
+
attr_accessor :timestamp
|
|
31
|
+
|
|
32
|
+
# The sender of the text message.
|
|
33
|
+
attr_accessor :from_address
|
|
34
|
+
|
|
35
|
+
# The recipient of the text message.
|
|
36
|
+
attr_accessor :to_address
|
|
37
|
+
|
|
38
|
+
# The direction of the message.
|
|
39
|
+
attr_accessor :direction
|
|
40
|
+
|
|
41
|
+
# Type of text messenger.
|
|
42
|
+
attr_accessor :messenger_type
|
|
43
|
+
|
|
44
|
+
# The body of the text message.
|
|
45
|
+
attr_accessor :text_body
|
|
46
|
+
|
|
47
|
+
# The status of the message.
|
|
48
|
+
attr_accessor :status
|
|
49
|
+
|
|
50
|
+
# The media details associated to a message.
|
|
51
|
+
attr_accessor :media
|
|
52
|
+
|
|
53
|
+
# User who sent this message.
|
|
54
|
+
attr_accessor :created_by
|
|
55
|
+
|
|
56
|
+
# The URI for this object
|
|
57
|
+
attr_accessor :self_uri
|
|
58
|
+
|
|
59
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
60
|
+
def self.attribute_map
|
|
61
|
+
{
|
|
62
|
+
|
|
63
|
+
:'id' => :'id',
|
|
64
|
+
|
|
65
|
+
:'name' => :'name',
|
|
66
|
+
|
|
67
|
+
:'provider_message_id' => :'providerMessageId',
|
|
68
|
+
|
|
69
|
+
:'timestamp' => :'timestamp',
|
|
70
|
+
|
|
71
|
+
:'from_address' => :'fromAddress',
|
|
72
|
+
|
|
73
|
+
:'to_address' => :'toAddress',
|
|
74
|
+
|
|
75
|
+
:'direction' => :'direction',
|
|
76
|
+
|
|
77
|
+
:'messenger_type' => :'messengerType',
|
|
78
|
+
|
|
79
|
+
:'text_body' => :'textBody',
|
|
80
|
+
|
|
81
|
+
:'status' => :'status',
|
|
82
|
+
|
|
83
|
+
:'media' => :'media',
|
|
84
|
+
|
|
85
|
+
:'created_by' => :'createdBy',
|
|
86
|
+
|
|
87
|
+
:'self_uri' => :'selfUri'
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Attribute type mapping.
|
|
93
|
+
def self.swagger_types
|
|
94
|
+
{
|
|
95
|
+
|
|
96
|
+
:'id' => :'String',
|
|
97
|
+
|
|
98
|
+
:'name' => :'String',
|
|
99
|
+
|
|
100
|
+
:'provider_message_id' => :'String',
|
|
101
|
+
|
|
102
|
+
:'timestamp' => :'DateTime',
|
|
103
|
+
|
|
104
|
+
:'from_address' => :'String',
|
|
105
|
+
|
|
106
|
+
:'to_address' => :'String',
|
|
107
|
+
|
|
108
|
+
:'direction' => :'String',
|
|
109
|
+
|
|
110
|
+
:'messenger_type' => :'String',
|
|
111
|
+
|
|
112
|
+
:'text_body' => :'String',
|
|
113
|
+
|
|
114
|
+
:'status' => :'String',
|
|
115
|
+
|
|
116
|
+
:'media' => :'Array<MessageMedia>',
|
|
117
|
+
|
|
118
|
+
:'created_by' => :'User',
|
|
119
|
+
|
|
120
|
+
:'self_uri' => :'String'
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Initializes the object
|
|
126
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
127
|
+
def initialize(attributes = {})
|
|
128
|
+
return unless attributes.is_a?(Hash)
|
|
129
|
+
|
|
130
|
+
# convert string to symbol for hash key
|
|
131
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
if attributes.has_key?(:'id')
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
self.id = attributes[:'id']
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
if attributes.has_key?(:'name')
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
self.name = attributes[:'name']
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
if attributes.has_key?(:'providerMessageId')
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
self.provider_message_id = attributes[:'providerMessageId']
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
if attributes.has_key?(:'timestamp')
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
self.timestamp = attributes[:'timestamp']
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
if attributes.has_key?(:'fromAddress')
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
self.from_address = attributes[:'fromAddress']
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
if attributes.has_key?(:'toAddress')
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
self.to_address = attributes[:'toAddress']
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
if attributes.has_key?(:'direction')
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
self.direction = attributes[:'direction']
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
if attributes.has_key?(:'messengerType')
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
self.messenger_type = attributes[:'messengerType']
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
if attributes.has_key?(:'textBody')
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
self.text_body = attributes[:'textBody']
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
if attributes.has_key?(:'status')
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
self.status = attributes[:'status']
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
if attributes.has_key?(:'media')
|
|
225
|
+
|
|
226
|
+
if (value = attributes[:'media']).is_a?(Array)
|
|
227
|
+
self.media = value
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
if attributes.has_key?(:'createdBy')
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
self.created_by = attributes[:'createdBy']
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
if attributes.has_key?(:'selfUri')
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
self.self_uri = attributes[:'selfUri']
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
256
|
+
# @return Array for valid properies with the reasons
|
|
257
|
+
def list_invalid_properties
|
|
258
|
+
invalid_properties = Array.new
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
return invalid_properties
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Check to see if the all the properties in the model are valid
|
|
265
|
+
# @return true if the model is valid
|
|
266
|
+
def valid?
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
if @timestamp.nil?
|
|
282
|
+
return false
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
allowed_values = ["inbound", "outbound"]
|
|
300
|
+
if @direction && !allowed_values.include?(@direction)
|
|
301
|
+
return false
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
allowed_values = ["sms", "facebook", "twitter", "line"]
|
|
309
|
+
if @messenger_type && !allowed_values.include?(@messenger_type)
|
|
310
|
+
return false
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
if @text_body.nil?
|
|
317
|
+
return false
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
if @status.nil?
|
|
326
|
+
return false
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
allowed_values = ["queued", "sent", "failed", "received"]
|
|
332
|
+
if @status && !allowed_values.include?(@status)
|
|
333
|
+
return false
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
385
|
+
# @param [Object] direction Object to be assigned
|
|
386
|
+
def direction=(direction)
|
|
387
|
+
allowed_values = ["inbound", "outbound"]
|
|
388
|
+
if direction && !allowed_values.include?(direction)
|
|
389
|
+
fail ArgumentError, "invalid value for 'direction', must be one of #{allowed_values}."
|
|
390
|
+
end
|
|
391
|
+
@direction = direction
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
399
|
+
# @param [Object] messenger_type Object to be assigned
|
|
400
|
+
def messenger_type=(messenger_type)
|
|
401
|
+
allowed_values = ["sms", "facebook", "twitter", "line"]
|
|
402
|
+
if messenger_type && !allowed_values.include?(messenger_type)
|
|
403
|
+
fail ArgumentError, "invalid value for 'messenger_type', must be one of #{allowed_values}."
|
|
404
|
+
end
|
|
405
|
+
@messenger_type = messenger_type
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
418
|
+
# @param [Object] status Object to be assigned
|
|
419
|
+
def status=(status)
|
|
420
|
+
allowed_values = ["queued", "sent", "failed", "received"]
|
|
421
|
+
if status && !allowed_values.include?(status)
|
|
422
|
+
fail ArgumentError, "invalid value for 'status', must be one of #{allowed_values}."
|
|
423
|
+
end
|
|
424
|
+
@status = status
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
# Checks equality by comparing each attribute.
|
|
446
|
+
# @param [Object] Object to be compared
|
|
447
|
+
def ==(o)
|
|
448
|
+
return true if self.equal?(o)
|
|
449
|
+
self.class == o.class &&
|
|
450
|
+
id == o.id &&
|
|
451
|
+
name == o.name &&
|
|
452
|
+
provider_message_id == o.provider_message_id &&
|
|
453
|
+
timestamp == o.timestamp &&
|
|
454
|
+
from_address == o.from_address &&
|
|
455
|
+
to_address == o.to_address &&
|
|
456
|
+
direction == o.direction &&
|
|
457
|
+
messenger_type == o.messenger_type &&
|
|
458
|
+
text_body == o.text_body &&
|
|
459
|
+
status == o.status &&
|
|
460
|
+
media == o.media &&
|
|
461
|
+
created_by == o.created_by &&
|
|
462
|
+
self_uri == o.self_uri
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
# @see the `==` method
|
|
466
|
+
# @param [Object] Object to be compared
|
|
467
|
+
def eql?(o)
|
|
468
|
+
self == o
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
# Calculates hash code according to all attributes.
|
|
472
|
+
# @return [Fixnum] Hash code
|
|
473
|
+
def hash
|
|
474
|
+
[id, name, provider_message_id, timestamp, from_address, to_address, direction, messenger_type, text_body, status, media, created_by, self_uri].hash
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
# build the object from hash
|
|
478
|
+
def build_from_hash(attributes)
|
|
479
|
+
return nil unless attributes.is_a?(Hash)
|
|
480
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
481
|
+
if type =~ /^Array<(.*)>/i
|
|
482
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
483
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
|
484
|
+
else
|
|
485
|
+
#TODO show warning in debug mode
|
|
486
|
+
end
|
|
487
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
488
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
489
|
+
else
|
|
490
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
|
491
|
+
end
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
self
|
|
495
|
+
end
|
|
496
|
+
|
|
497
|
+
def _deserialize(type, value)
|
|
498
|
+
case type.to_sym
|
|
499
|
+
when :DateTime
|
|
500
|
+
DateTime.parse(value)
|
|
501
|
+
when :Date
|
|
502
|
+
Date.parse(value)
|
|
503
|
+
when :String
|
|
504
|
+
value.to_s
|
|
505
|
+
when :Integer
|
|
506
|
+
value.to_i
|
|
507
|
+
when :Float
|
|
508
|
+
value.to_f
|
|
509
|
+
when :BOOLEAN
|
|
510
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
|
511
|
+
true
|
|
512
|
+
else
|
|
513
|
+
false
|
|
514
|
+
end
|
|
515
|
+
when :Object
|
|
516
|
+
# generic object (usually a Hash), return directly
|
|
517
|
+
value
|
|
518
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
519
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
520
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
521
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
|
522
|
+
k_type = Regexp.last_match[:k_type]
|
|
523
|
+
v_type = Regexp.last_match[:v_type]
|
|
524
|
+
{}.tap do |hash|
|
|
525
|
+
value.each do |k, v|
|
|
526
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
527
|
+
end
|
|
528
|
+
end
|
|
529
|
+
else # model
|
|
530
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
|
531
|
+
_model.build_from_hash(value)
|
|
532
|
+
end
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
def to_s
|
|
536
|
+
to_hash.to_s
|
|
537
|
+
end
|
|
538
|
+
|
|
539
|
+
# to_body is an alias to to_body (backward compatibility))
|
|
540
|
+
def to_body
|
|
541
|
+
to_hash
|
|
542
|
+
end
|
|
543
|
+
|
|
544
|
+
# return the object in the form of hash
|
|
545
|
+
def to_hash
|
|
546
|
+
hash = {}
|
|
547
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
548
|
+
value = self.send(attr)
|
|
549
|
+
next if value.nil?
|
|
550
|
+
hash[param] = _to_hash(value)
|
|
551
|
+
end
|
|
552
|
+
hash
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
# Method to output non-array value in the form of hash
|
|
556
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
557
|
+
def _to_hash(value)
|
|
558
|
+
if value.is_a?(Array)
|
|
559
|
+
value.compact.map{ |v| _to_hash(v) }
|
|
560
|
+
elsif value.is_a?(Hash)
|
|
561
|
+
{}.tap do |hash|
|
|
562
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
563
|
+
end
|
|
564
|
+
elsif value.respond_to? :to_hash
|
|
565
|
+
value.to_hash
|
|
566
|
+
else
|
|
567
|
+
value
|
|
568
|
+
end
|
|
569
|
+
end
|
|
570
|
+
|
|
571
|
+
end
|
|
572
|
+
end
|