purecloudplatformclientv2 35.0.0 → 36.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 (82) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/docs/AdditionalMessage.md +2 -0
  4. data/docs/AlertingApi.md +0 -2
  5. data/docs/AnalyticsApi.md +0 -13
  6. data/docs/ArchitectApi.md +210 -150
  7. data/docs/AttributesApi.md +0 -6
  8. data/docs/AuthorizationApi.md +15 -7
  9. data/docs/BillingApi.md +4 -1
  10. data/docs/CampaignDivisionView.md +1 -1
  11. data/docs/ContentManagementApi.md +0 -38
  12. data/docs/ConversationsApi.md +141 -75
  13. data/docs/CreateQueueRequest.md +1 -1
  14. data/docs/Division.md +15 -0
  15. data/docs/FaxApi.md +0 -6
  16. data/docs/Flow.md +1 -1
  17. data/docs/FlowDivisionView.md +1 -0
  18. data/docs/FreeSeatingConfiguration.md +1 -1
  19. data/docs/GeolocationApi.md +0 -3
  20. data/docs/GreetingsApi.md +0 -16
  21. data/docs/GroupsApi.md +2 -12
  22. data/docs/IdentityProviderApi.md +18 -9
  23. data/docs/IntegrationsApi.md +26 -31
  24. data/docs/LanguagesApi.md +0 -4
  25. data/docs/LicenseApi.md +21 -8
  26. data/docs/LocationsApi.md +0 -3
  27. data/docs/ManagementUnit.md +1 -0
  28. data/docs/MessageData.md +1 -0
  29. data/docs/MessageDetails.md +1 -0
  30. data/docs/MessageMedia.md +3 -0
  31. data/docs/MessageMediaData.md +20 -0
  32. data/docs/MessageSticker.md +14 -0
  33. data/docs/MobileDevicesApi.md +0 -5
  34. data/docs/NotificationsApi.md +0 -7
  35. data/docs/OrganizationApi.md +0 -2
  36. data/docs/OrganizationAuthorizationApi.md +16 -6
  37. data/docs/OutboundApi.md +8 -6
  38. data/docs/OutboundSettings.md +1 -0
  39. data/docs/PresenceApi.md +0 -5
  40. data/docs/QualityApi.md +0 -21
  41. data/docs/Queue.md +1 -1
  42. data/docs/RecordingApi.md +0 -17
  43. data/docs/ResponseManagementApi.md +0 -11
  44. data/docs/RoutingApi.md +93 -9
  45. data/docs/SearchApi.md +0 -14
  46. data/docs/StationsApi.md +0 -3
  47. data/docs/SuggestApi.md +0 -4
  48. data/docs/SurveyForm.md +3 -1
  49. data/docs/TelephonyProvidersEdgeApi.md +4 -16
  50. data/docs/TokensApi.md +0 -2
  51. data/docs/UserQueue.md +1 -1
  52. data/docs/UserRecordingsApi.md +0 -6
  53. data/docs/UsersApi.md +31 -42
  54. data/docs/UtilitiesApi.md +0 -3
  55. data/docs/VoicemailApi.md +8 -21
  56. data/docs/WorkforceManagementApi.md +25 -4
  57. data/lib/purecloudplatformclientv2.rb +3 -0
  58. data/lib/purecloudplatformclientv2/api/architect_api.rb +136 -102
  59. data/lib/purecloudplatformclientv2/api/conversations_api.rb +160 -0
  60. data/lib/purecloudplatformclientv2/api/routing_api.rb +122 -0
  61. data/lib/purecloudplatformclientv2/api/workforce_management_api.rb +22 -0
  62. data/lib/purecloudplatformclientv2/api_client.rb +1 -1
  63. data/lib/purecloudplatformclientv2/models/additional_message.rb +60 -4
  64. data/lib/purecloudplatformclientv2/models/campaign_division_view.rb +1 -1
  65. data/lib/purecloudplatformclientv2/models/create_queue_request.rb +1 -1
  66. data/lib/purecloudplatformclientv2/models/division.rb +253 -0
  67. data/lib/purecloudplatformclientv2/models/event_message.rb +2 -2
  68. data/lib/purecloudplatformclientv2/models/flow.rb +1 -1
  69. data/lib/purecloudplatformclientv2/models/flow_division_view.rb +27 -1
  70. data/lib/purecloudplatformclientv2/models/free_seating_configuration.rb +23 -9
  71. data/lib/purecloudplatformclientv2/models/management_unit.rb +27 -1
  72. data/lib/purecloudplatformclientv2/models/message_data.rb +29 -1
  73. data/lib/purecloudplatformclientv2/models/message_details.rb +32 -4
  74. data/lib/purecloudplatformclientv2/models/message_media.rb +82 -4
  75. data/lib/purecloudplatformclientv2/models/message_media_data.rb +411 -0
  76. data/lib/purecloudplatformclientv2/models/message_sticker.rb +228 -0
  77. data/lib/purecloudplatformclientv2/models/outbound_settings.rb +27 -1
  78. data/lib/purecloudplatformclientv2/models/queue.rb +1 -1
  79. data/lib/purecloudplatformclientv2/models/survey_form.rb +53 -1
  80. data/lib/purecloudplatformclientv2/models/user_queue.rb +1 -1
  81. data/lib/purecloudplatformclientv2/version.rb +1 -1
  82. metadata +8 -2
@@ -24,6 +24,9 @@ module PureCloud
24
24
 
25
25
  attr_accessor :name
26
26
 
27
+ # The division to which this entity belongs.
28
+ attr_accessor :division
29
+
27
30
  # Start day of week for scheduling and forecasting purposes
28
31
  attr_accessor :start_day_of_week
29
32
 
@@ -56,6 +59,8 @@ module PureCloud
56
59
 
57
60
  :'name' => :'name',
58
61
 
62
+ :'division' => :'division',
63
+
59
64
  :'start_day_of_week' => :'startDayOfWeek',
60
65
 
61
66
  :'time_zone' => :'timeZone',
@@ -83,6 +88,8 @@ module PureCloud
83
88
 
84
89
  :'name' => :'String',
85
90
 
91
+ :'division' => :'Division',
92
+
86
93
  :'start_day_of_week' => :'String',
87
94
 
88
95
  :'time_zone' => :'String',
@@ -129,6 +136,15 @@ module PureCloud
129
136
  end
130
137
 
131
138
 
139
+ if attributes.has_key?(:'division')
140
+
141
+
142
+ self.division = attributes[:'division']
143
+
144
+
145
+ end
146
+
147
+
132
148
  if attributes.has_key?(:'startDayOfWeek')
133
149
 
134
150
 
@@ -226,6 +242,10 @@ module PureCloud
226
242
 
227
243
 
228
244
 
245
+
246
+
247
+
248
+
229
249
  allowed_values = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
230
250
  if @start_day_of_week && !allowed_values.include?(@start_day_of_week)
231
251
  return false
@@ -285,6 +305,11 @@ module PureCloud
285
305
 
286
306
 
287
307
 
308
+
309
+
310
+
311
+
312
+
288
313
  # Custom attribute writer method checking allowed values (enum).
289
314
  # @param [Object] start_day_of_week Object to be assigned
290
315
  def start_day_of_week=(start_day_of_week)
@@ -340,6 +365,7 @@ module PureCloud
340
365
  self.class == o.class &&
341
366
  id == o.id &&
342
367
  name == o.name &&
368
+ division == o.division &&
343
369
  start_day_of_week == o.start_day_of_week &&
344
370
  time_zone == o.time_zone &&
345
371
  settings == o.settings &&
@@ -359,7 +385,7 @@ module PureCloud
359
385
  # Calculates hash code according to all attributes.
360
386
  # @return [Fixnum] Hash code
361
387
  def hash
362
- [id, name, start_day_of_week, time_zone, settings, version, date_modified, modified_by, metadata, self_uri].hash
388
+ [id, name, division, start_day_of_week, time_zone, settings, version, date_modified, modified_by, metadata, self_uri].hash
363
389
  end
364
390
 
365
391
  # build the object from hash
@@ -50,6 +50,9 @@ module PureCloud
50
50
  # The media details associated to a message.
51
51
  attr_accessor :media
52
52
 
53
+ # The sticker details associated to a message.
54
+ attr_accessor :stickers
55
+
53
56
  # User who sent this message.
54
57
  attr_accessor :created_by
55
58
 
@@ -82,6 +85,8 @@ module PureCloud
82
85
 
83
86
  :'media' => :'media',
84
87
 
88
+ :'stickers' => :'stickers',
89
+
85
90
  :'created_by' => :'createdBy',
86
91
 
87
92
  :'self_uri' => :'selfUri'
@@ -115,6 +120,8 @@ module PureCloud
115
120
 
116
121
  :'media' => :'Array<MessageMedia>',
117
122
 
123
+ :'stickers' => :'Array<MessageSticker>',
124
+
118
125
  :'created_by' => :'User',
119
126
 
120
127
  :'self_uri' => :'String'
@@ -229,6 +236,17 @@ module PureCloud
229
236
 
230
237
 
231
238
 
239
+ end
240
+
241
+
242
+ if attributes.has_key?(:'stickers')
243
+
244
+ if (value = attributes[:'stickers']).is_a?(Array)
245
+ self.stickers = value
246
+ end
247
+
248
+
249
+
232
250
  end
233
251
 
234
252
 
@@ -347,6 +365,10 @@ module PureCloud
347
365
 
348
366
 
349
367
 
368
+
369
+
370
+
371
+
350
372
  end
351
373
 
352
374
 
@@ -438,6 +460,11 @@ module PureCloud
438
460
 
439
461
 
440
462
 
463
+
464
+
465
+
466
+
467
+
441
468
 
442
469
 
443
470
 
@@ -458,6 +485,7 @@ module PureCloud
458
485
  text_body == o.text_body &&
459
486
  status == o.status &&
460
487
  media == o.media &&
488
+ stickers == o.stickers &&
461
489
  created_by == o.created_by &&
462
490
  self_uri == o.self_uri
463
491
  end
@@ -471,7 +499,7 @@ module PureCloud
471
499
  # Calculates hash code according to all attributes.
472
500
  # @return [Fixnum] Hash code
473
501
  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
502
+ [id, name, provider_message_id, timestamp, from_address, to_address, direction, messenger_type, text_body, status, media, stickers, created_by, self_uri].hash
475
503
  end
476
504
 
477
505
  # build the object from hash
@@ -36,6 +36,9 @@ module PureCloud
36
36
  # The media (images, files, etc) associated with this message, if any
37
37
  attr_accessor :media
38
38
 
39
+ # One or more stickers associated with this message, if any
40
+ attr_accessor :stickers
41
+
39
42
  # Attribute mapping from ruby-style variable name to JSON key.
40
43
  def self.attribute_map
41
44
  {
@@ -50,7 +53,9 @@ module PureCloud
50
53
 
51
54
  :'message_time' => :'messageTime',
52
55
 
53
- :'media' => :'media'
56
+ :'media' => :'media',
57
+
58
+ :'stickers' => :'stickers'
54
59
 
55
60
  }
56
61
  end
@@ -69,7 +74,9 @@ module PureCloud
69
74
 
70
75
  :'message_time' => :'DateTime',
71
76
 
72
- :'media' => :'Array<MessageMedia>'
77
+ :'media' => :'Array<MessageMedia>',
78
+
79
+ :'stickers' => :'Array<MessageSticker>'
73
80
 
74
81
  }
75
82
  end
@@ -139,6 +146,17 @@ module PureCloud
139
146
  end
140
147
 
141
148
 
149
+ if attributes.has_key?(:'stickers')
150
+
151
+ if (value = attributes[:'stickers']).is_a?(Array)
152
+ self.stickers = value
153
+ end
154
+
155
+
156
+
157
+ end
158
+
159
+
142
160
  end
143
161
 
144
162
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -183,6 +201,10 @@ module PureCloud
183
201
 
184
202
 
185
203
 
204
+
205
+
206
+
207
+
186
208
  end
187
209
 
188
210
 
@@ -221,6 +243,11 @@ module PureCloud
221
243
 
222
244
 
223
245
 
246
+
247
+
248
+
249
+
250
+
224
251
 
225
252
 
226
253
 
@@ -235,7 +262,8 @@ module PureCloud
235
262
  message_status == o.message_status &&
236
263
  message_segment_count == o.message_segment_count &&
237
264
  message_time == o.message_time &&
238
- media == o.media
265
+ media == o.media &&
266
+ stickers == o.stickers
239
267
  end
240
268
 
241
269
  # @see the `==` method
@@ -247,7 +275,7 @@ module PureCloud
247
275
  # Calculates hash code according to all attributes.
248
276
  # @return [Fixnum] Hash code
249
277
  def hash
250
- [message_id, message_uri, message_status, message_segment_count, message_time, media].hash
278
+ [message_id, message_uri, message_status, message_segment_count, message_time, media, stickers].hash
251
279
  end
252
280
 
253
281
  # build the object from hash
@@ -24,13 +24,28 @@ module PureCloud
24
24
  # The optional internet media type of the the media object. If null then the media type should be dictated by the url
25
25
  attr_accessor :media_type
26
26
 
27
+ # The optional content length of the the media object, in bytes.
28
+ attr_accessor :content_length_bytes
29
+
30
+ # The optional name of the the media object.
31
+ attr_accessor :name
32
+
33
+ # The optional id of the the media object.
34
+ attr_accessor :id
35
+
27
36
  # Attribute mapping from ruby-style variable name to JSON key.
28
37
  def self.attribute_map
29
38
  {
30
39
 
31
40
  :'url' => :'url',
32
41
 
33
- :'media_type' => :'mediaType'
42
+ :'media_type' => :'mediaType',
43
+
44
+ :'content_length_bytes' => :'contentLengthBytes',
45
+
46
+ :'name' => :'name',
47
+
48
+ :'id' => :'id'
34
49
 
35
50
  }
36
51
  end
@@ -41,7 +56,13 @@ module PureCloud
41
56
 
42
57
  :'url' => :'String',
43
58
 
44
- :'media_type' => :'String'
59
+ :'media_type' => :'String',
60
+
61
+ :'content_length_bytes' => :'Integer',
62
+
63
+ :'name' => :'String',
64
+
65
+ :'id' => :'String'
45
66
 
46
67
  }
47
68
  end
@@ -73,6 +94,33 @@ module PureCloud
73
94
  end
74
95
 
75
96
 
97
+ if attributes.has_key?(:'contentLengthBytes')
98
+
99
+
100
+ self.content_length_bytes = attributes[:'contentLengthBytes']
101
+
102
+
103
+ end
104
+
105
+
106
+ if attributes.has_key?(:'name')
107
+
108
+
109
+ self.name = attributes[:'name']
110
+
111
+
112
+ end
113
+
114
+
115
+ if attributes.has_key?(:'id')
116
+
117
+
118
+ self.id = attributes[:'id']
119
+
120
+
121
+ end
122
+
123
+
76
124
  end
77
125
 
78
126
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -95,6 +143,18 @@ module PureCloud
95
143
 
96
144
 
97
145
 
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
98
158
 
99
159
  end
100
160
 
@@ -103,6 +163,21 @@ module PureCloud
103
163
 
104
164
 
105
165
 
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
106
181
 
107
182
 
108
183
 
@@ -115,7 +190,10 @@ module PureCloud
115
190
  return true if self.equal?(o)
116
191
  self.class == o.class &&
117
192
  url == o.url &&
118
- media_type == o.media_type
193
+ media_type == o.media_type &&
194
+ content_length_bytes == o.content_length_bytes &&
195
+ name == o.name &&
196
+ id == o.id
119
197
  end
120
198
 
121
199
  # @see the `==` method
@@ -127,7 +205,7 @@ module PureCloud
127
205
  # Calculates hash code according to all attributes.
128
206
  # @return [Fixnum] Hash code
129
207
  def hash
130
- [url, media_type].hash
208
+ [url, media_type, content_length_bytes, name, id].hash
131
209
  end
132
210
 
133
211
  # build the object from hash
@@ -0,0 +1,411 @@
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 MessageMediaData
21
+ # The globally unique identifier for the object.
22
+ attr_accessor :id
23
+
24
+ attr_accessor :name
25
+
26
+ # The location of the media, useful for retrieving it
27
+ attr_accessor :url
28
+
29
+ # The optional internet media type of the the media object. If null then the media type should be dictated by the url.
30
+ attr_accessor :media_type
31
+
32
+ # The optional content length of the the media object, in bytes.
33
+ attr_accessor :content_length_bytes
34
+
35
+ # The URL returned to upload an attachment
36
+ attr_accessor :upload_url
37
+
38
+ # The status of the media, indicates if the media is in the process of uploading. If the upload fails, the media becomes invalid
39
+ attr_accessor :status
40
+
41
+ # The URI for this object
42
+ attr_accessor :self_uri
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+
48
+ :'id' => :'id',
49
+
50
+ :'name' => :'name',
51
+
52
+ :'url' => :'url',
53
+
54
+ :'media_type' => :'mediaType',
55
+
56
+ :'content_length_bytes' => :'contentLengthBytes',
57
+
58
+ :'upload_url' => :'uploadUrl',
59
+
60
+ :'status' => :'status',
61
+
62
+ :'self_uri' => :'selfUri'
63
+
64
+ }
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.swagger_types
69
+ {
70
+
71
+ :'id' => :'String',
72
+
73
+ :'name' => :'String',
74
+
75
+ :'url' => :'String',
76
+
77
+ :'media_type' => :'String',
78
+
79
+ :'content_length_bytes' => :'Integer',
80
+
81
+ :'upload_url' => :'String',
82
+
83
+ :'status' => :'String',
84
+
85
+ :'self_uri' => :'String'
86
+
87
+ }
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ return unless attributes.is_a?(Hash)
94
+
95
+ # convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
97
+
98
+
99
+ if attributes.has_key?(:'id')
100
+
101
+
102
+ self.id = attributes[:'id']
103
+
104
+
105
+ end
106
+
107
+
108
+ if attributes.has_key?(:'name')
109
+
110
+
111
+ self.name = attributes[:'name']
112
+
113
+
114
+ end
115
+
116
+
117
+ if attributes.has_key?(:'url')
118
+
119
+
120
+ self.url = attributes[:'url']
121
+
122
+
123
+ end
124
+
125
+
126
+ if attributes.has_key?(:'mediaType')
127
+
128
+
129
+ self.media_type = attributes[:'mediaType']
130
+
131
+
132
+ end
133
+
134
+
135
+ if attributes.has_key?(:'contentLengthBytes')
136
+
137
+
138
+ self.content_length_bytes = attributes[:'contentLengthBytes']
139
+
140
+
141
+ end
142
+
143
+
144
+ if attributes.has_key?(:'uploadUrl')
145
+
146
+
147
+ self.upload_url = attributes[:'uploadUrl']
148
+
149
+
150
+ end
151
+
152
+
153
+ if attributes.has_key?(:'status')
154
+
155
+
156
+ self.status = attributes[:'status']
157
+
158
+
159
+ end
160
+
161
+
162
+ if attributes.has_key?(:'selfUri')
163
+
164
+
165
+ self.self_uri = attributes[:'selfUri']
166
+
167
+
168
+ end
169
+
170
+
171
+ end
172
+
173
+ # Show invalid properties with the reasons. Usually used together with valid?
174
+ # @return Array for valid properies with the reasons
175
+ def list_invalid_properties
176
+ invalid_properties = Array.new
177
+
178
+
179
+ return invalid_properties
180
+ end
181
+
182
+ # Check to see if the all the properties in the model are valid
183
+ # @return true if the model is valid
184
+ def valid?
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+ allowed_values = ["image/png", "image/jpeg", "image/gif"]
201
+ if @media_type && !allowed_values.include?(@media_type)
202
+ return false
203
+ end
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+ allowed_values = ["uploading", "valid", "invalid"]
218
+ if @status && !allowed_values.include?(@status)
219
+ return false
220
+ end
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+ end
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+ # Custom attribute writer method checking allowed values (enum).
248
+ # @param [Object] media_type Object to be assigned
249
+ def media_type=(media_type)
250
+ allowed_values = ["image/png", "image/jpeg", "image/gif"]
251
+ if media_type && !allowed_values.include?(media_type)
252
+ fail ArgumentError, "invalid value for 'media_type', must be one of #{allowed_values}."
253
+ end
254
+ @media_type = media_type
255
+ end
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+ # Custom attribute writer method checking allowed values (enum).
272
+ # @param [Object] status Object to be assigned
273
+ def status=(status)
274
+ allowed_values = ["uploading", "valid", "invalid"]
275
+ if status && !allowed_values.include?(status)
276
+ fail ArgumentError, "invalid value for 'status', must be one of #{allowed_values}."
277
+ end
278
+ @status = status
279
+ end
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+ # Checks equality by comparing each attribute.
290
+ # @param [Object] Object to be compared
291
+ def ==(o)
292
+ return true if self.equal?(o)
293
+ self.class == o.class &&
294
+ id == o.id &&
295
+ name == o.name &&
296
+ url == o.url &&
297
+ media_type == o.media_type &&
298
+ content_length_bytes == o.content_length_bytes &&
299
+ upload_url == o.upload_url &&
300
+ status == o.status &&
301
+ self_uri == o.self_uri
302
+ end
303
+
304
+ # @see the `==` method
305
+ # @param [Object] Object to be compared
306
+ def eql?(o)
307
+ self == o
308
+ end
309
+
310
+ # Calculates hash code according to all attributes.
311
+ # @return [Fixnum] Hash code
312
+ def hash
313
+ [id, name, url, media_type, content_length_bytes, upload_url, status, self_uri].hash
314
+ end
315
+
316
+ # build the object from hash
317
+ def build_from_hash(attributes)
318
+ return nil unless attributes.is_a?(Hash)
319
+ self.class.swagger_types.each_pair do |key, type|
320
+ if type =~ /^Array<(.*)>/i
321
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
322
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
323
+ else
324
+ #TODO show warning in debug mode
325
+ end
326
+ elsif !attributes[self.class.attribute_map[key]].nil?
327
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
328
+ else
329
+ # data not found in attributes(hash), not an issue as the data can be optional
330
+ end
331
+ end
332
+
333
+ self
334
+ end
335
+
336
+ def _deserialize(type, value)
337
+ case type.to_sym
338
+ when :DateTime
339
+ DateTime.parse(value)
340
+ when :Date
341
+ Date.parse(value)
342
+ when :String
343
+ value.to_s
344
+ when :Integer
345
+ value.to_i
346
+ when :Float
347
+ value.to_f
348
+ when :BOOLEAN
349
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
350
+ true
351
+ else
352
+ false
353
+ end
354
+ when :Object
355
+ # generic object (usually a Hash), return directly
356
+ value
357
+ when /\AArray<(?<inner_type>.+)>\z/
358
+ inner_type = Regexp.last_match[:inner_type]
359
+ value.map { |v| _deserialize(inner_type, v) }
360
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
361
+ k_type = Regexp.last_match[:k_type]
362
+ v_type = Regexp.last_match[:v_type]
363
+ {}.tap do |hash|
364
+ value.each do |k, v|
365
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
366
+ end
367
+ end
368
+ else # model
369
+ _model = Object.const_get("PureCloud").const_get(type).new
370
+ _model.build_from_hash(value)
371
+ end
372
+ end
373
+
374
+ def to_s
375
+ to_hash.to_s
376
+ end
377
+
378
+ # to_body is an alias to to_body (backward compatibility))
379
+ def to_body
380
+ to_hash
381
+ end
382
+
383
+ # return the object in the form of hash
384
+ def to_hash
385
+ hash = {}
386
+ self.class.attribute_map.each_pair do |attr, param|
387
+ value = self.send(attr)
388
+ next if value.nil?
389
+ hash[param] = _to_hash(value)
390
+ end
391
+ hash
392
+ end
393
+
394
+ # Method to output non-array value in the form of hash
395
+ # For object, use to_hash. Otherwise, just return the value
396
+ def _to_hash(value)
397
+ if value.is_a?(Array)
398
+ value.compact.map{ |v| _to_hash(v) }
399
+ elsif value.is_a?(Hash)
400
+ {}.tap do |hash|
401
+ value.each { |k, v| hash[k] = _to_hash(v) }
402
+ end
403
+ elsif value.respond_to? :to_hash
404
+ value.to_hash
405
+ else
406
+ value
407
+ end
408
+ end
409
+
410
+ end
411
+ end