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