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
@@ -25,6 +25,9 @@ module PureCloud
25
25
  # Deprecated. Use downloadUrls instead.
26
26
  attr_accessor :download_url
27
27
 
28
+ # Result will always come via downloadUrls; however the schema is included for documentation
29
+ attr_accessor :download_result
30
+
28
31
  # The uri list to GET the results of the Historical Adherence query. For notification purposes only
29
32
  attr_accessor :download_urls
30
33
 
@@ -39,6 +42,8 @@ module PureCloud
39
42
 
40
43
  :'download_url' => :'downloadUrl',
41
44
 
45
+ :'download_result' => :'downloadResult',
46
+
42
47
  :'download_urls' => :'downloadUrls',
43
48
 
44
49
  :'query_state' => :'queryState'
@@ -54,6 +59,8 @@ module PureCloud
54
59
 
55
60
  :'download_url' => :'String',
56
61
 
62
+ :'download_result' => :'WfmHistoricalAdherenceResultWrapper',
63
+
57
64
  :'download_urls' => :'Array<String>',
58
65
 
59
66
  :'query_state' => :'String'
@@ -88,6 +95,15 @@ module PureCloud
88
95
  end
89
96
 
90
97
 
98
+ if attributes.has_key?(:'downloadResult')
99
+
100
+
101
+ self.download_result = attributes[:'downloadResult']
102
+
103
+
104
+ end
105
+
106
+
91
107
  if attributes.has_key?(:'downloadUrls')
92
108
 
93
109
  if (value = attributes[:'downloadUrls']).is_a?(Array)
@@ -137,6 +153,10 @@ module PureCloud
137
153
 
138
154
 
139
155
 
156
+
157
+
158
+
159
+
140
160
  allowed_values = ["Processing", "Complete", "Error"]
141
161
  if @query_state && !allowed_values.include?(@query_state)
142
162
  return false
@@ -160,6 +180,11 @@ module PureCloud
160
180
 
161
181
 
162
182
 
183
+
184
+
185
+
186
+
187
+
163
188
 
164
189
 
165
190
 
@@ -183,6 +208,7 @@ module PureCloud
183
208
  self.class == o.class &&
184
209
  id == o.id &&
185
210
  download_url == o.download_url &&
211
+ download_result == o.download_result &&
186
212
  download_urls == o.download_urls &&
187
213
  query_state == o.query_state
188
214
  end
@@ -196,7 +222,7 @@ module PureCloud
196
222
  # Calculates hash code according to all attributes.
197
223
  # @return [Fixnum] Hash code
198
224
  def hash
199
- [id, download_url, download_urls, query_state].hash
225
+ [id, download_url, download_result, download_urls, query_state].hash
200
226
  end
201
227
 
202
228
  # build the object from hash
@@ -0,0 +1,258 @@
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 WfmHistoricalAdherenceResultWrapper
21
+ # The operation ID of the historical adherence query
22
+ attr_accessor :entity_id
23
+
24
+ # The list of historical adherence query results
25
+ attr_accessor :data
26
+
27
+ # Map of secondary presence lookup ID to corresponding secondary presence ID
28
+ attr_accessor :lookup_id_to_secondary_presence_id
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+
34
+ :'entity_id' => :'entityId',
35
+
36
+ :'data' => :'data',
37
+
38
+ :'lookup_id_to_secondary_presence_id' => :'lookupIdToSecondaryPresenceId'
39
+
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+
47
+ :'entity_id' => :'String',
48
+
49
+ :'data' => :'Array<HistoricalAdherenceQueryResult>',
50
+
51
+ :'lookup_id_to_secondary_presence_id' => :'Hash<String, String>'
52
+
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
63
+
64
+
65
+ if attributes.has_key?(:'entityId')
66
+
67
+
68
+ self.entity_id = attributes[:'entityId']
69
+
70
+
71
+ end
72
+
73
+
74
+ if attributes.has_key?(:'data')
75
+
76
+ if (value = attributes[:'data']).is_a?(Array)
77
+ self.data = value
78
+ end
79
+
80
+
81
+
82
+ end
83
+
84
+
85
+ if attributes.has_key?(:'lookupIdToSecondaryPresenceId')
86
+
87
+ if (value = attributes[:'lookupIdToSecondaryPresenceId']).is_a?(Array)
88
+ self.lookup_id_to_secondary_presence_id = value
89
+ end
90
+
91
+
92
+
93
+ end
94
+
95
+
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properies with the reasons
100
+ def list_invalid_properties
101
+ invalid_properties = Array.new
102
+
103
+
104
+ return invalid_properties
105
+ end
106
+
107
+ # Check to see if the all the properties in the model are valid
108
+ # @return true if the model is valid
109
+ def valid?
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ end
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+ # Checks equality by comparing each attribute.
142
+ # @param [Object] Object to be compared
143
+ def ==(o)
144
+ return true if self.equal?(o)
145
+ self.class == o.class &&
146
+ entity_id == o.entity_id &&
147
+ data == o.data &&
148
+ lookup_id_to_secondary_presence_id == o.lookup_id_to_secondary_presence_id
149
+ end
150
+
151
+ # @see the `==` method
152
+ # @param [Object] Object to be compared
153
+ def eql?(o)
154
+ self == o
155
+ end
156
+
157
+ # Calculates hash code according to all attributes.
158
+ # @return [Fixnum] Hash code
159
+ def hash
160
+ [entity_id, data, lookup_id_to_secondary_presence_id].hash
161
+ end
162
+
163
+ # build the object from hash
164
+ def build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ self.class.swagger_types.each_pair do |key, type|
167
+ if type =~ /^Array<(.*)>/i
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
170
+ else
171
+ #TODO show warning in debug mode
172
+ end
173
+ elsif !attributes[self.class.attribute_map[key]].nil?
174
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
175
+ else
176
+ # data not found in attributes(hash), not an issue as the data can be optional
177
+ end
178
+ end
179
+
180
+ self
181
+ end
182
+
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :DateTime
186
+ DateTime.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :BOOLEAN
196
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ _model = Object.const_get("PureCloud").const_get(type).new
217
+ _model.build_from_hash(value)
218
+ end
219
+ end
220
+
221
+ def to_s
222
+ to_hash.to_s
223
+ end
224
+
225
+ # to_body is an alias to to_body (backward compatibility))
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # return the object in the form of hash
231
+ def to_hash
232
+ hash = {}
233
+ self.class.attribute_map.each_pair do |attr, param|
234
+ value = self.send(attr)
235
+ next if value.nil?
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ # Method to output non-array value in the form of hash
242
+ # For object, use to_hash. Otherwise, just return the value
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map{ |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+
257
+ end
258
+ end
@@ -0,0 +1,276 @@
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 WfmHistoricalDataUploadRequestStatusTopicDateTime
21
+ attr_accessor :i_millis
22
+
23
+ attr_accessor :before_now
24
+
25
+ attr_accessor :after_now
26
+
27
+ attr_accessor :equal_now
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+
33
+ :'i_millis' => :'iMillis',
34
+
35
+ :'before_now' => :'beforeNow',
36
+
37
+ :'after_now' => :'afterNow',
38
+
39
+ :'equal_now' => :'equalNow'
40
+
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+
48
+ :'i_millis' => :'Integer',
49
+
50
+ :'before_now' => :'BOOLEAN',
51
+
52
+ :'after_now' => :'BOOLEAN',
53
+
54
+ :'equal_now' => :'BOOLEAN'
55
+
56
+ }
57
+ end
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ def initialize(attributes = {})
62
+ return unless attributes.is_a?(Hash)
63
+
64
+ # convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
66
+
67
+
68
+ if attributes.has_key?(:'iMillis')
69
+
70
+
71
+ self.i_millis = attributes[:'iMillis']
72
+
73
+
74
+ end
75
+
76
+
77
+ if attributes.has_key?(:'beforeNow')
78
+
79
+
80
+ self.before_now = attributes[:'beforeNow']
81
+
82
+
83
+ end
84
+
85
+
86
+ if attributes.has_key?(:'afterNow')
87
+
88
+
89
+ self.after_now = attributes[:'afterNow']
90
+
91
+
92
+ end
93
+
94
+
95
+ if attributes.has_key?(:'equalNow')
96
+
97
+
98
+ self.equal_now = attributes[:'equalNow']
99
+
100
+
101
+ end
102
+
103
+
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properies with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+
111
+
112
+ return invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+ end
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(o)
161
+ return true if self.equal?(o)
162
+ self.class == o.class &&
163
+ i_millis == o.i_millis &&
164
+ before_now == o.before_now &&
165
+ after_now == o.after_now &&
166
+ equal_now == o.equal_now
167
+ end
168
+
169
+ # @see the `==` method
170
+ # @param [Object] Object to be compared
171
+ def eql?(o)
172
+ self == o
173
+ end
174
+
175
+ # Calculates hash code according to all attributes.
176
+ # @return [Fixnum] Hash code
177
+ def hash
178
+ [i_millis, before_now, after_now, equal_now].hash
179
+ end
180
+
181
+ # build the object from hash
182
+ def build_from_hash(attributes)
183
+ return nil unless attributes.is_a?(Hash)
184
+ self.class.swagger_types.each_pair do |key, type|
185
+ if type =~ /^Array<(.*)>/i
186
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
187
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
188
+ else
189
+ #TODO show warning in debug mode
190
+ end
191
+ elsif !attributes[self.class.attribute_map[key]].nil?
192
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
193
+ else
194
+ # data not found in attributes(hash), not an issue as the data can be optional
195
+ end
196
+ end
197
+
198
+ self
199
+ end
200
+
201
+ def _deserialize(type, value)
202
+ case type.to_sym
203
+ when :DateTime
204
+ DateTime.parse(value)
205
+ when :Date
206
+ Date.parse(value)
207
+ when :String
208
+ value.to_s
209
+ when :Integer
210
+ value.to_i
211
+ when :Float
212
+ value.to_f
213
+ when :BOOLEAN
214
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
215
+ true
216
+ else
217
+ false
218
+ end
219
+ when :Object
220
+ # generic object (usually a Hash), return directly
221
+ value
222
+ when /\AArray<(?<inner_type>.+)>\z/
223
+ inner_type = Regexp.last_match[:inner_type]
224
+ value.map { |v| _deserialize(inner_type, v) }
225
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
226
+ k_type = Regexp.last_match[:k_type]
227
+ v_type = Regexp.last_match[:v_type]
228
+ {}.tap do |hash|
229
+ value.each do |k, v|
230
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
231
+ end
232
+ end
233
+ else # model
234
+ _model = Object.const_get("PureCloud").const_get(type).new
235
+ _model.build_from_hash(value)
236
+ end
237
+ end
238
+
239
+ def to_s
240
+ to_hash.to_s
241
+ end
242
+
243
+ # to_body is an alias to to_body (backward compatibility))
244
+ def to_body
245
+ to_hash
246
+ end
247
+
248
+ # return the object in the form of hash
249
+ def to_hash
250
+ hash = {}
251
+ self.class.attribute_map.each_pair do |attr, param|
252
+ value = self.send(attr)
253
+ next if value.nil?
254
+ hash[param] = _to_hash(value)
255
+ end
256
+ hash
257
+ end
258
+
259
+ # Method to output non-array value in the form of hash
260
+ # For object, use to_hash. Otherwise, just return the value
261
+ def _to_hash(value)
262
+ if value.is_a?(Array)
263
+ value.compact.map{ |v| _to_hash(v) }
264
+ elsif value.is_a?(Hash)
265
+ {}.tap do |hash|
266
+ value.each { |k, v| hash[k] = _to_hash(v) }
267
+ end
268
+ elsif value.respond_to? :to_hash
269
+ value.to_hash
270
+ else
271
+ value
272
+ end
273
+ end
274
+
275
+ end
276
+ end