purecloud 0.37.1 → 0.38.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,197 @@
|
|
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 AuthzGrantPolicy
|
21
|
+
attr_accessor :actions
|
22
|
+
|
23
|
+
attr_accessor :condition
|
24
|
+
|
25
|
+
attr_accessor :domain
|
26
|
+
|
27
|
+
attr_accessor :entity_name
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
|
33
|
+
:'actions' => :'actions',
|
34
|
+
|
35
|
+
:'condition' => :'condition',
|
36
|
+
|
37
|
+
:'domain' => :'domain',
|
38
|
+
|
39
|
+
:'entity_name' => :'entityName'
|
40
|
+
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# Attribute type mapping.
|
45
|
+
def self.swagger_types
|
46
|
+
{
|
47
|
+
:'actions' => :'Array<String>',
|
48
|
+
:'condition' => :'String',
|
49
|
+
:'domain' => :'String',
|
50
|
+
:'entity_name' => :'String'
|
51
|
+
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
def initialize(attributes = {})
|
56
|
+
return unless attributes.is_a?(Hash)
|
57
|
+
|
58
|
+
# convert string to symbol for hash key
|
59
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
60
|
+
|
61
|
+
|
62
|
+
if attributes[:'actions']
|
63
|
+
if (value = attributes[:'actions']).is_a?(Array)
|
64
|
+
self.actions = value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes[:'condition']
|
69
|
+
self.condition = attributes[:'condition']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes[:'domain']
|
73
|
+
self.domain = attributes[:'domain']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes[:'entityName']
|
77
|
+
self.entity_name = attributes[:'entityName']
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
# Check equality by comparing each attribute.
|
83
|
+
def ==(o)
|
84
|
+
return true if self.equal?(o)
|
85
|
+
self.class == o.class &&
|
86
|
+
actions == o.actions &&
|
87
|
+
condition == o.condition &&
|
88
|
+
domain == o.domain &&
|
89
|
+
entity_name == o.entity_name
|
90
|
+
end
|
91
|
+
|
92
|
+
# @see the `==` method
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculate hash code according to all attributes.
|
98
|
+
def hash
|
99
|
+
[actions, condition, domain, entity_name].hash
|
100
|
+
end
|
101
|
+
|
102
|
+
# build the object from hash
|
103
|
+
def build_from_hash(attributes)
|
104
|
+
return nil unless attributes.is_a?(Hash)
|
105
|
+
self.class.swagger_types.each_pair do |key, type|
|
106
|
+
if type =~ /^Array<(.*)>/i
|
107
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
108
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
109
|
+
else
|
110
|
+
#TODO show warning in debug mode
|
111
|
+
end
|
112
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
113
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
114
|
+
else
|
115
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
self
|
120
|
+
end
|
121
|
+
|
122
|
+
def _deserialize(type, value)
|
123
|
+
case type.to_sym
|
124
|
+
when :DateTime
|
125
|
+
DateTime.parse(value)
|
126
|
+
when :Date
|
127
|
+
Date.parse(value)
|
128
|
+
when :String
|
129
|
+
value.to_s
|
130
|
+
when :Integer
|
131
|
+
value.to_i
|
132
|
+
when :Float
|
133
|
+
value.to_f
|
134
|
+
when :BOOLEAN
|
135
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
136
|
+
true
|
137
|
+
else
|
138
|
+
false
|
139
|
+
end
|
140
|
+
when :Object
|
141
|
+
# generic object (usually a Hash), return directly
|
142
|
+
value
|
143
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
144
|
+
inner_type = Regexp.last_match[:inner_type]
|
145
|
+
value.map { |v| _deserialize(inner_type, v) }
|
146
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
147
|
+
k_type = Regexp.last_match[:k_type]
|
148
|
+
v_type = Regexp.last_match[:v_type]
|
149
|
+
{}.tap do |hash|
|
150
|
+
value.each do |k, v|
|
151
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
else # model
|
155
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
156
|
+
_model.build_from_hash(value)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def to_s
|
161
|
+
to_hash.to_s
|
162
|
+
end
|
163
|
+
|
164
|
+
# to_body is an alias to to_body (backward compatibility))
|
165
|
+
def to_body
|
166
|
+
to_hash
|
167
|
+
end
|
168
|
+
|
169
|
+
# return the object in the form of hash
|
170
|
+
def to_hash
|
171
|
+
hash = {}
|
172
|
+
self.class.attribute_map.each_pair do |attr, param|
|
173
|
+
value = self.send(attr)
|
174
|
+
next if value.nil?
|
175
|
+
hash[param] = _to_hash(value)
|
176
|
+
end
|
177
|
+
hash
|
178
|
+
end
|
179
|
+
|
180
|
+
# Method to output non-array value in the form of hash
|
181
|
+
# For object, use to_hash. Otherwise, just return the value
|
182
|
+
def _to_hash(value)
|
183
|
+
if value.is_a?(Array)
|
184
|
+
value.compact.map{ |v| _to_hash(v) }
|
185
|
+
elsif value.is_a?(Hash)
|
186
|
+
{}.tap do |hash|
|
187
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
188
|
+
end
|
189
|
+
elsif value.respond_to? :to_hash
|
190
|
+
value.to_hash
|
191
|
+
else
|
192
|
+
value
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
197
|
+
end
|
@@ -0,0 +1,209 @@
|
|
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 AuthzGrantRole
|
21
|
+
# The globally unique identifier for the object.
|
22
|
+
attr_accessor :id
|
23
|
+
|
24
|
+
attr_accessor :name
|
25
|
+
|
26
|
+
attr_accessor :description
|
27
|
+
|
28
|
+
attr_accessor :policies
|
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
|
+
:'name' => :'name',
|
40
|
+
|
41
|
+
:'description' => :'description',
|
42
|
+
|
43
|
+
:'policies' => :'policies',
|
44
|
+
|
45
|
+
:'self_uri' => :'selfUri'
|
46
|
+
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Attribute type mapping.
|
51
|
+
def self.swagger_types
|
52
|
+
{
|
53
|
+
:'id' => :'String',
|
54
|
+
:'name' => :'String',
|
55
|
+
:'description' => :'String',
|
56
|
+
:'policies' => :'Array<AuthzGrantPolicy>',
|
57
|
+
:'self_uri' => :'String'
|
58
|
+
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
def initialize(attributes = {})
|
63
|
+
return unless attributes.is_a?(Hash)
|
64
|
+
|
65
|
+
# convert string to symbol for hash key
|
66
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
67
|
+
|
68
|
+
|
69
|
+
if attributes[:'id']
|
70
|
+
self.id = attributes[:'id']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes[:'name']
|
74
|
+
self.name = attributes[:'name']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes[:'description']
|
78
|
+
self.description = attributes[:'description']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes[:'policies']
|
82
|
+
if (value = attributes[:'policies']).is_a?(Array)
|
83
|
+
self.policies = value
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes[:'selfUri']
|
88
|
+
self.self_uri = attributes[:'selfUri']
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
# Check equality by comparing each attribute.
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
id == o.id &&
|
98
|
+
name == o.name &&
|
99
|
+
description == o.description &&
|
100
|
+
policies == o.policies &&
|
101
|
+
self_uri == o.self_uri
|
102
|
+
end
|
103
|
+
|
104
|
+
# @see the `==` method
|
105
|
+
def eql?(o)
|
106
|
+
self == o
|
107
|
+
end
|
108
|
+
|
109
|
+
# Calculate hash code according to all attributes.
|
110
|
+
def hash
|
111
|
+
[id, name, description, policies, self_uri].hash
|
112
|
+
end
|
113
|
+
|
114
|
+
# build the object from hash
|
115
|
+
def build_from_hash(attributes)
|
116
|
+
return nil unless attributes.is_a?(Hash)
|
117
|
+
self.class.swagger_types.each_pair do |key, type|
|
118
|
+
if type =~ /^Array<(.*)>/i
|
119
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
120
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
121
|
+
else
|
122
|
+
#TODO show warning in debug mode
|
123
|
+
end
|
124
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
125
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
126
|
+
else
|
127
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
self
|
132
|
+
end
|
133
|
+
|
134
|
+
def _deserialize(type, value)
|
135
|
+
case type.to_sym
|
136
|
+
when :DateTime
|
137
|
+
DateTime.parse(value)
|
138
|
+
when :Date
|
139
|
+
Date.parse(value)
|
140
|
+
when :String
|
141
|
+
value.to_s
|
142
|
+
when :Integer
|
143
|
+
value.to_i
|
144
|
+
when :Float
|
145
|
+
value.to_f
|
146
|
+
when :BOOLEAN
|
147
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
148
|
+
true
|
149
|
+
else
|
150
|
+
false
|
151
|
+
end
|
152
|
+
when :Object
|
153
|
+
# generic object (usually a Hash), return directly
|
154
|
+
value
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
158
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
161
|
+
{}.tap do |hash|
|
162
|
+
value.each do |k, v|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
else # model
|
167
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
168
|
+
_model.build_from_hash(value)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def to_s
|
173
|
+
to_hash.to_s
|
174
|
+
end
|
175
|
+
|
176
|
+
# to_body is an alias to to_body (backward compatibility))
|
177
|
+
def to_body
|
178
|
+
to_hash
|
179
|
+
end
|
180
|
+
|
181
|
+
# return the object in the form of hash
|
182
|
+
def to_hash
|
183
|
+
hash = {}
|
184
|
+
self.class.attribute_map.each_pair do |attr, param|
|
185
|
+
value = self.send(attr)
|
186
|
+
next if value.nil?
|
187
|
+
hash[param] = _to_hash(value)
|
188
|
+
end
|
189
|
+
hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Method to output non-array value in the form of hash
|
193
|
+
# For object, use to_hash. Otherwise, just return the value
|
194
|
+
def _to_hash(value)
|
195
|
+
if value.is_a?(Array)
|
196
|
+
value.compact.map{ |v| _to_hash(v) }
|
197
|
+
elsif value.is_a?(Hash)
|
198
|
+
{}.tap do |hash|
|
199
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
200
|
+
end
|
201
|
+
elsif value.respond_to? :to_hash
|
202
|
+
value.to_hash
|
203
|
+
else
|
204
|
+
value
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
end
|
209
|
+
end
|
@@ -0,0 +1,210 @@
|
|
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 AuthzObject
|
21
|
+
# The globally unique identifier for the object.
|
22
|
+
attr_accessor :id
|
23
|
+
|
24
|
+
attr_accessor :name
|
25
|
+
|
26
|
+
# Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ
|
27
|
+
attr_accessor :last_modified
|
28
|
+
|
29
|
+
attr_accessor :permission_contexts
|
30
|
+
|
31
|
+
# The URI for this object
|
32
|
+
attr_accessor :self_uri
|
33
|
+
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
+
def self.attribute_map
|
36
|
+
{
|
37
|
+
|
38
|
+
:'id' => :'id',
|
39
|
+
|
40
|
+
:'name' => :'name',
|
41
|
+
|
42
|
+
:'last_modified' => :'lastModified',
|
43
|
+
|
44
|
+
:'permission_contexts' => :'permissionContexts',
|
45
|
+
|
46
|
+
:'self_uri' => :'selfUri'
|
47
|
+
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# Attribute type mapping.
|
52
|
+
def self.swagger_types
|
53
|
+
{
|
54
|
+
:'id' => :'String',
|
55
|
+
:'name' => :'String',
|
56
|
+
:'last_modified' => :'DateTime',
|
57
|
+
:'permission_contexts' => :'Array<AuthzPermissionContext>',
|
58
|
+
:'self_uri' => :'String'
|
59
|
+
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
def initialize(attributes = {})
|
64
|
+
return unless attributes.is_a?(Hash)
|
65
|
+
|
66
|
+
# convert string to symbol for hash key
|
67
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
68
|
+
|
69
|
+
|
70
|
+
if attributes[:'id']
|
71
|
+
self.id = attributes[:'id']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes[:'name']
|
75
|
+
self.name = attributes[:'name']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes[:'lastModified']
|
79
|
+
self.last_modified = attributes[:'lastModified']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes[:'permissionContexts']
|
83
|
+
if (value = attributes[:'permissionContexts']).is_a?(Array)
|
84
|
+
self.permission_contexts = value
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes[:'selfUri']
|
89
|
+
self.self_uri = attributes[:'selfUri']
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
# Check equality by comparing each attribute.
|
95
|
+
def ==(o)
|
96
|
+
return true if self.equal?(o)
|
97
|
+
self.class == o.class &&
|
98
|
+
id == o.id &&
|
99
|
+
name == o.name &&
|
100
|
+
last_modified == o.last_modified &&
|
101
|
+
permission_contexts == o.permission_contexts &&
|
102
|
+
self_uri == o.self_uri
|
103
|
+
end
|
104
|
+
|
105
|
+
# @see the `==` method
|
106
|
+
def eql?(o)
|
107
|
+
self == o
|
108
|
+
end
|
109
|
+
|
110
|
+
# Calculate hash code according to all attributes.
|
111
|
+
def hash
|
112
|
+
[id, name, last_modified, permission_contexts, self_uri].hash
|
113
|
+
end
|
114
|
+
|
115
|
+
# build the object from hash
|
116
|
+
def build_from_hash(attributes)
|
117
|
+
return nil unless attributes.is_a?(Hash)
|
118
|
+
self.class.swagger_types.each_pair do |key, type|
|
119
|
+
if type =~ /^Array<(.*)>/i
|
120
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
121
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
122
|
+
else
|
123
|
+
#TODO show warning in debug mode
|
124
|
+
end
|
125
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
126
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
127
|
+
else
|
128
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
self
|
133
|
+
end
|
134
|
+
|
135
|
+
def _deserialize(type, value)
|
136
|
+
case type.to_sym
|
137
|
+
when :DateTime
|
138
|
+
DateTime.parse(value)
|
139
|
+
when :Date
|
140
|
+
Date.parse(value)
|
141
|
+
when :String
|
142
|
+
value.to_s
|
143
|
+
when :Integer
|
144
|
+
value.to_i
|
145
|
+
when :Float
|
146
|
+
value.to_f
|
147
|
+
when :BOOLEAN
|
148
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
149
|
+
true
|
150
|
+
else
|
151
|
+
false
|
152
|
+
end
|
153
|
+
when :Object
|
154
|
+
# generic object (usually a Hash), return directly
|
155
|
+
value
|
156
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
157
|
+
inner_type = Regexp.last_match[:inner_type]
|
158
|
+
value.map { |v| _deserialize(inner_type, v) }
|
159
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
160
|
+
k_type = Regexp.last_match[:k_type]
|
161
|
+
v_type = Regexp.last_match[:v_type]
|
162
|
+
{}.tap do |hash|
|
163
|
+
value.each do |k, v|
|
164
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
else # model
|
168
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
169
|
+
_model.build_from_hash(value)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def to_s
|
174
|
+
to_hash.to_s
|
175
|
+
end
|
176
|
+
|
177
|
+
# to_body is an alias to to_body (backward compatibility))
|
178
|
+
def to_body
|
179
|
+
to_hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# return the object in the form of hash
|
183
|
+
def to_hash
|
184
|
+
hash = {}
|
185
|
+
self.class.attribute_map.each_pair do |attr, param|
|
186
|
+
value = self.send(attr)
|
187
|
+
next if value.nil?
|
188
|
+
hash[param] = _to_hash(value)
|
189
|
+
end
|
190
|
+
hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Method to output non-array value in the form of hash
|
194
|
+
# For object, use to_hash. Otherwise, just return the value
|
195
|
+
def _to_hash(value)
|
196
|
+
if value.is_a?(Array)
|
197
|
+
value.compact.map{ |v| _to_hash(v) }
|
198
|
+
elsif value.is_a?(Hash)
|
199
|
+
{}.tap do |hash|
|
200
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
201
|
+
end
|
202
|
+
elsif value.respond_to? :to_hash
|
203
|
+
value.to_hash
|
204
|
+
else
|
205
|
+
value
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
210
|
+
end
|