purecloudplatformclientv2 92.0.0 → 93.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/docs/AnalyticsEvaluation.md +1 -1
  4. data/docs/AnalyticsSession.md +4 -0
  5. data/docs/ArchitectApi.md +51 -49
  6. data/docs/CoachingApi.md +8 -7
  7. data/docs/CommonCampaign.md +17 -0
  8. data/docs/CommonCampaignDivisionView.md +17 -0
  9. data/docs/CommonCampaignDivisionViewEntityListing.md +22 -0
  10. data/docs/CommonCampaignEntityListing.md +22 -0
  11. data/docs/ConversationAssociation.md +1 -1
  12. data/docs/ConversationEventTopicMessage.md +1 -0
  13. data/docs/ConversationsApi.md +4 -4
  14. data/docs/ExternalContactsApi.md +4 -4
  15. data/docs/HistoricalAdherenceActuals.md +15 -0
  16. data/docs/HistoricalAdherenceDayMetrics.md +23 -0
  17. data/docs/HistoricalAdherenceExceptionInfo.md +21 -0
  18. data/docs/HistoricalAdherenceQueryResult.md +21 -0
  19. data/docs/KnowledgeSearchRequest.md +3 -3
  20. data/docs/MessagingCampaign.md +28 -0
  21. data/docs/MessagingCampaignDivisionView.md +16 -0
  22. data/docs/MessagingCampaignDivisionViewEntityListing.md +22 -0
  23. data/docs/MessagingCampaignEntityListing.md +22 -0
  24. data/docs/ObservationValue.md +3 -1
  25. data/docs/OutboundApi.md +881 -76
  26. data/docs/QueueConversationEventTopicMessage.md +1 -0
  27. data/docs/QueueConversationSocialExpressionEventTopicMessage.md +1 -0
  28. data/docs/QueueConversationVideoEventTopicMessage.md +1 -0
  29. data/docs/ReportingExportJobRequest.md +2 -0
  30. data/docs/ReportingExportJobResponse.md +3 -0
  31. data/docs/SCIMApi.md +96 -108
  32. data/docs/ScimConfigResourceType.md +1 -1
  33. data/docs/ScimUserExtensions.md +2 -2
  34. data/docs/ScimUserRole.md +1 -1
  35. data/docs/ScimUserRoutingLanguage.md +2 -2
  36. data/docs/ScimUserRoutingSkill.md +2 -2
  37. data/docs/ScimV2CreateUser.md +3 -3
  38. data/docs/ScimV2Group.md +1 -1
  39. data/docs/ScimV2SchemaAttribute.md +11 -11
  40. data/docs/ScimV2SchemaDefinition.md +4 -4
  41. data/docs/ScimV2SchemaListResponse.md +1 -1
  42. data/docs/ScimV2User.md +4 -4
  43. data/docs/SmsConfig.md +15 -0
  44. data/docs/SmsPhoneNumberRef.md +14 -0
  45. data/docs/UserRoutingLanguage.md +3 -3
  46. data/docs/UserRoutingLanguagePost.md +1 -1
  47. data/docs/UserRoutingSkill.md +1 -1
  48. data/docs/VoicemailUserPolicy.md +1 -0
  49. data/docs/WfmBusinessUnitReference.md +14 -0
  50. data/docs/WfmHistoricalAdherenceResponse.md +1 -0
  51. data/docs/WfmHistoricalAdherenceResultWrapper.md +15 -0
  52. data/docs/WfmHistoricalDataUploadRequestStatusTopicDateTime.md +16 -0
  53. data/docs/WfmHistoricalDataUploadRequestStatusTopicHistoricalDataUploadRequestUpdate.md +20 -0
  54. data/docs/WfmScheduleReference.md +16 -0
  55. data/lib/purecloudplatformclientv2.rb +19 -0
  56. data/lib/purecloudplatformclientv2/api/architect_api.rb +15 -6
  57. data/lib/purecloudplatformclientv2/api/coaching_api.rb +10 -9
  58. data/lib/purecloudplatformclientv2/api/conversations_api.rb +4 -4
  59. data/lib/purecloudplatformclientv2/api/external_contacts_api.rb +4 -4
  60. data/lib/purecloudplatformclientv2/api/outbound_api.rb +1215 -155
  61. data/lib/purecloudplatformclientv2/api/scim_api.rb +88 -88
  62. data/lib/purecloudplatformclientv2/api_client.rb +1 -1
  63. data/lib/purecloudplatformclientv2/models/analytics_evaluation.rb +13 -13
  64. data/lib/purecloudplatformclientv2/models/analytics_session.rb +124 -4
  65. data/lib/purecloudplatformclientv2/models/common_campaign.rb +320 -0
  66. data/lib/purecloudplatformclientv2/models/common_campaign_division_view.rb +320 -0
  67. data/lib/purecloudplatformclientv2/models/common_campaign_division_view_entity_listing.rb +428 -0
  68. data/lib/purecloudplatformclientv2/models/common_campaign_entity_listing.rb +428 -0
  69. data/lib/purecloudplatformclientv2/models/conversation_aggregate_query_predicate.rb +2 -2
  70. data/lib/purecloudplatformclientv2/models/conversation_association.rb +1 -1
  71. data/lib/purecloudplatformclientv2/models/conversation_event_topic_message.rb +26 -1
  72. data/lib/purecloudplatformclientv2/models/dependency.rb +2 -2
  73. data/lib/purecloudplatformclientv2/models/dependency_object.rb +2 -2
  74. data/lib/purecloudplatformclientv2/models/event_message.rb +2 -2
  75. data/lib/purecloudplatformclientv2/models/flow_aggregate_query_predicate.rb +2 -2
  76. data/lib/purecloudplatformclientv2/models/historical_adherence_actuals.rb +268 -0
  77. data/lib/purecloudplatformclientv2/models/historical_adherence_day_metrics.rb +462 -0
  78. data/lib/purecloudplatformclientv2/models/historical_adherence_exception_info.rb +466 -0
  79. data/lib/purecloudplatformclientv2/models/historical_adherence_query_result.rb +430 -0
  80. data/lib/purecloudplatformclientv2/models/knowledge_search_request.rb +0 -15
  81. data/lib/purecloudplatformclientv2/models/messaging_campaign.rb +621 -0
  82. data/lib/purecloudplatformclientv2/models/messaging_campaign_division_view.rb +279 -0
  83. data/lib/purecloudplatformclientv2/models/messaging_campaign_division_view_entity_listing.rb +428 -0
  84. data/lib/purecloudplatformclientv2/models/messaging_campaign_entity_listing.rb +428 -0
  85. data/lib/purecloudplatformclientv2/models/observation_value.rb +70 -2
  86. data/lib/purecloudplatformclientv2/models/queue_conversation_event_topic_message.rb +26 -1
  87. data/lib/purecloudplatformclientv2/models/queue_conversation_social_expression_event_topic_message.rb +26 -1
  88. data/lib/purecloudplatformclientv2/models/queue_conversation_video_event_topic_message.rb +26 -1
  89. data/lib/purecloudplatformclientv2/models/reporting_export_job_request.rb +53 -1
  90. data/lib/purecloudplatformclientv2/models/reporting_export_job_response.rb +78 -1
  91. data/lib/purecloudplatformclientv2/models/scim_config_resource_type.rb +1 -1
  92. data/lib/purecloudplatformclientv2/models/scim_user_extensions.rb +3 -3
  93. data/lib/purecloudplatformclientv2/models/scim_user_role.rb +1 -1
  94. data/lib/purecloudplatformclientv2/models/scim_user_routing_language.rb +3 -3
  95. data/lib/purecloudplatformclientv2/models/scim_user_routing_skill.rb +3 -3
  96. data/lib/purecloudplatformclientv2/models/scim_v2_create_user.rb +3 -2
  97. data/lib/purecloudplatformclientv2/models/scim_v2_enterprise_user.rb +1 -1
  98. data/lib/purecloudplatformclientv2/models/scim_v2_group.rb +1 -1
  99. data/lib/purecloudplatformclientv2/models/scim_v2_schema_attribute.rb +12 -12
  100. data/lib/purecloudplatformclientv2/models/scim_v2_schema_definition.rb +5 -5
  101. data/lib/purecloudplatformclientv2/models/scim_v2_schema_list_response.rb +2 -2
  102. data/lib/purecloudplatformclientv2/models/scim_v2_user.rb +4 -3
  103. data/lib/purecloudplatformclientv2/models/segment_detail_query_predicate.rb +2 -2
  104. data/lib/purecloudplatformclientv2/models/sms_config.rb +269 -0
  105. data/lib/purecloudplatformclientv2/models/sms_phone_number_ref.rb +232 -0
  106. data/lib/purecloudplatformclientv2/models/user_routing_language.rb +4 -4
  107. data/lib/purecloudplatformclientv2/models/user_routing_language_post.rb +1 -1
  108. data/lib/purecloudplatformclientv2/models/user_routing_skill.rb +1 -1
  109. data/lib/purecloudplatformclientv2/models/voicemail_user_policy.rb +30 -4
  110. data/lib/purecloudplatformclientv2/models/wem_coaching_appointment_topic_coaching_appointment_notification.rb +4 -4
  111. data/lib/purecloudplatformclientv2/models/wfm_business_unit_reference.rb +228 -0
  112. data/lib/purecloudplatformclientv2/models/wfm_historical_adherence_response.rb +27 -1
  113. data/lib/purecloudplatformclientv2/models/wfm_historical_adherence_result_wrapper.rb +258 -0
  114. data/lib/purecloudplatformclientv2/models/wfm_historical_data_upload_request_status_topic_date_time.rb +276 -0
  115. data/lib/purecloudplatformclientv2/models/wfm_historical_data_upload_request_status_topic_historical_data_upload_request_update.rb +390 -0
  116. data/lib/purecloudplatformclientv2/models/wfm_schedule_reference.rb +280 -0
  117. data/lib/purecloudplatformclientv2/version.rb +1 -1
  118. metadata +41 -3
@@ -0,0 +1,390 @@
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: UNLICENSED
11
+ https://help.mypurecloud.com/articles/terms-and-conditions/
12
+
13
+ Terms of Service: https://help.mypurecloud.com/articles/terms-and-conditions/
14
+
15
+ =end
16
+
17
+ require 'date'
18
+
19
+ module PureCloud
20
+ class WfmHistoricalDataUploadRequestStatusTopicHistoricalDataUploadRequestUpdate
21
+ attr_accessor :request_id
22
+
23
+ attr_accessor :date_import_started
24
+
25
+ attr_accessor :date_import_ended
26
+
27
+ attr_accessor :date_created
28
+
29
+ attr_accessor :date_modified
30
+
31
+ attr_accessor :status
32
+
33
+ attr_accessor :error
34
+
35
+ attr_accessor :active
36
+
37
+ # Attribute mapping from ruby-style variable name to JSON key.
38
+ def self.attribute_map
39
+ {
40
+
41
+ :'request_id' => :'requestId',
42
+
43
+ :'date_import_started' => :'dateImportStarted',
44
+
45
+ :'date_import_ended' => :'dateImportEnded',
46
+
47
+ :'date_created' => :'dateCreated',
48
+
49
+ :'date_modified' => :'dateModified',
50
+
51
+ :'status' => :'status',
52
+
53
+ :'error' => :'error',
54
+
55
+ :'active' => :'active'
56
+
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.swagger_types
62
+ {
63
+
64
+ :'request_id' => :'String',
65
+
66
+ :'date_import_started' => :'WfmHistoricalDataUploadRequestStatusTopicDateTime',
67
+
68
+ :'date_import_ended' => :'WfmHistoricalDataUploadRequestStatusTopicDateTime',
69
+
70
+ :'date_created' => :'WfmHistoricalDataUploadRequestStatusTopicDateTime',
71
+
72
+ :'date_modified' => :'WfmHistoricalDataUploadRequestStatusTopicDateTime',
73
+
74
+ :'status' => :'String',
75
+
76
+ :'error' => :'String',
77
+
78
+ :'active' => :'BOOLEAN'
79
+
80
+ }
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ return unless attributes.is_a?(Hash)
87
+
88
+ # convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
90
+
91
+
92
+ if attributes.has_key?(:'requestId')
93
+
94
+
95
+ self.request_id = attributes[:'requestId']
96
+
97
+
98
+ end
99
+
100
+
101
+ if attributes.has_key?(:'dateImportStarted')
102
+
103
+
104
+ self.date_import_started = attributes[:'dateImportStarted']
105
+
106
+
107
+ end
108
+
109
+
110
+ if attributes.has_key?(:'dateImportEnded')
111
+
112
+
113
+ self.date_import_ended = attributes[:'dateImportEnded']
114
+
115
+
116
+ end
117
+
118
+
119
+ if attributes.has_key?(:'dateCreated')
120
+
121
+
122
+ self.date_created = attributes[:'dateCreated']
123
+
124
+
125
+ end
126
+
127
+
128
+ if attributes.has_key?(:'dateModified')
129
+
130
+
131
+ self.date_modified = attributes[:'dateModified']
132
+
133
+
134
+ end
135
+
136
+
137
+ if attributes.has_key?(:'status')
138
+
139
+
140
+ self.status = attributes[:'status']
141
+
142
+
143
+ end
144
+
145
+
146
+ if attributes.has_key?(:'error')
147
+
148
+
149
+ self.error = attributes[:'error']
150
+
151
+
152
+ end
153
+
154
+
155
+ if attributes.has_key?(:'active')
156
+
157
+
158
+ self.active = attributes[:'active']
159
+
160
+
161
+ end
162
+
163
+
164
+ end
165
+
166
+ # Show invalid properties with the reasons. Usually used together with valid?
167
+ # @return Array for valid properies with the reasons
168
+ def list_invalid_properties
169
+ invalid_properties = Array.new
170
+
171
+
172
+ return invalid_properties
173
+ end
174
+
175
+ # Check to see if the all the properties in the model are valid
176
+ # @return true if the model is valid
177
+ def valid?
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+ allowed_values = ["Initiated", "InProgress", "Pending", "Success", "Failed", "Cancelled", "Purged"]
202
+ if @status && !allowed_values.include?(@status)
203
+ return false
204
+ end
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+ end
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+ # Custom attribute writer method checking allowed values (enum).
246
+ # @param [Object] status Object to be assigned
247
+ def status=(status)
248
+ allowed_values = ["Initiated", "InProgress", "Pending", "Success", "Failed", "Cancelled", "Purged"]
249
+ if status && !allowed_values.include?(status)
250
+ fail ArgumentError, "invalid value for 'status', must be one of #{allowed_values}."
251
+ end
252
+ @status = status
253
+ end
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+ # Checks equality by comparing each attribute.
269
+ # @param [Object] Object to be compared
270
+ def ==(o)
271
+ return true if self.equal?(o)
272
+ self.class == o.class &&
273
+ request_id == o.request_id &&
274
+ date_import_started == o.date_import_started &&
275
+ date_import_ended == o.date_import_ended &&
276
+ date_created == o.date_created &&
277
+ date_modified == o.date_modified &&
278
+ status == o.status &&
279
+ error == o.error &&
280
+ active == o.active
281
+ end
282
+
283
+ # @see the `==` method
284
+ # @param [Object] Object to be compared
285
+ def eql?(o)
286
+ self == o
287
+ end
288
+
289
+ # Calculates hash code according to all attributes.
290
+ # @return [Fixnum] Hash code
291
+ def hash
292
+ [request_id, date_import_started, date_import_ended, date_created, date_modified, status, error, active].hash
293
+ end
294
+
295
+ # build the object from hash
296
+ def build_from_hash(attributes)
297
+ return nil unless attributes.is_a?(Hash)
298
+ self.class.swagger_types.each_pair do |key, type|
299
+ if type =~ /^Array<(.*)>/i
300
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
301
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
302
+ else
303
+ #TODO show warning in debug mode
304
+ end
305
+ elsif !attributes[self.class.attribute_map[key]].nil?
306
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
307
+ else
308
+ # data not found in attributes(hash), not an issue as the data can be optional
309
+ end
310
+ end
311
+
312
+ self
313
+ end
314
+
315
+ def _deserialize(type, value)
316
+ case type.to_sym
317
+ when :DateTime
318
+ DateTime.parse(value)
319
+ when :Date
320
+ Date.parse(value)
321
+ when :String
322
+ value.to_s
323
+ when :Integer
324
+ value.to_i
325
+ when :Float
326
+ value.to_f
327
+ when :BOOLEAN
328
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
329
+ true
330
+ else
331
+ false
332
+ end
333
+ when :Object
334
+ # generic object (usually a Hash), return directly
335
+ value
336
+ when /\AArray<(?<inner_type>.+)>\z/
337
+ inner_type = Regexp.last_match[:inner_type]
338
+ value.map { |v| _deserialize(inner_type, v) }
339
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
340
+ k_type = Regexp.last_match[:k_type]
341
+ v_type = Regexp.last_match[:v_type]
342
+ {}.tap do |hash|
343
+ value.each do |k, v|
344
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
345
+ end
346
+ end
347
+ else # model
348
+ _model = Object.const_get("PureCloud").const_get(type).new
349
+ _model.build_from_hash(value)
350
+ end
351
+ end
352
+
353
+ def to_s
354
+ to_hash.to_s
355
+ end
356
+
357
+ # to_body is an alias to to_body (backward compatibility))
358
+ def to_body
359
+ to_hash
360
+ end
361
+
362
+ # return the object in the form of hash
363
+ def to_hash
364
+ hash = {}
365
+ self.class.attribute_map.each_pair do |attr, param|
366
+ value = self.send(attr)
367
+ next if value.nil?
368
+ hash[param] = _to_hash(value)
369
+ end
370
+ hash
371
+ end
372
+
373
+ # Method to output non-array value in the form of hash
374
+ # For object, use to_hash. Otherwise, just return the value
375
+ def _to_hash(value)
376
+ if value.is_a?(Array)
377
+ value.compact.map{ |v| _to_hash(v) }
378
+ elsif value.is_a?(Hash)
379
+ {}.tap do |hash|
380
+ value.each { |k, v| hash[k] = _to_hash(v) }
381
+ end
382
+ elsif value.respond_to? :to_hash
383
+ value.to_hash
384
+ else
385
+ value
386
+ end
387
+ end
388
+
389
+ end
390
+ end
@@ -0,0 +1,280 @@
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: UNLICENSED
11
+ https://help.mypurecloud.com/articles/terms-and-conditions/
12
+
13
+ Terms of Service: https://help.mypurecloud.com/articles/terms-and-conditions/
14
+
15
+ =end
16
+
17
+ require 'date'
18
+
19
+ module PureCloud
20
+ class WfmScheduleReference
21
+ # The globally unique identifier for the object.
22
+ attr_accessor :id
23
+
24
+ # A reference to a Workforce Management Business Unit
25
+ attr_accessor :business_unit
26
+
27
+ # The start week date for this schedule. Dates are represented as an ISO-8601 string. For example: yyyy-MM-dd
28
+ attr_accessor :week_date
29
+
30
+ # The URI for this object
31
+ attr_accessor :self_uri
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+
37
+ :'id' => :'id',
38
+
39
+ :'business_unit' => :'businessUnit',
40
+
41
+ :'week_date' => :'weekDate',
42
+
43
+ :'self_uri' => :'selfUri'
44
+
45
+ }
46
+ end
47
+
48
+ # Attribute type mapping.
49
+ def self.swagger_types
50
+ {
51
+
52
+ :'id' => :'String',
53
+
54
+ :'business_unit' => :'WfmBusinessUnitReference',
55
+
56
+ :'week_date' => :'Date',
57
+
58
+ :'self_uri' => :'String'
59
+
60
+ }
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ return unless attributes.is_a?(Hash)
67
+
68
+ # convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
70
+
71
+
72
+ if attributes.has_key?(:'id')
73
+
74
+
75
+ self.id = attributes[:'id']
76
+
77
+
78
+ end
79
+
80
+
81
+ if attributes.has_key?(:'businessUnit')
82
+
83
+
84
+ self.business_unit = attributes[:'businessUnit']
85
+
86
+
87
+ end
88
+
89
+
90
+ if attributes.has_key?(:'weekDate')
91
+
92
+
93
+ self.week_date = attributes[:'weekDate']
94
+
95
+
96
+ end
97
+
98
+
99
+ if attributes.has_key?(:'selfUri')
100
+
101
+
102
+ self.self_uri = attributes[:'selfUri']
103
+
104
+
105
+ end
106
+
107
+
108
+ end
109
+
110
+ # Show invalid properties with the reasons. Usually used together with valid?
111
+ # @return Array for valid properies with the reasons
112
+ def list_invalid_properties
113
+ invalid_properties = Array.new
114
+
115
+
116
+ return invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+ end
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+ # Checks equality by comparing each attribute.
163
+ # @param [Object] Object to be compared
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ id == o.id &&
168
+ business_unit == o.business_unit &&
169
+ week_date == o.week_date &&
170
+ self_uri == o.self_uri
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(o)
176
+ self == o
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Fixnum] Hash code
181
+ def hash
182
+ [id, business_unit, week_date, self_uri].hash
183
+ end
184
+
185
+ # build the object from hash
186
+ def build_from_hash(attributes)
187
+ return nil unless attributes.is_a?(Hash)
188
+ self.class.swagger_types.each_pair do |key, type|
189
+ if type =~ /^Array<(.*)>/i
190
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
191
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
192
+ else
193
+ #TODO show warning in debug mode
194
+ end
195
+ elsif !attributes[self.class.attribute_map[key]].nil?
196
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
197
+ else
198
+ # data not found in attributes(hash), not an issue as the data can be optional
199
+ end
200
+ end
201
+
202
+ self
203
+ end
204
+
205
+ def _deserialize(type, value)
206
+ case type.to_sym
207
+ when :DateTime
208
+ DateTime.parse(value)
209
+ when :Date
210
+ Date.parse(value)
211
+ when :String
212
+ value.to_s
213
+ when :Integer
214
+ value.to_i
215
+ when :Float
216
+ value.to_f
217
+ when :BOOLEAN
218
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
219
+ true
220
+ else
221
+ false
222
+ end
223
+ when :Object
224
+ # generic object (usually a Hash), return directly
225
+ value
226
+ when /\AArray<(?<inner_type>.+)>\z/
227
+ inner_type = Regexp.last_match[:inner_type]
228
+ value.map { |v| _deserialize(inner_type, v) }
229
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
230
+ k_type = Regexp.last_match[:k_type]
231
+ v_type = Regexp.last_match[:v_type]
232
+ {}.tap do |hash|
233
+ value.each do |k, v|
234
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
+ end
236
+ end
237
+ else # model
238
+ _model = Object.const_get("PureCloud").const_get(type).new
239
+ _model.build_from_hash(value)
240
+ end
241
+ end
242
+
243
+ def to_s
244
+ to_hash.to_s
245
+ end
246
+
247
+ # to_body is an alias to to_body (backward compatibility))
248
+ def to_body
249
+ to_hash
250
+ end
251
+
252
+ # return the object in the form of hash
253
+ def to_hash
254
+ hash = {}
255
+ self.class.attribute_map.each_pair do |attr, param|
256
+ value = self.send(attr)
257
+ next if value.nil?
258
+ hash[param] = _to_hash(value)
259
+ end
260
+ hash
261
+ end
262
+
263
+ # Method to output non-array value in the form of hash
264
+ # For object, use to_hash. Otherwise, just return the value
265
+ def _to_hash(value)
266
+ if value.is_a?(Array)
267
+ value.compact.map{ |v| _to_hash(v) }
268
+ elsif value.is_a?(Hash)
269
+ {}.tap do |hash|
270
+ value.each { |k, v| hash[k] = _to_hash(v) }
271
+ end
272
+ elsif value.respond_to? :to_hash
273
+ value.to_hash
274
+ else
275
+ value
276
+ end
277
+ end
278
+
279
+ end
280
+ end