purecloud 0.37.1 → 0.38.1
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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/config-ruby.json +1 -1
- data/doc_out/AuthorizationApi.html.md +57 -0
- data/doc_out/AuthzGrant.html.md +15 -0
- data/doc_out/AuthzGrantPolicy.html.md +16 -0
- data/doc_out/AuthzGrantRole.html.md +17 -0
- data/doc_out/AuthzObject.html.md +17 -0
- data/doc_out/AuthzPermissionContext.html.md +14 -0
- data/doc_out/AuthzSubject.html.md +16 -0
- data/doc_out/CreateUser.html.md +0 -1
- data/doc_out/ExportUri.html.md +14 -0
- data/doc_out/FaxSendRequest.html.md +5 -5
- data/doc_out/GroupsApi.html.md +119 -0
- data/doc_out/JsonNode.html.md +2 -2
- data/doc_out/Location.html.md +20 -0
- data/doc_out/LocationAddress.html.md +19 -0
- data/doc_out/LocationEmergencyNumber.html.md +15 -0
- data/doc_out/LocationsApi.html.md +249 -0
- data/doc_out/ObjectsApi.html.md +69 -0
- data/doc_out/OrganizationCreate.html.md +5 -5
- data/doc_out/OutboundApi.html.md +122 -0
- data/doc_out/SearchApi.html.md +254 -12
- data/doc_out/SuggestApi.html.md +254 -0
- data/doc_out/User.html.md +1 -1
- data/doc_out/UserMe.html.md +1 -1
- data/doc_out/UserPresence.html.md +1 -0
- data/doc_out/index.html.md +3 -3
- data/lib/purecloud.rb +13 -1
- data/lib/purecloud/api/authorization_api.rb +60 -0
- data/lib/purecloud/api/groups_api.rb +126 -0
- data/lib/purecloud/api/locations_api.rb +273 -0
- data/lib/purecloud/api/objects_api.rb +87 -0
- data/lib/purecloud/api/outbound_api.rb +126 -0
- data/lib/purecloud/api/search_api.rb +259 -14
- data/lib/purecloud/api/suggest_api.rb +272 -0
- data/lib/purecloud/api_client.rb +1 -1
- data/lib/purecloud/models/authz_grant.rb +186 -0
- data/lib/purecloud/models/authz_grant_policy.rb +197 -0
- data/lib/purecloud/models/authz_grant_role.rb +209 -0
- data/lib/purecloud/models/authz_object.rb +210 -0
- data/lib/purecloud/models/authz_permission_context.rb +175 -0
- data/lib/purecloud/models/authz_subject.rb +199 -0
- data/lib/purecloud/models/callback.rb +1 -1
- data/lib/purecloud/models/create_user.rb +4 -15
- data/lib/purecloud/models/export_uri.rb +176 -0
- data/lib/purecloud/models/fax_send_request.rb +21 -7
- data/lib/purecloud/models/group.rb +1 -1
- data/lib/purecloud/models/json_node.rb +25 -25
- data/lib/purecloud/models/location.rb +249 -0
- data/lib/purecloud/models/location_address.rb +225 -0
- data/lib/purecloud/models/location_emergency_number.rb +195 -0
- data/lib/purecloud/models/organization_create.rb +5 -5
- data/lib/purecloud/models/search_criteria.rb +1 -1
- data/lib/purecloud/models/user.rb +1 -1
- data/lib/purecloud/models/user_me.rb +1 -1
- data/lib/purecloud/models/user_presence.rb +12 -1
- data/lib/purecloud/version.rb +1 -1
- data/newVersion.md +1 -1
- data/swagger.json +1 -1
- data/version.json +1 -1
- metadata +28 -4
- data/doc_out/ExternalContactsApi.html.md +0 -1594
- data/lib/purecloud/api/external_contacts_api.rb +0 -1679
@@ -0,0 +1,175 @@
|
|
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@inin.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 AuthzPermissionContext
|
21
|
+
attr_accessor :context_id
|
22
|
+
|
23
|
+
attr_accessor :type
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
|
29
|
+
:'context_id' => :'contextId',
|
30
|
+
|
31
|
+
:'type' => :'type'
|
32
|
+
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.swagger_types
|
38
|
+
{
|
39
|
+
:'context_id' => :'String',
|
40
|
+
:'type' => :'String'
|
41
|
+
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def initialize(attributes = {})
|
46
|
+
return unless attributes.is_a?(Hash)
|
47
|
+
|
48
|
+
# convert string to symbol for hash key
|
49
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
50
|
+
|
51
|
+
|
52
|
+
if attributes[:'contextId']
|
53
|
+
self.context_id = attributes[:'contextId']
|
54
|
+
end
|
55
|
+
|
56
|
+
if attributes[:'type']
|
57
|
+
self.type = attributes[:'type']
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
# Check equality by comparing each attribute.
|
63
|
+
def ==(o)
|
64
|
+
return true if self.equal?(o)
|
65
|
+
self.class == o.class &&
|
66
|
+
context_id == o.context_id &&
|
67
|
+
type == o.type
|
68
|
+
end
|
69
|
+
|
70
|
+
# @see the `==` method
|
71
|
+
def eql?(o)
|
72
|
+
self == o
|
73
|
+
end
|
74
|
+
|
75
|
+
# Calculate hash code according to all attributes.
|
76
|
+
def hash
|
77
|
+
[context_id, type].hash
|
78
|
+
end
|
79
|
+
|
80
|
+
# build the object from hash
|
81
|
+
def build_from_hash(attributes)
|
82
|
+
return nil unless attributes.is_a?(Hash)
|
83
|
+
self.class.swagger_types.each_pair do |key, type|
|
84
|
+
if type =~ /^Array<(.*)>/i
|
85
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
86
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
87
|
+
else
|
88
|
+
#TODO show warning in debug mode
|
89
|
+
end
|
90
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
91
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
92
|
+
else
|
93
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
self
|
98
|
+
end
|
99
|
+
|
100
|
+
def _deserialize(type, value)
|
101
|
+
case type.to_sym
|
102
|
+
when :DateTime
|
103
|
+
DateTime.parse(value)
|
104
|
+
when :Date
|
105
|
+
Date.parse(value)
|
106
|
+
when :String
|
107
|
+
value.to_s
|
108
|
+
when :Integer
|
109
|
+
value.to_i
|
110
|
+
when :Float
|
111
|
+
value.to_f
|
112
|
+
when :BOOLEAN
|
113
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
114
|
+
true
|
115
|
+
else
|
116
|
+
false
|
117
|
+
end
|
118
|
+
when :Object
|
119
|
+
# generic object (usually a Hash), return directly
|
120
|
+
value
|
121
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
122
|
+
inner_type = Regexp.last_match[:inner_type]
|
123
|
+
value.map { |v| _deserialize(inner_type, v) }
|
124
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
125
|
+
k_type = Regexp.last_match[:k_type]
|
126
|
+
v_type = Regexp.last_match[:v_type]
|
127
|
+
{}.tap do |hash|
|
128
|
+
value.each do |k, v|
|
129
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
else # model
|
133
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
134
|
+
_model.build_from_hash(value)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def to_s
|
139
|
+
to_hash.to_s
|
140
|
+
end
|
141
|
+
|
142
|
+
# to_body is an alias to to_body (backward compatibility))
|
143
|
+
def to_body
|
144
|
+
to_hash
|
145
|
+
end
|
146
|
+
|
147
|
+
# return the object in the form of hash
|
148
|
+
def to_hash
|
149
|
+
hash = {}
|
150
|
+
self.class.attribute_map.each_pair do |attr, param|
|
151
|
+
value = self.send(attr)
|
152
|
+
next if value.nil?
|
153
|
+
hash[param] = _to_hash(value)
|
154
|
+
end
|
155
|
+
hash
|
156
|
+
end
|
157
|
+
|
158
|
+
# Method to output non-array value in the form of hash
|
159
|
+
# For object, use to_hash. Otherwise, just return the value
|
160
|
+
def _to_hash(value)
|
161
|
+
if value.is_a?(Array)
|
162
|
+
value.compact.map{ |v| _to_hash(v) }
|
163
|
+
elsif value.is_a?(Hash)
|
164
|
+
{}.tap do |hash|
|
165
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
166
|
+
end
|
167
|
+
elsif value.respond_to? :to_hash
|
168
|
+
value.to_hash
|
169
|
+
else
|
170
|
+
value
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
end
|
@@ -0,0 +1,199 @@
|
|
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@inin.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 AuthzSubject
|
21
|
+
# The globally unique identifier for the object.
|
22
|
+
attr_accessor :id
|
23
|
+
|
24
|
+
attr_accessor :name
|
25
|
+
|
26
|
+
attr_accessor :grants
|
27
|
+
|
28
|
+
# The URI for this object
|
29
|
+
attr_accessor :self_uri
|
30
|
+
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
+
def self.attribute_map
|
33
|
+
{
|
34
|
+
|
35
|
+
:'id' => :'id',
|
36
|
+
|
37
|
+
:'name' => :'name',
|
38
|
+
|
39
|
+
:'grants' => :'grants',
|
40
|
+
|
41
|
+
:'self_uri' => :'selfUri'
|
42
|
+
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Attribute type mapping.
|
47
|
+
def self.swagger_types
|
48
|
+
{
|
49
|
+
:'id' => :'String',
|
50
|
+
:'name' => :'String',
|
51
|
+
:'grants' => :'Array<AuthzGrant>',
|
52
|
+
:'self_uri' => :'String'
|
53
|
+
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def initialize(attributes = {})
|
58
|
+
return unless attributes.is_a?(Hash)
|
59
|
+
|
60
|
+
# convert string to symbol for hash key
|
61
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
62
|
+
|
63
|
+
|
64
|
+
if attributes[:'id']
|
65
|
+
self.id = attributes[:'id']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes[:'name']
|
69
|
+
self.name = attributes[:'name']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes[:'grants']
|
73
|
+
if (value = attributes[:'grants']).is_a?(Array)
|
74
|
+
self.grants = value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes[:'selfUri']
|
79
|
+
self.self_uri = attributes[:'selfUri']
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check equality by comparing each attribute.
|
85
|
+
def ==(o)
|
86
|
+
return true if self.equal?(o)
|
87
|
+
self.class == o.class &&
|
88
|
+
id == o.id &&
|
89
|
+
name == o.name &&
|
90
|
+
grants == o.grants &&
|
91
|
+
self_uri == o.self_uri
|
92
|
+
end
|
93
|
+
|
94
|
+
# @see the `==` method
|
95
|
+
def eql?(o)
|
96
|
+
self == o
|
97
|
+
end
|
98
|
+
|
99
|
+
# Calculate hash code according to all attributes.
|
100
|
+
def hash
|
101
|
+
[id, name, grants, self_uri].hash
|
102
|
+
end
|
103
|
+
|
104
|
+
# build the object from hash
|
105
|
+
def build_from_hash(attributes)
|
106
|
+
return nil unless attributes.is_a?(Hash)
|
107
|
+
self.class.swagger_types.each_pair do |key, type|
|
108
|
+
if type =~ /^Array<(.*)>/i
|
109
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
110
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
111
|
+
else
|
112
|
+
#TODO show warning in debug mode
|
113
|
+
end
|
114
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
115
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
116
|
+
else
|
117
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
self
|
122
|
+
end
|
123
|
+
|
124
|
+
def _deserialize(type, value)
|
125
|
+
case type.to_sym
|
126
|
+
when :DateTime
|
127
|
+
DateTime.parse(value)
|
128
|
+
when :Date
|
129
|
+
Date.parse(value)
|
130
|
+
when :String
|
131
|
+
value.to_s
|
132
|
+
when :Integer
|
133
|
+
value.to_i
|
134
|
+
when :Float
|
135
|
+
value.to_f
|
136
|
+
when :BOOLEAN
|
137
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
138
|
+
true
|
139
|
+
else
|
140
|
+
false
|
141
|
+
end
|
142
|
+
when :Object
|
143
|
+
# generic object (usually a Hash), return directly
|
144
|
+
value
|
145
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
146
|
+
inner_type = Regexp.last_match[:inner_type]
|
147
|
+
value.map { |v| _deserialize(inner_type, v) }
|
148
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
149
|
+
k_type = Regexp.last_match[:k_type]
|
150
|
+
v_type = Regexp.last_match[:v_type]
|
151
|
+
{}.tap do |hash|
|
152
|
+
value.each do |k, v|
|
153
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
else # model
|
157
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
158
|
+
_model.build_from_hash(value)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def to_s
|
163
|
+
to_hash.to_s
|
164
|
+
end
|
165
|
+
|
166
|
+
# to_body is an alias to to_body (backward compatibility))
|
167
|
+
def to_body
|
168
|
+
to_hash
|
169
|
+
end
|
170
|
+
|
171
|
+
# return the object in the form of hash
|
172
|
+
def to_hash
|
173
|
+
hash = {}
|
174
|
+
self.class.attribute_map.each_pair do |attr, param|
|
175
|
+
value = self.send(attr)
|
176
|
+
next if value.nil?
|
177
|
+
hash[param] = _to_hash(value)
|
178
|
+
end
|
179
|
+
hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# Method to output non-array value in the form of hash
|
183
|
+
# For object, use to_hash. Otherwise, just return the value
|
184
|
+
def _to_hash(value)
|
185
|
+
if value.is_a?(Array)
|
186
|
+
value.compact.map{ |v| _to_hash(v) }
|
187
|
+
elsif value.is_a?(Hash)
|
188
|
+
{}.tap do |hash|
|
189
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
190
|
+
end
|
191
|
+
elsif value.respond_to? :to_hash
|
192
|
+
value.to_hash
|
193
|
+
else
|
194
|
+
value
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
end
|
@@ -189,7 +189,7 @@ module PureCloud
|
|
189
189
|
|
190
190
|
# Custom attribute writer method checking allowed values (enum).
|
191
191
|
def state=(state)
|
192
|
-
allowed_values = ["ALERTING", "DIALING", "CONTACTING", "OFFERING", "CONNECTED", "DISCONNECTED", "TERMINATED", "NONE"]
|
192
|
+
allowed_values = ["ALERTING", "DIALING", "CONTACTING", "OFFERING", "CONNECTED", "DISCONNECTED", "TERMINATED", "SCHEDULED", "NONE"]
|
193
193
|
if state && !allowed_values.include?(state)
|
194
194
|
fail "invalid value for 'state', must be one of #{allowed_values}"
|
195
195
|
end
|
@@ -33,9 +33,6 @@ module PureCloud
|
|
33
33
|
# User's password
|
34
34
|
attr_accessor :password
|
35
35
|
|
36
|
-
# Use version number 1 when creating
|
37
|
-
attr_accessor :version
|
38
|
-
|
39
36
|
# Attribute mapping from ruby-style variable name to JSON key.
|
40
37
|
def self.attribute_map
|
41
38
|
{
|
@@ -50,9 +47,7 @@ module PureCloud
|
|
50
47
|
|
51
48
|
:'title' => :'title',
|
52
49
|
|
53
|
-
:'password' => :'password'
|
54
|
-
|
55
|
-
:'version' => :'version'
|
50
|
+
:'password' => :'password'
|
56
51
|
|
57
52
|
}
|
58
53
|
end
|
@@ -65,8 +60,7 @@ module PureCloud
|
|
65
60
|
:'email' => :'String',
|
66
61
|
:'addresses' => :'Array<Contact>',
|
67
62
|
:'title' => :'String',
|
68
|
-
:'password' => :'String'
|
69
|
-
:'version' => :'String'
|
63
|
+
:'password' => :'String'
|
70
64
|
|
71
65
|
}
|
72
66
|
end
|
@@ -104,10 +98,6 @@ module PureCloud
|
|
104
98
|
self.password = attributes[:'password']
|
105
99
|
end
|
106
100
|
|
107
|
-
if attributes[:'version']
|
108
|
-
self.version = attributes[:'version']
|
109
|
-
end
|
110
|
-
|
111
101
|
end
|
112
102
|
|
113
103
|
# Check equality by comparing each attribute.
|
@@ -119,8 +109,7 @@ module PureCloud
|
|
119
109
|
email == o.email &&
|
120
110
|
addresses == o.addresses &&
|
121
111
|
title == o.title &&
|
122
|
-
password == o.password
|
123
|
-
version == o.version
|
112
|
+
password == o.password
|
124
113
|
end
|
125
114
|
|
126
115
|
# @see the `==` method
|
@@ -130,7 +119,7 @@ module PureCloud
|
|
130
119
|
|
131
120
|
# Calculate hash code according to all attributes.
|
132
121
|
def hash
|
133
|
-
[name, department, email, addresses, title, password
|
122
|
+
[name, department, email, addresses, title, password].hash
|
134
123
|
end
|
135
124
|
|
136
125
|
# build the object from hash
|
@@ -0,0 +1,176 @@
|
|
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@inin.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 ExportUri
|
21
|
+
attr_accessor :uri
|
22
|
+
|
23
|
+
# Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ
|
24
|
+
attr_accessor :export_timestamp
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
|
30
|
+
:'uri' => :'uri',
|
31
|
+
|
32
|
+
:'export_timestamp' => :'exportTimestamp'
|
33
|
+
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'uri' => :'String',
|
41
|
+
:'export_timestamp' => :'DateTime'
|
42
|
+
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def initialize(attributes = {})
|
47
|
+
return unless attributes.is_a?(Hash)
|
48
|
+
|
49
|
+
# convert string to symbol for hash key
|
50
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
51
|
+
|
52
|
+
|
53
|
+
if attributes[:'uri']
|
54
|
+
self.uri = attributes[:'uri']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes[:'exportTimestamp']
|
58
|
+
self.export_timestamp = attributes[:'exportTimestamp']
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
# Check equality by comparing each attribute.
|
64
|
+
def ==(o)
|
65
|
+
return true if self.equal?(o)
|
66
|
+
self.class == o.class &&
|
67
|
+
uri == o.uri &&
|
68
|
+
export_timestamp == o.export_timestamp
|
69
|
+
end
|
70
|
+
|
71
|
+
# @see the `==` method
|
72
|
+
def eql?(o)
|
73
|
+
self == o
|
74
|
+
end
|
75
|
+
|
76
|
+
# Calculate hash code according to all attributes.
|
77
|
+
def hash
|
78
|
+
[uri, export_timestamp].hash
|
79
|
+
end
|
80
|
+
|
81
|
+
# build the object from hash
|
82
|
+
def build_from_hash(attributes)
|
83
|
+
return nil unless attributes.is_a?(Hash)
|
84
|
+
self.class.swagger_types.each_pair do |key, type|
|
85
|
+
if type =~ /^Array<(.*)>/i
|
86
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
87
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
88
|
+
else
|
89
|
+
#TODO show warning in debug mode
|
90
|
+
end
|
91
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
92
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
93
|
+
else
|
94
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
self
|
99
|
+
end
|
100
|
+
|
101
|
+
def _deserialize(type, value)
|
102
|
+
case type.to_sym
|
103
|
+
when :DateTime
|
104
|
+
DateTime.parse(value)
|
105
|
+
when :Date
|
106
|
+
Date.parse(value)
|
107
|
+
when :String
|
108
|
+
value.to_s
|
109
|
+
when :Integer
|
110
|
+
value.to_i
|
111
|
+
when :Float
|
112
|
+
value.to_f
|
113
|
+
when :BOOLEAN
|
114
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
115
|
+
true
|
116
|
+
else
|
117
|
+
false
|
118
|
+
end
|
119
|
+
when :Object
|
120
|
+
# generic object (usually a Hash), return directly
|
121
|
+
value
|
122
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
123
|
+
inner_type = Regexp.last_match[:inner_type]
|
124
|
+
value.map { |v| _deserialize(inner_type, v) }
|
125
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
126
|
+
k_type = Regexp.last_match[:k_type]
|
127
|
+
v_type = Regexp.last_match[:v_type]
|
128
|
+
{}.tap do |hash|
|
129
|
+
value.each do |k, v|
|
130
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
else # model
|
134
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
135
|
+
_model.build_from_hash(value)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def to_s
|
140
|
+
to_hash.to_s
|
141
|
+
end
|
142
|
+
|
143
|
+
# to_body is an alias to to_body (backward compatibility))
|
144
|
+
def to_body
|
145
|
+
to_hash
|
146
|
+
end
|
147
|
+
|
148
|
+
# return the object in the form of hash
|
149
|
+
def to_hash
|
150
|
+
hash = {}
|
151
|
+
self.class.attribute_map.each_pair do |attr, param|
|
152
|
+
value = self.send(attr)
|
153
|
+
next if value.nil?
|
154
|
+
hash[param] = _to_hash(value)
|
155
|
+
end
|
156
|
+
hash
|
157
|
+
end
|
158
|
+
|
159
|
+
# Method to output non-array value in the form of hash
|
160
|
+
# For object, use to_hash. Otherwise, just return the value
|
161
|
+
def _to_hash(value)
|
162
|
+
if value.is_a?(Array)
|
163
|
+
value.compact.map{ |v| _to_hash(v) }
|
164
|
+
elsif value.is_a?(Hash)
|
165
|
+
{}.tap do |hash|
|
166
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
167
|
+
end
|
168
|
+
elsif value.respond_to? :to_hash
|
169
|
+
value.to_hash
|
170
|
+
else
|
171
|
+
value
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
end
|