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,272 @@
|
|
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 "uri"
|
18
|
+
|
19
|
+
module PureCloud
|
20
|
+
class SuggestApi
|
21
|
+
attr_accessor :api_client
|
22
|
+
|
23
|
+
def initialize(api_client = ApiClient.default)
|
24
|
+
@api_client = api_client
|
25
|
+
end
|
26
|
+
|
27
|
+
# Search using q64
|
28
|
+
#
|
29
|
+
# @param [Hash] opts the optional parameters
|
30
|
+
# @option opts [String] :q64
|
31
|
+
# @option opts [Array<String>] :expand
|
32
|
+
# @option opts [BOOLEAN] :profile (default to true)
|
33
|
+
# @return [JsonNodeSearchResponse]
|
34
|
+
def get_search(opts = {})
|
35
|
+
data, status_code, headers = get_search_with_http_info(opts)
|
36
|
+
return data
|
37
|
+
end
|
38
|
+
|
39
|
+
# Search using q64
|
40
|
+
#
|
41
|
+
# @param [Hash] opts the optional parameters
|
42
|
+
# @option opts [String] :q64
|
43
|
+
# @option opts [Array<String>] :expand
|
44
|
+
# @option opts [BOOLEAN] :profile
|
45
|
+
# @return [Array<(JsonNodeSearchResponse, Fixnum, Hash)>] JsonNodeSearchResponse data, response status code and response headers
|
46
|
+
def get_search_with_http_info(opts = {})
|
47
|
+
if @api_client.config.debugging
|
48
|
+
@api_client.config.logger.debug "Calling API: SuggestApi#get_search ..."
|
49
|
+
end
|
50
|
+
|
51
|
+
# resource path
|
52
|
+
local_var_path = "/api/v2/search".sub('{format}','json')
|
53
|
+
|
54
|
+
# query parameters
|
55
|
+
query_params = {}
|
56
|
+
query_params[:'q64'] = opts[:'q64'] if opts[:'q64']
|
57
|
+
query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if opts[:'expand']
|
58
|
+
query_params[:'profile'] = opts[:'profile'] if opts[:'profile']
|
59
|
+
|
60
|
+
# header parameters
|
61
|
+
header_params = {}
|
62
|
+
|
63
|
+
# HTTP header 'Accept' (if needed)
|
64
|
+
_header_accept = ['application/json']
|
65
|
+
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
66
|
+
|
67
|
+
# HTTP header 'Content-Type'
|
68
|
+
_header_content_type = ['application/json']
|
69
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
70
|
+
|
71
|
+
# form parameters
|
72
|
+
form_params = {}
|
73
|
+
|
74
|
+
# http body (model)
|
75
|
+
post_body = nil
|
76
|
+
|
77
|
+
auth_names = ['PureCloud Auth']
|
78
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
79
|
+
:header_params => header_params,
|
80
|
+
:query_params => query_params,
|
81
|
+
:form_params => form_params,
|
82
|
+
:body => post_body,
|
83
|
+
:auth_names => auth_names,
|
84
|
+
:return_type => 'JsonNodeSearchResponse')
|
85
|
+
if @api_client.config.debugging
|
86
|
+
@api_client.config.logger.debug "API called: SuggestApi#get_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
87
|
+
end
|
88
|
+
return data, status_code, headers
|
89
|
+
end
|
90
|
+
|
91
|
+
# Suggest using q64
|
92
|
+
#
|
93
|
+
# @param [Hash] opts the optional parameters
|
94
|
+
# @option opts [String] :q64
|
95
|
+
# @option opts [BOOLEAN] :profile (default to true)
|
96
|
+
# @return [JsonNodeSearchResponse]
|
97
|
+
def get_suggest(opts = {})
|
98
|
+
data, status_code, headers = get_suggest_with_http_info(opts)
|
99
|
+
return data
|
100
|
+
end
|
101
|
+
|
102
|
+
# Suggest using q64
|
103
|
+
#
|
104
|
+
# @param [Hash] opts the optional parameters
|
105
|
+
# @option opts [String] :q64
|
106
|
+
# @option opts [BOOLEAN] :profile
|
107
|
+
# @return [Array<(JsonNodeSearchResponse, Fixnum, Hash)>] JsonNodeSearchResponse data, response status code and response headers
|
108
|
+
def get_suggest_with_http_info(opts = {})
|
109
|
+
if @api_client.config.debugging
|
110
|
+
@api_client.config.logger.debug "Calling API: SuggestApi#get_suggest ..."
|
111
|
+
end
|
112
|
+
|
113
|
+
# resource path
|
114
|
+
local_var_path = "/api/v2/search/suggest".sub('{format}','json')
|
115
|
+
|
116
|
+
# query parameters
|
117
|
+
query_params = {}
|
118
|
+
query_params[:'q64'] = opts[:'q64'] if opts[:'q64']
|
119
|
+
query_params[:'profile'] = opts[:'profile'] if opts[:'profile']
|
120
|
+
|
121
|
+
# header parameters
|
122
|
+
header_params = {}
|
123
|
+
|
124
|
+
# HTTP header 'Accept' (if needed)
|
125
|
+
_header_accept = ['application/json']
|
126
|
+
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
127
|
+
|
128
|
+
# HTTP header 'Content-Type'
|
129
|
+
_header_content_type = ['application/json']
|
130
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
131
|
+
|
132
|
+
# form parameters
|
133
|
+
form_params = {}
|
134
|
+
|
135
|
+
# http body (model)
|
136
|
+
post_body = nil
|
137
|
+
|
138
|
+
auth_names = ['PureCloud Auth']
|
139
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
140
|
+
:header_params => header_params,
|
141
|
+
:query_params => query_params,
|
142
|
+
:form_params => form_params,
|
143
|
+
:body => post_body,
|
144
|
+
:auth_names => auth_names,
|
145
|
+
:return_type => 'JsonNodeSearchResponse')
|
146
|
+
if @api_client.config.debugging
|
147
|
+
@api_client.config.logger.debug "API called: SuggestApi#get_suggest\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
148
|
+
end
|
149
|
+
return data, status_code, headers
|
150
|
+
end
|
151
|
+
|
152
|
+
# Search
|
153
|
+
#
|
154
|
+
# @param [Hash] opts the optional parameters
|
155
|
+
# @option opts [SearchRequest] :body Search request options
|
156
|
+
# @option opts [BOOLEAN] :profile (default to true)
|
157
|
+
# @return [JsonNodeSearchResponse]
|
158
|
+
def post_search(opts = {})
|
159
|
+
data, status_code, headers = post_search_with_http_info(opts)
|
160
|
+
return data
|
161
|
+
end
|
162
|
+
|
163
|
+
# Search
|
164
|
+
#
|
165
|
+
# @param [Hash] opts the optional parameters
|
166
|
+
# @option opts [SearchRequest] :body Search request options
|
167
|
+
# @option opts [BOOLEAN] :profile
|
168
|
+
# @return [Array<(JsonNodeSearchResponse, Fixnum, Hash)>] JsonNodeSearchResponse data, response status code and response headers
|
169
|
+
def post_search_with_http_info(opts = {})
|
170
|
+
if @api_client.config.debugging
|
171
|
+
@api_client.config.logger.debug "Calling API: SuggestApi#post_search ..."
|
172
|
+
end
|
173
|
+
|
174
|
+
# resource path
|
175
|
+
local_var_path = "/api/v2/search".sub('{format}','json')
|
176
|
+
|
177
|
+
# query parameters
|
178
|
+
query_params = {}
|
179
|
+
query_params[:'profile'] = opts[:'profile'] if opts[:'profile']
|
180
|
+
|
181
|
+
# header parameters
|
182
|
+
header_params = {}
|
183
|
+
|
184
|
+
# HTTP header 'Accept' (if needed)
|
185
|
+
_header_accept = ['application/json']
|
186
|
+
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
187
|
+
|
188
|
+
# HTTP header 'Content-Type'
|
189
|
+
_header_content_type = ['application/json']
|
190
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
191
|
+
|
192
|
+
# form parameters
|
193
|
+
form_params = {}
|
194
|
+
|
195
|
+
# http body (model)
|
196
|
+
post_body = @api_client.object_to_http_body(opts[:'body'])
|
197
|
+
|
198
|
+
auth_names = ['PureCloud Auth']
|
199
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
200
|
+
:header_params => header_params,
|
201
|
+
:query_params => query_params,
|
202
|
+
:form_params => form_params,
|
203
|
+
:body => post_body,
|
204
|
+
:auth_names => auth_names,
|
205
|
+
:return_type => 'JsonNodeSearchResponse')
|
206
|
+
if @api_client.config.debugging
|
207
|
+
@api_client.config.logger.debug "API called: SuggestApi#post_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
208
|
+
end
|
209
|
+
return data, status_code, headers
|
210
|
+
end
|
211
|
+
|
212
|
+
# Suggest
|
213
|
+
#
|
214
|
+
# @param [Hash] opts the optional parameters
|
215
|
+
# @option opts [SearchRequest] :body Search request options
|
216
|
+
# @option opts [BOOLEAN] :profile (default to true)
|
217
|
+
# @return [JsonNodeSearchResponse]
|
218
|
+
def post_suggest(opts = {})
|
219
|
+
data, status_code, headers = post_suggest_with_http_info(opts)
|
220
|
+
return data
|
221
|
+
end
|
222
|
+
|
223
|
+
# Suggest
|
224
|
+
#
|
225
|
+
# @param [Hash] opts the optional parameters
|
226
|
+
# @option opts [SearchRequest] :body Search request options
|
227
|
+
# @option opts [BOOLEAN] :profile
|
228
|
+
# @return [Array<(JsonNodeSearchResponse, Fixnum, Hash)>] JsonNodeSearchResponse data, response status code and response headers
|
229
|
+
def post_suggest_with_http_info(opts = {})
|
230
|
+
if @api_client.config.debugging
|
231
|
+
@api_client.config.logger.debug "Calling API: SuggestApi#post_suggest ..."
|
232
|
+
end
|
233
|
+
|
234
|
+
# resource path
|
235
|
+
local_var_path = "/api/v2/search/suggest".sub('{format}','json')
|
236
|
+
|
237
|
+
# query parameters
|
238
|
+
query_params = {}
|
239
|
+
query_params[:'profile'] = opts[:'profile'] if opts[:'profile']
|
240
|
+
|
241
|
+
# header parameters
|
242
|
+
header_params = {}
|
243
|
+
|
244
|
+
# HTTP header 'Accept' (if needed)
|
245
|
+
_header_accept = ['application/json']
|
246
|
+
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
247
|
+
|
248
|
+
# HTTP header 'Content-Type'
|
249
|
+
_header_content_type = ['application/json']
|
250
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
|
251
|
+
|
252
|
+
# form parameters
|
253
|
+
form_params = {}
|
254
|
+
|
255
|
+
# http body (model)
|
256
|
+
post_body = @api_client.object_to_http_body(opts[:'body'])
|
257
|
+
|
258
|
+
auth_names = ['PureCloud Auth']
|
259
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
260
|
+
:header_params => header_params,
|
261
|
+
:query_params => query_params,
|
262
|
+
:form_params => form_params,
|
263
|
+
:body => post_body,
|
264
|
+
:auth_names => auth_names,
|
265
|
+
:return_type => 'JsonNodeSearchResponse')
|
266
|
+
if @api_client.config.debugging
|
267
|
+
@api_client.config.logger.debug "API called: SuggestApi#post_suggest\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
268
|
+
end
|
269
|
+
return data, status_code, headers
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
data/lib/purecloud/api_client.rb
CHANGED
@@ -33,7 +33,7 @@ module PureCloud
|
|
33
33
|
|
34
34
|
def initialize(config = Configuration.default)
|
35
35
|
@config = config
|
36
|
-
@user_agent = "PureCloud SDK/Ruby 0.
|
36
|
+
@user_agent = "PureCloud SDK/Ruby 0.38.1"
|
37
37
|
@default_headers = {
|
38
38
|
'Content-Type' => "application/json",
|
39
39
|
'User-Agent' => @user_agent
|
@@ -0,0 +1,186 @@
|
|
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 AuthzGrant
|
21
|
+
attr_accessor :permission_context
|
22
|
+
|
23
|
+
attr_accessor :role
|
24
|
+
|
25
|
+
# Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss.SSSZ
|
26
|
+
attr_accessor :grant_made_at
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
|
32
|
+
:'permission_context' => :'permissionContext',
|
33
|
+
|
34
|
+
:'role' => :'role',
|
35
|
+
|
36
|
+
:'grant_made_at' => :'grantMadeAt'
|
37
|
+
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Attribute type mapping.
|
42
|
+
def self.swagger_types
|
43
|
+
{
|
44
|
+
:'permission_context' => :'AuthzPermissionContext',
|
45
|
+
:'role' => :'AuthzGrantRole',
|
46
|
+
:'grant_made_at' => :'DateTime'
|
47
|
+
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
def initialize(attributes = {})
|
52
|
+
return unless attributes.is_a?(Hash)
|
53
|
+
|
54
|
+
# convert string to symbol for hash key
|
55
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
56
|
+
|
57
|
+
|
58
|
+
if attributes[:'permissionContext']
|
59
|
+
self.permission_context = attributes[:'permissionContext']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes[:'role']
|
63
|
+
self.role = attributes[:'role']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes[:'grantMadeAt']
|
67
|
+
self.grant_made_at = attributes[:'grantMadeAt']
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check equality by comparing each attribute.
|
73
|
+
def ==(o)
|
74
|
+
return true if self.equal?(o)
|
75
|
+
self.class == o.class &&
|
76
|
+
permission_context == o.permission_context &&
|
77
|
+
role == o.role &&
|
78
|
+
grant_made_at == o.grant_made_at
|
79
|
+
end
|
80
|
+
|
81
|
+
# @see the `==` method
|
82
|
+
def eql?(o)
|
83
|
+
self == o
|
84
|
+
end
|
85
|
+
|
86
|
+
# Calculate hash code according to all attributes.
|
87
|
+
def hash
|
88
|
+
[permission_context, role, grant_made_at].hash
|
89
|
+
end
|
90
|
+
|
91
|
+
# build the object from hash
|
92
|
+
def build_from_hash(attributes)
|
93
|
+
return nil unless attributes.is_a?(Hash)
|
94
|
+
self.class.swagger_types.each_pair do |key, type|
|
95
|
+
if type =~ /^Array<(.*)>/i
|
96
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
97
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
98
|
+
else
|
99
|
+
#TODO show warning in debug mode
|
100
|
+
end
|
101
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
102
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
103
|
+
else
|
104
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
self
|
109
|
+
end
|
110
|
+
|
111
|
+
def _deserialize(type, value)
|
112
|
+
case type.to_sym
|
113
|
+
when :DateTime
|
114
|
+
DateTime.parse(value)
|
115
|
+
when :Date
|
116
|
+
Date.parse(value)
|
117
|
+
when :String
|
118
|
+
value.to_s
|
119
|
+
when :Integer
|
120
|
+
value.to_i
|
121
|
+
when :Float
|
122
|
+
value.to_f
|
123
|
+
when :BOOLEAN
|
124
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
125
|
+
true
|
126
|
+
else
|
127
|
+
false
|
128
|
+
end
|
129
|
+
when :Object
|
130
|
+
# generic object (usually a Hash), return directly
|
131
|
+
value
|
132
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
133
|
+
inner_type = Regexp.last_match[:inner_type]
|
134
|
+
value.map { |v| _deserialize(inner_type, v) }
|
135
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
136
|
+
k_type = Regexp.last_match[:k_type]
|
137
|
+
v_type = Regexp.last_match[:v_type]
|
138
|
+
{}.tap do |hash|
|
139
|
+
value.each do |k, v|
|
140
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
else # model
|
144
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
145
|
+
_model.build_from_hash(value)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def to_s
|
150
|
+
to_hash.to_s
|
151
|
+
end
|
152
|
+
|
153
|
+
# to_body is an alias to to_body (backward compatibility))
|
154
|
+
def to_body
|
155
|
+
to_hash
|
156
|
+
end
|
157
|
+
|
158
|
+
# return the object in the form of hash
|
159
|
+
def to_hash
|
160
|
+
hash = {}
|
161
|
+
self.class.attribute_map.each_pair do |attr, param|
|
162
|
+
value = self.send(attr)
|
163
|
+
next if value.nil?
|
164
|
+
hash[param] = _to_hash(value)
|
165
|
+
end
|
166
|
+
hash
|
167
|
+
end
|
168
|
+
|
169
|
+
# Method to output non-array value in the form of hash
|
170
|
+
# For object, use to_hash. Otherwise, just return the value
|
171
|
+
def _to_hash(value)
|
172
|
+
if value.is_a?(Array)
|
173
|
+
value.compact.map{ |v| _to_hash(v) }
|
174
|
+
elsif value.is_a?(Hash)
|
175
|
+
{}.tap do |hash|
|
176
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
177
|
+
end
|
178
|
+
elsif value.respond_to? :to_hash
|
179
|
+
value.to_hash
|
180
|
+
else
|
181
|
+
value
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
end
|