purecloud 0.18.0 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/Gemfile.lock +2 -2
- data/README.md +1 -7
- data/config-ruby.json +1 -1
- data/extensions/auth.rb +2 -2
- data/lib/purecloud.rb +110 -75
- data/lib/purecloud/api/architect_api.rb +3127 -74
- data/lib/purecloud/api/attributes_api.rb +33 -33
- data/lib/purecloud/api/authorization_api.rb +83 -83
- data/lib/purecloud/api/compliance_api.rb +5 -5
- data/lib/purecloud/api/configuration_api.rb +594 -397
- data/lib/purecloud/api/content_management_api.rb +183 -183
- data/lib/purecloud/api/conversations_api.rb +289 -159
- data/lib/purecloud/api/downloads_api.rb +6 -6
- data/lib/purecloud/api/external_contacts_api.rb +1693 -0
- data/lib/purecloud/api/fax_api.rb +24 -24
- data/lib/purecloud/api/geolocation_api.rb +14 -14
- data/lib/purecloud/api/greetings_api.rb +68 -68
- data/lib/purecloud/api/groups_api.rb +31 -20
- data/lib/purecloud/api/languages_api.rb +18 -11
- data/lib/purecloud/api/licensing_api.rb +5 -5
- data/lib/purecloud/api/locations_api.rb +11 -11
- data/lib/purecloud/api/notifications_api.rb +41 -41
- data/lib/purecloud/api/o_auth_api.rb +69 -69
- data/lib/purecloud/api/outbound_api.rb +505 -325
- data/lib/purecloud/api/presence_api.rb +65 -65
- data/lib/purecloud/api/quality_api.rb +66 -639
- data/lib/purecloud/api/recording_api.rb +1343 -0
- data/lib/purecloud/api/response_management_api.rb +687 -0
- data/lib/purecloud/api/routing_api.rb +224 -170
- data/lib/purecloud/api/scripts_api.rb +52 -52
- data/lib/purecloud/api/search_api.rb +5 -5
- data/lib/purecloud/api/stations_api.rb +8 -8
- data/lib/purecloud/api/telephony_providers_edge_api.rb +138 -138
- data/lib/purecloud/api/user_recordings_api.rb +29 -29
- data/lib/purecloud/api/users_api.rb +123 -123
- data/lib/purecloud/api/utilities_api.rb +71 -15
- data/lib/purecloud/api/voicemail_api.rb +42 -42
- data/lib/purecloud/api_client.rb +1 -1
- data/lib/purecloud/models/address.rb +49 -51
- data/lib/purecloud/models/attribute_filter_item.rb +177 -0
- data/lib/purecloud/models/automate_queue_member_entity_listing.rb +238 -0
- data/lib/purecloud/models/available_additional_service.rb +40 -1
- data/lib/purecloud/models/{topic_entity_listing.rb → available_topic_entity_listing.rb} +1 -1
- data/lib/purecloud/models/call.rb +36 -5
- data/lib/purecloud/models/{line_properties.rb → call_command.rb} +13 -3
- data/lib/purecloud/models/callback.rb +15 -4
- data/lib/purecloud/models/campaign.rb +219 -17
- data/lib/purecloud/models/campaign_progress.rb +186 -0
- data/lib/purecloud/models/channel_topic_entity_listing.rb +238 -0
- data/lib/purecloud/models/charge.rb +14 -4
- data/lib/purecloud/models/{attribute_value.rb → client_text_table_transform.rb} +52 -82
- data/lib/purecloud/models/contact.rb +1 -1
- data/lib/purecloud/models/contact_list.rb +111 -1
- data/lib/purecloud/models/contact_listing.rb +238 -0
- data/lib/purecloud/models/content_attribute_filter_item.rb +177 -0
- data/lib/purecloud/models/content_facet_filter_item.rb +1 -1
- data/lib/purecloud/models/content_query_request.rb +16 -4
- data/lib/purecloud/models/control.rb +221 -0
- data/lib/purecloud/models/{flow_activate_request.rb → control_options.rb} +18 -12
- data/lib/purecloud/models/create_callback_command.rb +200 -0
- data/lib/purecloud/models/discount.rb +220 -0
- data/lib/purecloud/models/document.rb +13 -1
- data/lib/purecloud/models/document_attribute.rb +158 -0
- data/lib/purecloud/models/document_update.rb +28 -16
- data/lib/purecloud/models/document_upload.rb +4 -16
- data/lib/purecloud/models/domain_voice_rate_extended_response_item_entity_listing.rb +238 -0
- data/lib/purecloud/models/domain_voice_rate_international_response_item_entity_listing.rb +238 -0
- data/lib/purecloud/models/domain_voice_rate_response_item_entity_listing.rb +1 -1
- data/lib/purecloud/models/edge_line.rb +1 -1
- data/lib/purecloud/models/edge_logs_job.rb +181 -0
- data/lib/purecloud/models/edge_logs_job_file.rb +243 -0
- data/lib/purecloud/models/edge_logs_job_request.rb +168 -0
- data/lib/purecloud/models/{backend_work_item_data_element.rb → edge_logs_job_response.rb} +16 -24
- data/lib/purecloud/models/{flow_lock_request.rb → edge_logs_job_upload_request.rb} +10 -12
- data/lib/purecloud/models/email.rb +15 -4
- data/lib/purecloud/models/endpoint.rb +1 -1
- data/lib/purecloud/models/{flow_associate_workspaces_request.rb → estimated_wait_time_predictions.rb} +10 -11
- data/lib/purecloud/models/external_contact.rb +320 -0
- data/lib/purecloud/models/external_organization.rb +306 -0
- data/lib/purecloud/models/external_organization_listing.rb +238 -0
- data/lib/purecloud/models/facet_filter_item.rb +1 -1
- data/lib/purecloud/models/flow_body.rb +1 -1
- data/lib/purecloud/models/flow_body_format.rb +10 -20
- data/lib/purecloud/models/flow_terminate_request.rb +3 -16
- data/lib/purecloud/models/form.rb +148 -0
- data/lib/purecloud/models/group.rb +11 -1
- data/lib/purecloud/models/health_check_info.rb +268 -0
- data/lib/purecloud/models/{body_2.rb → inline_response_200.rb} +1 -1
- data/lib/purecloud/models/integration_type.rb +209 -0
- data/lib/purecloud/models/integration_type_entity_listing.rb +238 -0
- data/lib/purecloud/models/key_rotation_schedule.rb +1 -0
- data/lib/purecloud/models/language.rb +41 -1
- data/lib/purecloud/models/line.rb +1 -1
- data/lib/purecloud/models/line_base.rb +1 -1
- data/lib/purecloud/models/media_policies.rb +169 -0
- data/lib/purecloud/models/media_policy.rb +171 -0
- data/lib/purecloud/models/note.rb +200 -0
- data/lib/purecloud/models/{user_station_resource.rb → note_listing.rb} +68 -58
- data/lib/purecloud/models/o_auth_client.rb +1 -1
- data/lib/purecloud/models/page.rb +2 -2
- data/lib/purecloud/models/{byte_buffer.rb → payment_method.rb} +48 -61
- data/lib/purecloud/models/payment_method_listing.rb +238 -0
- data/lib/purecloud/models/payment_token_provider.rb +180 -0
- data/lib/purecloud/models/phone.rb +1 -1
- data/lib/purecloud/models/phone_base.rb +1 -1
- data/lib/purecloud/models/phone_number.rb +198 -0
- data/lib/purecloud/models/phones_reboot.rb +14 -4
- data/lib/purecloud/models/policy.rb +14 -1
- data/lib/purecloud/models/prediction_results.rb +167 -0
- data/lib/purecloud/models/query_request.rb +16 -4
- data/lib/purecloud/models/queue_member_entity_listing.rb +1 -1
- data/lib/purecloud/models/quote.rb +13 -1
- data/lib/purecloud/models/recording_settings.rb +146 -0
- data/lib/purecloud/models/relationship.rb +201 -0
- data/lib/purecloud/models/relationship_listing.rb +238 -0
- data/lib/purecloud/models/report_schedule.rb +3 -2
- data/lib/purecloud/models/service_type.rb +12 -1
- data/lib/purecloud/models/social_expression.rb +25 -4
- data/lib/purecloud/models/spreadsheet_transform_entity_listing.rb +1 -1
- data/lib/purecloud/models/template.rb +1 -1
- data/lib/purecloud/models/text_table_transform_entity_listing.rb +1 -1
- data/lib/purecloud/models/ticker.rb +158 -0
- data/lib/purecloud/models/time_slot.rb +1 -0
- data/lib/purecloud/models/trunk_base.rb +1 -1
- data/lib/purecloud/models/vendor_connection_request.rb +166 -0
- data/lib/purecloud/models/video.rb +15 -4
- data/lib/purecloud/models/work_item_definition.rb +8 -10
- data/lib/purecloud/version.rb +1 -1
- data/ossindex.json +17 -0
- data/purecloud.gemspec +4 -3
- data/rakefile +3 -15
- data/spec/test.rb +6 -3
- data/swagger.json +1 -1
- data/swagger_template/api_client.mustache +304 -0
- data/swagger_template/base_object.mustache +90 -0
- data/{PureCloud.gemspec → swagger_template/gemspec.mustache} +12 -11
- data/version.json +1 -1
- metadata +76 -25
- data/lib/purecloud/api/analytics_api.rb +0 -1554
- data/lib/purecloud/api/orphaned_recordings_api.rb +0 -205
- data/newVersion.md +0 -1
@@ -7,6 +7,13 @@ module PureCloud
|
|
7
7
|
|
8
8
|
attr_accessor :name
|
9
9
|
|
10
|
+
# Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ
|
11
|
+
attr_accessor :date_modified
|
12
|
+
|
13
|
+
attr_accessor :state
|
14
|
+
|
15
|
+
attr_accessor :version
|
16
|
+
|
10
17
|
# The URI for this object
|
11
18
|
attr_accessor :self_uri
|
12
19
|
|
@@ -18,6 +25,12 @@ module PureCloud
|
|
18
25
|
|
19
26
|
:'name' => :'name',
|
20
27
|
|
28
|
+
:'date_modified' => :'dateModified',
|
29
|
+
|
30
|
+
:'state' => :'state',
|
31
|
+
|
32
|
+
:'version' => :'version',
|
33
|
+
|
21
34
|
:'self_uri' => :'selfUri'
|
22
35
|
|
23
36
|
}
|
@@ -28,6 +41,9 @@ module PureCloud
|
|
28
41
|
{
|
29
42
|
:'id' => :'String',
|
30
43
|
:'name' => :'String',
|
44
|
+
:'date_modified' => :'DateTime',
|
45
|
+
:'state' => :'String',
|
46
|
+
:'version' => :'String',
|
31
47
|
:'self_uri' => :'String'
|
32
48
|
|
33
49
|
}
|
@@ -48,18 +64,42 @@ module PureCloud
|
|
48
64
|
self.name = attributes[:'name']
|
49
65
|
end
|
50
66
|
|
67
|
+
if attributes[:'dateModified']
|
68
|
+
self.date_modified = attributes[:'dateModified']
|
69
|
+
end
|
70
|
+
|
71
|
+
if attributes[:'state']
|
72
|
+
self.state = attributes[:'state']
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes[:'version']
|
76
|
+
self.version = attributes[:'version']
|
77
|
+
end
|
78
|
+
|
51
79
|
if attributes[:'selfUri']
|
52
80
|
self.self_uri = attributes[:'selfUri']
|
53
81
|
end
|
54
82
|
|
55
83
|
end
|
56
84
|
|
85
|
+
# Custom attribute writer method checking allowed values (enum).
|
86
|
+
def state=(state)
|
87
|
+
allowed_values = ["ACTIVE", "INACTIVE", "DELETED"]
|
88
|
+
if state && !allowed_values.include?(state)
|
89
|
+
fail "invalid value for 'state', must be one of #{allowed_values}"
|
90
|
+
end
|
91
|
+
@state = state
|
92
|
+
end
|
93
|
+
|
57
94
|
# Check equality by comparing each attribute.
|
58
95
|
def ==(o)
|
59
96
|
return true if self.equal?(o)
|
60
97
|
self.class == o.class &&
|
61
98
|
id == o.id &&
|
62
99
|
name == o.name &&
|
100
|
+
date_modified == o.date_modified &&
|
101
|
+
state == o.state &&
|
102
|
+
version == o.version &&
|
63
103
|
self_uri == o.self_uri
|
64
104
|
end
|
65
105
|
|
@@ -70,7 +110,7 @@ module PureCloud
|
|
70
110
|
|
71
111
|
# Calculate hash code according to all attributes.
|
72
112
|
def hash
|
73
|
-
[id, name, self_uri].hash
|
113
|
+
[id, name, date_modified, state, version, self_uri].hash
|
74
114
|
end
|
75
115
|
|
76
116
|
# build the object from hash
|
@@ -107,7 +107,7 @@ module PureCloud
|
|
107
107
|
:'state' => :'String',
|
108
108
|
:'modified_by_app' => :'String',
|
109
109
|
:'created_by_app' => :'String',
|
110
|
-
:'properties' => :'Hash<String,
|
110
|
+
:'properties' => :'Hash<String, inline_response_200>',
|
111
111
|
:'edge_group' => :'UriReference',
|
112
112
|
:'template' => :'UriReference',
|
113
113
|
:'site' => :'UriReference',
|
@@ -0,0 +1,169 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module PureCloud
|
4
|
+
class MediaPolicies
|
5
|
+
# Conditions and actions for calls
|
6
|
+
attr_accessor :call_policy
|
7
|
+
|
8
|
+
# Conditions and actions for chats
|
9
|
+
attr_accessor :chat_policy
|
10
|
+
|
11
|
+
# Conditions and actions for emails
|
12
|
+
attr_accessor :email_policy
|
13
|
+
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
15
|
+
def self.attribute_map
|
16
|
+
{
|
17
|
+
|
18
|
+
:'call_policy' => :'callPolicy',
|
19
|
+
|
20
|
+
:'chat_policy' => :'chatPolicy',
|
21
|
+
|
22
|
+
:'email_policy' => :'emailPolicy'
|
23
|
+
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.swagger_types
|
29
|
+
{
|
30
|
+
:'call_policy' => :'MediaPolicy',
|
31
|
+
:'chat_policy' => :'MediaPolicy',
|
32
|
+
:'email_policy' => :'MediaPolicy'
|
33
|
+
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def initialize(attributes = {})
|
38
|
+
return unless attributes.is_a?(Hash)
|
39
|
+
|
40
|
+
# convert string to symbol for hash key
|
41
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
42
|
+
|
43
|
+
|
44
|
+
if attributes[:'callPolicy']
|
45
|
+
self.call_policy = attributes[:'callPolicy']
|
46
|
+
end
|
47
|
+
|
48
|
+
if attributes[:'chatPolicy']
|
49
|
+
self.chat_policy = attributes[:'chatPolicy']
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes[:'emailPolicy']
|
53
|
+
self.email_policy = attributes[:'emailPolicy']
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
# Check equality by comparing each attribute.
|
59
|
+
def ==(o)
|
60
|
+
return true if self.equal?(o)
|
61
|
+
self.class == o.class &&
|
62
|
+
call_policy == o.call_policy &&
|
63
|
+
chat_policy == o.chat_policy &&
|
64
|
+
email_policy == o.email_policy
|
65
|
+
end
|
66
|
+
|
67
|
+
# @see the `==` method
|
68
|
+
def eql?(o)
|
69
|
+
self == o
|
70
|
+
end
|
71
|
+
|
72
|
+
# Calculate hash code according to all attributes.
|
73
|
+
def hash
|
74
|
+
[call_policy, chat_policy, email_policy].hash
|
75
|
+
end
|
76
|
+
|
77
|
+
# build the object from hash
|
78
|
+
def build_from_hash(attributes)
|
79
|
+
return nil unless attributes.is_a?(Hash)
|
80
|
+
self.class.swagger_types.each_pair do |key, type|
|
81
|
+
if type =~ /^Array<(.*)>/i
|
82
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
83
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
84
|
+
else
|
85
|
+
#TODO show warning in debug mode
|
86
|
+
end
|
87
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
88
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
89
|
+
else
|
90
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
self
|
95
|
+
end
|
96
|
+
|
97
|
+
def _deserialize(type, value)
|
98
|
+
case type.to_sym
|
99
|
+
when :DateTime
|
100
|
+
DateTime.parse(value)
|
101
|
+
when :Date
|
102
|
+
Date.parse(value)
|
103
|
+
when :String
|
104
|
+
value.to_s
|
105
|
+
when :Integer
|
106
|
+
value.to_i
|
107
|
+
when :Float
|
108
|
+
value.to_f
|
109
|
+
when :BOOLEAN
|
110
|
+
if value =~ /^(true|t|yes|y|1)$/i
|
111
|
+
true
|
112
|
+
else
|
113
|
+
false
|
114
|
+
end
|
115
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
116
|
+
inner_type = Regexp.last_match[:inner_type]
|
117
|
+
value.map { |v| _deserialize(inner_type, v) }
|
118
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
119
|
+
k_type = Regexp.last_match[:k_type]
|
120
|
+
v_type = Regexp.last_match[:v_type]
|
121
|
+
{}.tap do |hash|
|
122
|
+
value.each do |k, v|
|
123
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
else # model
|
127
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
128
|
+
_model.build_from_hash(value)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def to_s
|
133
|
+
to_hash.to_s
|
134
|
+
end
|
135
|
+
|
136
|
+
# to_body is an alias to to_body (backward compatibility))
|
137
|
+
def to_body
|
138
|
+
to_hash
|
139
|
+
end
|
140
|
+
|
141
|
+
# return the object in the form of hash
|
142
|
+
def to_hash
|
143
|
+
hash = {}
|
144
|
+
self.class.attribute_map.each_pair do |attr, param|
|
145
|
+
value = self.send(attr)
|
146
|
+
next if value.nil?
|
147
|
+
hash[param] = _to_hash(value)
|
148
|
+
end
|
149
|
+
hash
|
150
|
+
end
|
151
|
+
|
152
|
+
# Method to output non-array value in the form of hash
|
153
|
+
# For object, use to_hash. Otherwise, just return the value
|
154
|
+
def _to_hash(value)
|
155
|
+
if value.is_a?(Array)
|
156
|
+
value.compact.map{ |v| _to_hash(v) }
|
157
|
+
elsif value.is_a?(Hash)
|
158
|
+
{}.tap do |hash|
|
159
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
160
|
+
end
|
161
|
+
elsif value.respond_to? :to_hash
|
162
|
+
value.to_hash
|
163
|
+
else
|
164
|
+
value
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module PureCloud
|
4
|
+
class MediaPolicy
|
5
|
+
# When conditions are evaluation and actions applied
|
6
|
+
attr_accessor :evaluation_criteria
|
7
|
+
|
8
|
+
# Conditions for when actions should be applied
|
9
|
+
attr_accessor :conditions
|
10
|
+
|
11
|
+
# Actions applied when specified conditions are met
|
12
|
+
attr_accessor :actions
|
13
|
+
|
14
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
15
|
+
def self.attribute_map
|
16
|
+
{
|
17
|
+
|
18
|
+
:'evaluation_criteria' => :'evaluationCriteria',
|
19
|
+
|
20
|
+
:'conditions' => :'conditions',
|
21
|
+
|
22
|
+
:'actions' => :'actions'
|
23
|
+
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.swagger_types
|
29
|
+
{
|
30
|
+
:'evaluation_criteria' => :'Array<String>',
|
31
|
+
:'conditions' => :'PolicyConditions',
|
32
|
+
:'actions' => :'PolicyActions'
|
33
|
+
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def initialize(attributes = {})
|
38
|
+
return unless attributes.is_a?(Hash)
|
39
|
+
|
40
|
+
# convert string to symbol for hash key
|
41
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
42
|
+
|
43
|
+
|
44
|
+
if attributes[:'evaluationCriteria']
|
45
|
+
if (value = attributes[:'evaluationCriteria']).is_a?(Array)
|
46
|
+
self.evaluation_criteria = value
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes[:'conditions']
|
51
|
+
self.conditions = attributes[:'conditions']
|
52
|
+
end
|
53
|
+
|
54
|
+
if attributes[:'actions']
|
55
|
+
self.actions = attributes[:'actions']
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
# Check equality by comparing each attribute.
|
61
|
+
def ==(o)
|
62
|
+
return true if self.equal?(o)
|
63
|
+
self.class == o.class &&
|
64
|
+
evaluation_criteria == o.evaluation_criteria &&
|
65
|
+
conditions == o.conditions &&
|
66
|
+
actions == o.actions
|
67
|
+
end
|
68
|
+
|
69
|
+
# @see the `==` method
|
70
|
+
def eql?(o)
|
71
|
+
self == o
|
72
|
+
end
|
73
|
+
|
74
|
+
# Calculate hash code according to all attributes.
|
75
|
+
def hash
|
76
|
+
[evaluation_criteria, conditions, actions].hash
|
77
|
+
end
|
78
|
+
|
79
|
+
# build the object from hash
|
80
|
+
def build_from_hash(attributes)
|
81
|
+
return nil unless attributes.is_a?(Hash)
|
82
|
+
self.class.swagger_types.each_pair do |key, type|
|
83
|
+
if type =~ /^Array<(.*)>/i
|
84
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
85
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
86
|
+
else
|
87
|
+
#TODO show warning in debug mode
|
88
|
+
end
|
89
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
90
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
91
|
+
else
|
92
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
self
|
97
|
+
end
|
98
|
+
|
99
|
+
def _deserialize(type, value)
|
100
|
+
case type.to_sym
|
101
|
+
when :DateTime
|
102
|
+
DateTime.parse(value)
|
103
|
+
when :Date
|
104
|
+
Date.parse(value)
|
105
|
+
when :String
|
106
|
+
value.to_s
|
107
|
+
when :Integer
|
108
|
+
value.to_i
|
109
|
+
when :Float
|
110
|
+
value.to_f
|
111
|
+
when :BOOLEAN
|
112
|
+
if value =~ /^(true|t|yes|y|1)$/i
|
113
|
+
true
|
114
|
+
else
|
115
|
+
false
|
116
|
+
end
|
117
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
118
|
+
inner_type = Regexp.last_match[:inner_type]
|
119
|
+
value.map { |v| _deserialize(inner_type, v) }
|
120
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
121
|
+
k_type = Regexp.last_match[:k_type]
|
122
|
+
v_type = Regexp.last_match[:v_type]
|
123
|
+
{}.tap do |hash|
|
124
|
+
value.each do |k, v|
|
125
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
else # model
|
129
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
130
|
+
_model.build_from_hash(value)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def to_s
|
135
|
+
to_hash.to_s
|
136
|
+
end
|
137
|
+
|
138
|
+
# to_body is an alias to to_body (backward compatibility))
|
139
|
+
def to_body
|
140
|
+
to_hash
|
141
|
+
end
|
142
|
+
|
143
|
+
# return the object in the form of hash
|
144
|
+
def to_hash
|
145
|
+
hash = {}
|
146
|
+
self.class.attribute_map.each_pair do |attr, param|
|
147
|
+
value = self.send(attr)
|
148
|
+
next if value.nil?
|
149
|
+
hash[param] = _to_hash(value)
|
150
|
+
end
|
151
|
+
hash
|
152
|
+
end
|
153
|
+
|
154
|
+
# Method to output non-array value in the form of hash
|
155
|
+
# For object, use to_hash. Otherwise, just return the value
|
156
|
+
def _to_hash(value)
|
157
|
+
if value.is_a?(Array)
|
158
|
+
value.compact.map{ |v| _to_hash(v) }
|
159
|
+
elsif value.is_a?(Hash)
|
160
|
+
{}.tap do |hash|
|
161
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
162
|
+
end
|
163
|
+
elsif value.respond_to? :to_hash
|
164
|
+
value.to_hash
|
165
|
+
else
|
166
|
+
value
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
171
|
+
end
|