purecloudplatformclientv2 20.0.0 → 21.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/docs/AdherenceSettings.md +18 -0
- data/docs/AgentManagementUnitReference.md +14 -0
- data/docs/AnalyticsSession.md +1 -0
- data/docs/AnalyticsView.md +1 -1
- data/docs/ArchitectApi.md +19 -15
- data/docs/CallForwarding.md +4 -2
- data/docs/CallMediaParticipant.md +1 -0
- data/docs/CallRoute.md +14 -0
- data/docs/CallTarget.md +14 -0
- data/docs/Contact.md +1 -1
- data/docs/ConversationNotificationMessage.md +3 -0
- data/docs/ConversationNotificationMessageDetails.md +2 -0
- data/docs/ConversationNotificationMessages.md +2 -0
- data/docs/ConversationNotificationMessages1.md +3 -0
- data/docs/ConversationsApi.md +196 -0
- data/docs/CreateEmailRequest.md +2 -0
- data/docs/CreateQueueRequest.md +2 -0
- data/docs/CreateSecureSession.md +16 -0
- data/docs/ExternalContact.md +1 -0
- data/docs/ImportScriptStatusResponse.md +15 -0
- data/docs/InboundRoute.md +1 -0
- data/docs/JsonNode.md +1 -1
- data/docs/ManagementUnit.md +5 -3
- data/docs/ManagementUnitReference.md +14 -0
- data/docs/ManagementUnitSettings.md +19 -0
- data/docs/Message.md +3 -0
- data/docs/MessageConversationNotificationMessageDetails.md +2 -0
- data/docs/MessageConversationNotificationMessageMediaParticipant.md +3 -0
- data/docs/MessageConversationNotificationMessages.md +2 -0
- data/docs/MessageConversationNotificationParticipants.md +3 -0
- data/docs/MessageDetails.md +2 -0
- data/docs/QualityApi.md +3 -1
- data/docs/Queue.md +2 -0
- data/docs/SchedulingSettings.md +14 -0
- data/docs/ScriptsApi.md +64 -0
- data/docs/SecureSession.md +19 -0
- data/docs/SecureSessionEntityListing.md +13 -0
- data/docs/ShortTermForecastingSettings.md +13 -0
- data/docs/SignedData.md +13 -0
- data/docs/SignedDataApi.md +73 -0
- data/docs/TimeOffRequestSettings.md +15 -0
- data/docs/UpdateUser.md +2 -2
- data/docs/UserConversationSummaryNotification.md +1 -0
- data/docs/UserQueue.md +2 -0
- data/docs/UserReference.md +14 -0
- data/docs/WorkforceManagementApi.md +61 -0
- data/lib/purecloudplatformclientv2.rb +16 -0
- data/lib/purecloudplatformclientv2/api/architect_api.rb +24 -6
- data/lib/purecloudplatformclientv2/api/conversations_api.rb +243 -0
- data/lib/purecloudplatformclientv2/api/quality_api.rb +9 -0
- data/lib/purecloudplatformclientv2/api/scripts_api.rb +74 -0
- data/lib/purecloudplatformclientv2/api/signed_data_api.rb +90 -0
- data/lib/purecloudplatformclientv2/api/workforce_management_api.rb +63 -0
- data/lib/purecloudplatformclientv2/api_client.rb +1 -1
- data/lib/purecloudplatformclientv2/models/adherence_settings.rb +335 -0
- data/lib/purecloudplatformclientv2/models/agent_management_unit_reference.rb +229 -0
- data/lib/purecloudplatformclientv2/models/aggregate_metric_data.rb +2 -2
- data/lib/purecloudplatformclientv2/models/analytics_conversation_segment.rb +2 -2
- data/lib/purecloudplatformclientv2/models/analytics_query_predicate.rb +4 -4
- data/lib/purecloudplatformclientv2/models/analytics_session.rb +41 -1
- data/lib/purecloudplatformclientv2/models/analytics_view.rb +1 -1
- data/lib/purecloudplatformclientv2/models/call_forwarding.rb +71 -1
- data/lib/purecloudplatformclientv2/models/call_media_participant.rb +30 -4
- data/lib/purecloudplatformclientv2/models/call_route.rb +230 -0
- data/lib/purecloudplatformclientv2/models/call_target.rb +242 -0
- data/lib/purecloudplatformclientv2/models/contact.rb +1 -1
- data/lib/purecloudplatformclientv2/models/conversation_notification_message.rb +90 -1
- data/lib/purecloudplatformclientv2/models/conversation_notification_message_details.rb +68 -4
- data/lib/purecloudplatformclientv2/models/conversation_notification_messages.rb +68 -4
- data/lib/purecloudplatformclientv2/models/conversation_notification_messages_1.rb +90 -1
- data/lib/purecloudplatformclientv2/models/create_email_request.rb +56 -4
- data/lib/purecloudplatformclientv2/models/create_queue_request.rb +53 -1
- data/lib/purecloudplatformclientv2/models/create_secure_session.rb +290 -0
- data/lib/purecloudplatformclientv2/models/dependency.rb +2 -2
- data/lib/purecloudplatformclientv2/models/dependency_object.rb +2 -2
- data/lib/purecloudplatformclientv2/models/event_message.rb +2 -2
- data/lib/purecloudplatformclientv2/models/external_contact.rb +26 -1
- data/lib/purecloudplatformclientv2/models/import_script_status_response.rb +251 -0
- data/lib/purecloudplatformclientv2/models/inbound_route.rb +27 -1
- data/lib/purecloudplatformclientv2/models/interaction_stat_alert_notification.rb +2 -2
- data/lib/purecloudplatformclientv2/models/interaction_stat_rule_notification.rb +2 -2
- data/lib/purecloudplatformclientv2/models/interaction_stats_alert.rb +2 -2
- data/lib/purecloudplatformclientv2/models/interaction_stats_rule.rb +2 -2
- data/lib/purecloudplatformclientv2/models/intraday_data_group.rb +2 -2
- data/lib/purecloudplatformclientv2/models/intraday_data_update_notification_intraday_data_group.rb +2 -2
- data/lib/purecloudplatformclientv2/models/intraday_data_update_notification_intraday_data_groupings.rb +2 -2
- data/lib/purecloudplatformclientv2/models/json_node.rb +17 -17
- data/lib/purecloudplatformclientv2/models/management_unit.rb +59 -7
- data/lib/purecloudplatformclientv2/models/management_unit_reference.rb +229 -0
- data/lib/purecloudplatformclientv2/models/management_unit_settings.rb +364 -0
- data/lib/purecloudplatformclientv2/models/message.rb +93 -1
- data/lib/purecloudplatformclientv2/models/message_conversation_notification_message_details.rb +68 -4
- data/lib/purecloudplatformclientv2/models/message_conversation_notification_message_media_participant.rb +93 -4
- data/lib/purecloudplatformclientv2/models/message_conversation_notification_messages.rb +68 -4
- data/lib/purecloudplatformclientv2/models/message_conversation_notification_participants.rb +93 -4
- data/lib/purecloudplatformclientv2/models/message_details.rb +67 -1
- data/lib/purecloudplatformclientv2/models/participant.rb +2 -2
- data/lib/purecloudplatformclientv2/models/participant_basic.rb +2 -2
- data/lib/purecloudplatformclientv2/models/queue.rb +53 -1
- data/lib/purecloudplatformclientv2/models/scheduling_settings.rb +229 -0
- data/lib/purecloudplatformclientv2/models/secure_session.rb +382 -0
- data/lib/purecloudplatformclientv2/models/secure_session_entity_listing.rb +203 -0
- data/lib/purecloudplatformclientv2/models/short_term_forecasting_settings.rb +203 -0
- data/lib/purecloudplatformclientv2/models/signed_data.rb +201 -0
- data/lib/purecloudplatformclientv2/models/time_off_request_settings.rb +255 -0
- data/lib/purecloudplatformclientv2/models/update_user.rb +2 -1
- data/lib/purecloudplatformclientv2/models/user_conversation_summary_notification.rb +26 -1
- data/lib/purecloudplatformclientv2/models/user_queue.rb +53 -1
- data/lib/purecloudplatformclientv2/models/user_reference.rb +228 -0
- data/lib/purecloudplatformclientv2/version.rb +1 -1
- metadata +34 -2
@@ -129,6 +129,9 @@ module PureCloud
|
|
129
129
|
# The ID of the consult transfer target participant when performing a consult transfer.
|
130
130
|
attr_accessor :consult_participant_id
|
131
131
|
|
132
|
+
# User-to-User information which maps to a SIP header field defined in RFC7433. UUI data is used in the Public Switched Telephone Network (PSTN) for use cases described in RFC6567.
|
133
|
+
attr_accessor :uui_data
|
134
|
+
|
132
135
|
# Attribute mapping from ruby-style variable name to JSON key.
|
133
136
|
def self.attribute_map
|
134
137
|
{
|
@@ -205,7 +208,9 @@ module PureCloud
|
|
205
208
|
|
206
209
|
:'monitored_participant_id' => :'monitoredParticipantId',
|
207
210
|
|
208
|
-
:'consult_participant_id' => :'consultParticipantId'
|
211
|
+
:'consult_participant_id' => :'consultParticipantId',
|
212
|
+
|
213
|
+
:'uui_data' => :'uuiData'
|
209
214
|
|
210
215
|
}
|
211
216
|
end
|
@@ -286,7 +291,9 @@ module PureCloud
|
|
286
291
|
|
287
292
|
:'monitored_participant_id' => :'String',
|
288
293
|
|
289
|
-
:'consult_participant_id' => :'String'
|
294
|
+
:'consult_participant_id' => :'String',
|
295
|
+
|
296
|
+
:'uui_data' => :'String'
|
290
297
|
|
291
298
|
}
|
292
299
|
end
|
@@ -635,6 +642,15 @@ module PureCloud
|
|
635
642
|
end
|
636
643
|
|
637
644
|
|
645
|
+
if attributes.has_key?(:'uuiData')
|
646
|
+
|
647
|
+
|
648
|
+
self.uui_data = attributes[:'uuiData']
|
649
|
+
|
650
|
+
|
651
|
+
end
|
652
|
+
|
653
|
+
|
638
654
|
end
|
639
655
|
|
640
656
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -813,6 +829,10 @@ module PureCloud
|
|
813
829
|
|
814
830
|
|
815
831
|
|
832
|
+
|
833
|
+
|
834
|
+
|
835
|
+
|
816
836
|
|
817
837
|
|
818
838
|
|
@@ -1036,6 +1056,11 @@ module PureCloud
|
|
1036
1056
|
|
1037
1057
|
|
1038
1058
|
|
1059
|
+
|
1060
|
+
|
1061
|
+
|
1062
|
+
|
1063
|
+
|
1039
1064
|
|
1040
1065
|
|
1041
1066
|
|
@@ -1083,7 +1108,8 @@ module PureCloud
|
|
1083
1108
|
document_id == o.document_id &&
|
1084
1109
|
fax_status == o.fax_status &&
|
1085
1110
|
monitored_participant_id == o.monitored_participant_id &&
|
1086
|
-
consult_participant_id == o.consult_participant_id
|
1111
|
+
consult_participant_id == o.consult_participant_id &&
|
1112
|
+
uui_data == o.uui_data
|
1087
1113
|
end
|
1088
1114
|
|
1089
1115
|
# @see the `==` method
|
@@ -1095,7 +1121,7 @@ module PureCloud
|
|
1095
1121
|
# Calculates hash code according to all attributes.
|
1096
1122
|
# @return [Fixnum] Hash code
|
1097
1123
|
def hash
|
1098
|
-
[id, name, address, start_time, connected_time, end_time, start_hold_time, purpose, state, direction, disconnect_type, held, wrapup_required, wrapup_prompt, user, queue, attributes, error_info, script, wrapup_timeout_ms, wrapup_skipped, provider, external_contact, external_organization, wrapup, peer, muted, confined, recording, recording_state, group, ani, dnis, document_id, fax_status, monitored_participant_id, consult_participant_id].hash
|
1124
|
+
[id, name, address, start_time, connected_time, end_time, start_hold_time, purpose, state, direction, disconnect_type, held, wrapup_required, wrapup_prompt, user, queue, attributes, error_info, script, wrapup_timeout_ms, wrapup_skipped, provider, external_contact, external_organization, wrapup, peer, muted, confined, recording, recording_state, group, ani, dnis, document_id, fax_status, monitored_participant_id, consult_participant_id, uui_data].hash
|
1099
1125
|
end
|
1100
1126
|
|
1101
1127
|
# build the object from hash
|
@@ -0,0 +1,230 @@
|
|
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 CallRoute
|
21
|
+
# A list of CallTargets to be called when the CallRoute is executed
|
22
|
+
attr_accessor :targets
|
23
|
+
|
24
|
+
# The amount of time until the call times out
|
25
|
+
attr_accessor :timeout_milliseconds
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
|
31
|
+
:'targets' => :'targets',
|
32
|
+
|
33
|
+
:'timeout_milliseconds' => :'timeoutMilliseconds'
|
34
|
+
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.swagger_types
|
40
|
+
{
|
41
|
+
|
42
|
+
:'targets' => :'Array<CallTarget>',
|
43
|
+
|
44
|
+
:'timeout_milliseconds' => :'Integer'
|
45
|
+
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
return unless attributes.is_a?(Hash)
|
53
|
+
|
54
|
+
# convert string to symbol for hash key
|
55
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
56
|
+
|
57
|
+
|
58
|
+
if attributes.has_key?(:'targets')
|
59
|
+
|
60
|
+
if (value = attributes[:'targets']).is_a?(Array)
|
61
|
+
self.targets = value
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
if attributes.has_key?(:'timeoutMilliseconds')
|
70
|
+
|
71
|
+
|
72
|
+
self.timeout_milliseconds = attributes[:'timeoutMilliseconds']
|
73
|
+
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
81
|
+
# @return Array for valid properies with the reasons
|
82
|
+
def list_invalid_properties
|
83
|
+
invalid_properties = Array.new
|
84
|
+
|
85
|
+
|
86
|
+
return invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
# Checks equality by comparing each attribute.
|
115
|
+
# @param [Object] Object to be compared
|
116
|
+
def ==(o)
|
117
|
+
return true if self.equal?(o)
|
118
|
+
self.class == o.class &&
|
119
|
+
targets == o.targets &&
|
120
|
+
timeout_milliseconds == o.timeout_milliseconds
|
121
|
+
end
|
122
|
+
|
123
|
+
# @see the `==` method
|
124
|
+
# @param [Object] Object to be compared
|
125
|
+
def eql?(o)
|
126
|
+
self == o
|
127
|
+
end
|
128
|
+
|
129
|
+
# Calculates hash code according to all attributes.
|
130
|
+
# @return [Fixnum] Hash code
|
131
|
+
def hash
|
132
|
+
[targets, timeout_milliseconds].hash
|
133
|
+
end
|
134
|
+
|
135
|
+
# build the object from hash
|
136
|
+
def build_from_hash(attributes)
|
137
|
+
return nil unless attributes.is_a?(Hash)
|
138
|
+
self.class.swagger_types.each_pair do |key, type|
|
139
|
+
if type =~ /^Array<(.*)>/i
|
140
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
141
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
142
|
+
else
|
143
|
+
#TODO show warning in debug mode
|
144
|
+
end
|
145
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
146
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
147
|
+
else
|
148
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
self
|
153
|
+
end
|
154
|
+
|
155
|
+
def _deserialize(type, value)
|
156
|
+
case type.to_sym
|
157
|
+
when :DateTime
|
158
|
+
DateTime.parse(value)
|
159
|
+
when :Date
|
160
|
+
Date.parse(value)
|
161
|
+
when :String
|
162
|
+
value.to_s
|
163
|
+
when :Integer
|
164
|
+
value.to_i
|
165
|
+
when :Float
|
166
|
+
value.to_f
|
167
|
+
when :BOOLEAN
|
168
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
169
|
+
true
|
170
|
+
else
|
171
|
+
false
|
172
|
+
end
|
173
|
+
when :Object
|
174
|
+
# generic object (usually a Hash), return directly
|
175
|
+
value
|
176
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
177
|
+
inner_type = Regexp.last_match[:inner_type]
|
178
|
+
value.map { |v| _deserialize(inner_type, v) }
|
179
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
180
|
+
k_type = Regexp.last_match[:k_type]
|
181
|
+
v_type = Regexp.last_match[:v_type]
|
182
|
+
{}.tap do |hash|
|
183
|
+
value.each do |k, v|
|
184
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
else # model
|
188
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
189
|
+
_model.build_from_hash(value)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def to_s
|
194
|
+
to_hash.to_s
|
195
|
+
end
|
196
|
+
|
197
|
+
# to_body is an alias to to_body (backward compatibility))
|
198
|
+
def to_body
|
199
|
+
to_hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# return the object in the form of hash
|
203
|
+
def to_hash
|
204
|
+
hash = {}
|
205
|
+
self.class.attribute_map.each_pair do |attr, param|
|
206
|
+
value = self.send(attr)
|
207
|
+
next if value.nil?
|
208
|
+
hash[param] = _to_hash(value)
|
209
|
+
end
|
210
|
+
hash
|
211
|
+
end
|
212
|
+
|
213
|
+
# Method to output non-array value in the form of hash
|
214
|
+
# For object, use to_hash. Otherwise, just return the value
|
215
|
+
def _to_hash(value)
|
216
|
+
if value.is_a?(Array)
|
217
|
+
value.compact.map{ |v| _to_hash(v) }
|
218
|
+
elsif value.is_a?(Hash)
|
219
|
+
{}.tap do |hash|
|
220
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
221
|
+
end
|
222
|
+
elsif value.respond_to? :to_hash
|
223
|
+
value.to_hash
|
224
|
+
else
|
225
|
+
value
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
end
|
230
|
+
end
|
@@ -0,0 +1,242 @@
|
|
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 CallTarget
|
21
|
+
# The type of call
|
22
|
+
attr_accessor :type
|
23
|
+
|
24
|
+
# The id of the station or an E.164 formatted phone number
|
25
|
+
attr_accessor :value
|
26
|
+
|
27
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
28
|
+
def self.attribute_map
|
29
|
+
{
|
30
|
+
|
31
|
+
:'type' => :'type',
|
32
|
+
|
33
|
+
:'value' => :'value'
|
34
|
+
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.swagger_types
|
40
|
+
{
|
41
|
+
|
42
|
+
:'type' => :'String',
|
43
|
+
|
44
|
+
:'value' => :'String'
|
45
|
+
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
return unless attributes.is_a?(Hash)
|
53
|
+
|
54
|
+
# convert string to symbol for hash key
|
55
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
56
|
+
|
57
|
+
|
58
|
+
if attributes.has_key?(:'type')
|
59
|
+
|
60
|
+
|
61
|
+
self.type = attributes[:'type']
|
62
|
+
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
if attributes.has_key?(:'value')
|
68
|
+
|
69
|
+
|
70
|
+
self.value = attributes[:'value']
|
71
|
+
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
79
|
+
# @return Array for valid properies with the reasons
|
80
|
+
def list_invalid_properties
|
81
|
+
invalid_properties = Array.new
|
82
|
+
|
83
|
+
|
84
|
+
return invalid_properties
|
85
|
+
end
|
86
|
+
|
87
|
+
# Check to see if the all the properties in the model are valid
|
88
|
+
# @return true if the model is valid
|
89
|
+
def valid?
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
allowed_values = ["STATION", "PHONENUMBER"]
|
94
|
+
if @type && !allowed_values.include?(@type)
|
95
|
+
return false
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
# Custom attribute writer method checking allowed values (enum).
|
109
|
+
# @param [Object] type Object to be assigned
|
110
|
+
def type=(type)
|
111
|
+
allowed_values = ["STATION", "PHONENUMBER"]
|
112
|
+
if type && !allowed_values.include?(type)
|
113
|
+
fail ArgumentError, "invalid value for 'type', must be one of #{allowed_values}."
|
114
|
+
end
|
115
|
+
@type = type
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
# Checks equality by comparing each attribute.
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def ==(o)
|
129
|
+
return true if self.equal?(o)
|
130
|
+
self.class == o.class &&
|
131
|
+
type == o.type &&
|
132
|
+
value == o.value
|
133
|
+
end
|
134
|
+
|
135
|
+
# @see the `==` method
|
136
|
+
# @param [Object] Object to be compared
|
137
|
+
def eql?(o)
|
138
|
+
self == o
|
139
|
+
end
|
140
|
+
|
141
|
+
# Calculates hash code according to all attributes.
|
142
|
+
# @return [Fixnum] Hash code
|
143
|
+
def hash
|
144
|
+
[type, value].hash
|
145
|
+
end
|
146
|
+
|
147
|
+
# build the object from hash
|
148
|
+
def build_from_hash(attributes)
|
149
|
+
return nil unless attributes.is_a?(Hash)
|
150
|
+
self.class.swagger_types.each_pair do |key, type|
|
151
|
+
if type =~ /^Array<(.*)>/i
|
152
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
153
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
154
|
+
else
|
155
|
+
#TODO show warning in debug mode
|
156
|
+
end
|
157
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
158
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
159
|
+
else
|
160
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
self
|
165
|
+
end
|
166
|
+
|
167
|
+
def _deserialize(type, value)
|
168
|
+
case type.to_sym
|
169
|
+
when :DateTime
|
170
|
+
DateTime.parse(value)
|
171
|
+
when :Date
|
172
|
+
Date.parse(value)
|
173
|
+
when :String
|
174
|
+
value.to_s
|
175
|
+
when :Integer
|
176
|
+
value.to_i
|
177
|
+
when :Float
|
178
|
+
value.to_f
|
179
|
+
when :BOOLEAN
|
180
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
181
|
+
true
|
182
|
+
else
|
183
|
+
false
|
184
|
+
end
|
185
|
+
when :Object
|
186
|
+
# generic object (usually a Hash), return directly
|
187
|
+
value
|
188
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
189
|
+
inner_type = Regexp.last_match[:inner_type]
|
190
|
+
value.map { |v| _deserialize(inner_type, v) }
|
191
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
192
|
+
k_type = Regexp.last_match[:k_type]
|
193
|
+
v_type = Regexp.last_match[:v_type]
|
194
|
+
{}.tap do |hash|
|
195
|
+
value.each do |k, v|
|
196
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
else # model
|
200
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
201
|
+
_model.build_from_hash(value)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def to_s
|
206
|
+
to_hash.to_s
|
207
|
+
end
|
208
|
+
|
209
|
+
# to_body is an alias to to_body (backward compatibility))
|
210
|
+
def to_body
|
211
|
+
to_hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# return the object in the form of hash
|
215
|
+
def to_hash
|
216
|
+
hash = {}
|
217
|
+
self.class.attribute_map.each_pair do |attr, param|
|
218
|
+
value = self.send(attr)
|
219
|
+
next if value.nil?
|
220
|
+
hash[param] = _to_hash(value)
|
221
|
+
end
|
222
|
+
hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Method to output non-array value in the form of hash
|
226
|
+
# For object, use to_hash. Otherwise, just return the value
|
227
|
+
def _to_hash(value)
|
228
|
+
if value.is_a?(Array)
|
229
|
+
value.compact.map{ |v| _to_hash(v) }
|
230
|
+
elsif value.is_a?(Hash)
|
231
|
+
{}.tap do |hash|
|
232
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
233
|
+
end
|
234
|
+
elsif value.respond_to? :to_hash
|
235
|
+
value.to_hash
|
236
|
+
else
|
237
|
+
value
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|
242
|
+
end
|