purecloud 0.41.1 → 0.42.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/ADFS.html.md +20 -0
- data/doc_out/CodesRequest.html.md +14 -0
- data/doc_out/ContactSort.html.md +1 -0
- data/doc_out/ContentQueryRequest.html.md +1 -0
- data/doc_out/ConversationAssociation.html.md +15 -0
- data/doc_out/CreateCallbackCommand.html.md +9 -9
- data/doc_out/CreateIntegrationRequest.html.md +16 -0
- data/doc_out/CustomerInteractionCenter.html.md +1 -0
- data/doc_out/DocusignTemplateMapping.html.md +16 -0
- data/doc_out/DomainEdgeSoftwareVersionDto.html.md +1 -1
- data/doc_out/EmbeddedSignatureView.html.md +1 -0
- data/doc_out/IdentityProviderApi.html.md +158 -0
- data/doc_out/Integration.html.md +4 -4
- data/doc_out/IntegrationConfiguration.html.md +3 -3
- data/doc_out/IntegrationStatusInfo.html.md +3 -3
- data/doc_out/IntegrationType.html.md +4 -4
- data/doc_out/JsonNode.html.md +4 -4
- data/doc_out/NumberOrder.html.md +2 -0
- data/doc_out/OAuthProvider.html.md +1 -0
- data/doc_out/Okta.html.md +1 -0
- data/doc_out/OneLogin.html.md +1 -0
- data/doc_out/PolicyActions.html.md +3 -2
- data/doc_out/PureCloud.html.md +1 -0
- data/doc_out/QueryRequest.html.md +1 -0
- data/doc_out/Response.html.md +1 -0
- data/doc_out/RoutingData.html.md +5 -5
- data/doc_out/Salesforce.html.md +1 -0
- data/doc_out/Script.html.md +1 -0
- data/doc_out/SignatureDocumentInfo.html.md +1 -0
- data/doc_out/TelephonyProvidersEdgeApi.html.md +15 -15
- data/doc_out/index.html.md +3 -3
- data/lib/purecloud.rb +5 -0
- data/lib/purecloud/api/identity_provider_api.rb +165 -0
- data/lib/purecloud/api/telephony_providers_edge_api.rb +10 -10
- data/lib/purecloud/api_client.rb +1 -1
- data/lib/purecloud/models/adfs.rb +239 -0
- data/lib/purecloud/models/codes_request.rb +175 -0
- data/lib/purecloud/models/contact_sort.rb +16 -4
- data/lib/purecloud/models/content_query_request.rb +16 -4
- data/lib/purecloud/models/conversation_association.rb +197 -0
- data/lib/purecloud/models/create_callback_command.rb +18 -8
- data/lib/purecloud/models/create_integration_request.rb +200 -0
- data/lib/purecloud/models/customer_interaction_center.rb +13 -1
- data/lib/purecloud/models/dependency.rb +1 -1
- data/lib/purecloud/models/dependency_object.rb +1 -1
- data/lib/purecloud/models/docusign_template_mapping.rb +197 -0
- data/lib/purecloud/models/domain_edge_software_version_dto.rb +13 -13
- data/lib/purecloud/models/embedded_signature_view.rb +15 -4
- data/lib/purecloud/models/flow.rb +1 -1
- data/lib/purecloud/models/integration.rb +2 -1
- data/lib/purecloud/models/integration_type.rb +1 -10
- data/lib/purecloud/models/json_node.rb +49 -49
- data/lib/purecloud/models/number_order.rb +23 -1
- data/lib/purecloud/models/o_auth_provider.rb +13 -1
- data/lib/purecloud/models/okta.rb +13 -1
- data/lib/purecloud/models/one_login.rb +13 -1
- data/lib/purecloud/models/policy_actions.rb +16 -1
- data/lib/purecloud/models/pure_cloud.rb +13 -1
- data/lib/purecloud/models/query_request.rb +16 -4
- data/lib/purecloud/models/response.rb +21 -1
- data/lib/purecloud/models/response_text.rb +9 -0
- data/lib/purecloud/models/routing_data.rb +5 -0
- data/lib/purecloud/models/salesforce.rb +13 -1
- data/lib/purecloud/models/script.rb +13 -1
- data/lib/purecloud/models/signature_document_info.rb +15 -4
- data/lib/purecloud/version.rb +1 -1
- data/newVersion.md +1 -1
- data/swagger.json +1 -1
- data/version.json +1 -1
- metadata +12 -2
@@ -688,7 +688,7 @@ module PureCloud
|
|
688
688
|
return data, status_code, headers
|
689
689
|
end
|
690
690
|
|
691
|
-
# Delete
|
691
|
+
# Delete a Site by ID
|
692
692
|
#
|
693
693
|
# @param site_id Site ID
|
694
694
|
# @param [Hash] opts the optional parameters
|
@@ -698,7 +698,7 @@ module PureCloud
|
|
698
698
|
return data
|
699
699
|
end
|
700
700
|
|
701
|
-
# Delete
|
701
|
+
# Delete a Site by ID
|
702
702
|
#
|
703
703
|
# @param site_id Site ID
|
704
704
|
# @param [Hash] opts the optional parameters
|
@@ -3397,7 +3397,7 @@ module PureCloud
|
|
3397
3397
|
return data, status_code, headers
|
3398
3398
|
end
|
3399
3399
|
|
3400
|
-
# Get the list of
|
3400
|
+
# Get the list of Sites.
|
3401
3401
|
#
|
3402
3402
|
# @param [Hash] opts the optional parameters
|
3403
3403
|
# @option opts [Integer] :page_size Page size (default to 25)
|
@@ -3412,7 +3412,7 @@ module PureCloud
|
|
3412
3412
|
return data
|
3413
3413
|
end
|
3414
3414
|
|
3415
|
-
# Get the list of
|
3415
|
+
# Get the list of Sites.
|
3416
3416
|
#
|
3417
3417
|
# @param [Hash] opts the optional parameters
|
3418
3418
|
# @option opts [Integer] :page_size Page size
|
@@ -3470,7 +3470,7 @@ module PureCloud
|
|
3470
3470
|
return data, status_code, headers
|
3471
3471
|
end
|
3472
3472
|
|
3473
|
-
# Get
|
3473
|
+
# Get a Site by ID.
|
3474
3474
|
#
|
3475
3475
|
# @param site_id Site ID
|
3476
3476
|
# @param [Hash] opts the optional parameters
|
@@ -3480,7 +3480,7 @@ module PureCloud
|
|
3480
3480
|
return data
|
3481
3481
|
end
|
3482
3482
|
|
3483
|
-
# Get
|
3483
|
+
# Get a Site by ID.
|
3484
3484
|
#
|
3485
3485
|
# @param site_id Site ID
|
3486
3486
|
# @param [Hash] opts the optional parameters
|
@@ -5648,7 +5648,7 @@ module PureCloud
|
|
5648
5648
|
return data, status_code, headers
|
5649
5649
|
end
|
5650
5650
|
|
5651
|
-
# Create a
|
5651
|
+
# Create a Site.
|
5652
5652
|
#
|
5653
5653
|
# @param [Hash] opts the optional parameters
|
5654
5654
|
# @option opts [Site] :body Site
|
@@ -5658,7 +5658,7 @@ module PureCloud
|
|
5658
5658
|
return data
|
5659
5659
|
end
|
5660
5660
|
|
5661
|
-
# Create a
|
5661
|
+
# Create a Site.
|
5662
5662
|
#
|
5663
5663
|
# @param [Hash] opts the optional parameters
|
5664
5664
|
# @option opts [Site] :body Site
|
@@ -6637,7 +6637,7 @@ module PureCloud
|
|
6637
6637
|
return data, status_code, headers
|
6638
6638
|
end
|
6639
6639
|
|
6640
|
-
# Update a
|
6640
|
+
# Update a Site by ID.
|
6641
6641
|
#
|
6642
6642
|
# @param site_id Site ID
|
6643
6643
|
# @param [Hash] opts the optional parameters
|
@@ -6648,7 +6648,7 @@ module PureCloud
|
|
6648
6648
|
return data
|
6649
6649
|
end
|
6650
6650
|
|
6651
|
-
# Update a
|
6651
|
+
# Update a Site by ID.
|
6652
6652
|
#
|
6653
6653
|
# @param site_id Site ID
|
6654
6654
|
# @param [Hash] opts the optional parameters
|
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.42.1"
|
37
37
|
@default_headers = {
|
38
38
|
'Content-Type' => "application/json",
|
39
39
|
'User-Agent' => @user_agent
|
@@ -0,0 +1,239 @@
|
|
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 ADFS
|
21
|
+
# The globally unique identifier for the object.
|
22
|
+
attr_accessor :id
|
23
|
+
|
24
|
+
attr_accessor :name
|
25
|
+
|
26
|
+
attr_accessor :relying_party_identifier
|
27
|
+
|
28
|
+
attr_accessor :certificate
|
29
|
+
|
30
|
+
attr_accessor :issuer_uri
|
31
|
+
|
32
|
+
attr_accessor :sso_target_uri
|
33
|
+
|
34
|
+
attr_accessor :disabled
|
35
|
+
|
36
|
+
# The URI for this object
|
37
|
+
attr_accessor :self_uri
|
38
|
+
|
39
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
40
|
+
def self.attribute_map
|
41
|
+
{
|
42
|
+
|
43
|
+
:'id' => :'id',
|
44
|
+
|
45
|
+
:'name' => :'name',
|
46
|
+
|
47
|
+
:'relying_party_identifier' => :'relyingPartyIdentifier',
|
48
|
+
|
49
|
+
:'certificate' => :'certificate',
|
50
|
+
|
51
|
+
:'issuer_uri' => :'issuerURI',
|
52
|
+
|
53
|
+
:'sso_target_uri' => :'ssoTargetURI',
|
54
|
+
|
55
|
+
:'disabled' => :'disabled',
|
56
|
+
|
57
|
+
:'self_uri' => :'selfUri'
|
58
|
+
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
# Attribute type mapping.
|
63
|
+
def self.swagger_types
|
64
|
+
{
|
65
|
+
:'id' => :'String',
|
66
|
+
:'name' => :'String',
|
67
|
+
:'relying_party_identifier' => :'String',
|
68
|
+
:'certificate' => :'String',
|
69
|
+
:'issuer_uri' => :'String',
|
70
|
+
:'sso_target_uri' => :'String',
|
71
|
+
:'disabled' => :'BOOLEAN',
|
72
|
+
:'self_uri' => :'String'
|
73
|
+
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
def initialize(attributes = {})
|
78
|
+
return unless attributes.is_a?(Hash)
|
79
|
+
|
80
|
+
# convert string to symbol for hash key
|
81
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
82
|
+
|
83
|
+
|
84
|
+
if attributes[:'id']
|
85
|
+
self.id = attributes[:'id']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes[:'name']
|
89
|
+
self.name = attributes[:'name']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes[:'relyingPartyIdentifier']
|
93
|
+
self.relying_party_identifier = attributes[:'relyingPartyIdentifier']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes[:'certificate']
|
97
|
+
self.certificate = attributes[:'certificate']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes[:'issuerURI']
|
101
|
+
self.issuer_uri = attributes[:'issuerURI']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes[:'ssoTargetURI']
|
105
|
+
self.sso_target_uri = attributes[:'ssoTargetURI']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes[:'disabled']
|
109
|
+
self.disabled = attributes[:'disabled']
|
110
|
+
else
|
111
|
+
self.disabled = false
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes[:'selfUri']
|
115
|
+
self.self_uri = attributes[:'selfUri']
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
# Check equality by comparing each attribute.
|
121
|
+
def ==(o)
|
122
|
+
return true if self.equal?(o)
|
123
|
+
self.class == o.class &&
|
124
|
+
id == o.id &&
|
125
|
+
name == o.name &&
|
126
|
+
relying_party_identifier == o.relying_party_identifier &&
|
127
|
+
certificate == o.certificate &&
|
128
|
+
issuer_uri == o.issuer_uri &&
|
129
|
+
sso_target_uri == o.sso_target_uri &&
|
130
|
+
disabled == o.disabled &&
|
131
|
+
self_uri == o.self_uri
|
132
|
+
end
|
133
|
+
|
134
|
+
# @see the `==` method
|
135
|
+
def eql?(o)
|
136
|
+
self == o
|
137
|
+
end
|
138
|
+
|
139
|
+
# Calculate hash code according to all attributes.
|
140
|
+
def hash
|
141
|
+
[id, name, relying_party_identifier, certificate, issuer_uri, sso_target_uri, disabled, self_uri].hash
|
142
|
+
end
|
143
|
+
|
144
|
+
# build the object from hash
|
145
|
+
def build_from_hash(attributes)
|
146
|
+
return nil unless attributes.is_a?(Hash)
|
147
|
+
self.class.swagger_types.each_pair do |key, type|
|
148
|
+
if type =~ /^Array<(.*)>/i
|
149
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
150
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
151
|
+
else
|
152
|
+
#TODO show warning in debug mode
|
153
|
+
end
|
154
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
155
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
156
|
+
else
|
157
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
self
|
162
|
+
end
|
163
|
+
|
164
|
+
def _deserialize(type, value)
|
165
|
+
case type.to_sym
|
166
|
+
when :DateTime
|
167
|
+
DateTime.parse(value)
|
168
|
+
when :Date
|
169
|
+
Date.parse(value)
|
170
|
+
when :String
|
171
|
+
value.to_s
|
172
|
+
when :Integer
|
173
|
+
value.to_i
|
174
|
+
when :Float
|
175
|
+
value.to_f
|
176
|
+
when :BOOLEAN
|
177
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
178
|
+
true
|
179
|
+
else
|
180
|
+
false
|
181
|
+
end
|
182
|
+
when :Object
|
183
|
+
# generic object (usually a Hash), return directly
|
184
|
+
value
|
185
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
186
|
+
inner_type = Regexp.last_match[:inner_type]
|
187
|
+
value.map { |v| _deserialize(inner_type, v) }
|
188
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
189
|
+
k_type = Regexp.last_match[:k_type]
|
190
|
+
v_type = Regexp.last_match[:v_type]
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each do |k, v|
|
193
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
else # model
|
197
|
+
_model = Object.const_get("PureCloud").const_get(type).new
|
198
|
+
_model.build_from_hash(value)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
def to_s
|
203
|
+
to_hash.to_s
|
204
|
+
end
|
205
|
+
|
206
|
+
# to_body is an alias to to_body (backward compatibility))
|
207
|
+
def to_body
|
208
|
+
to_hash
|
209
|
+
end
|
210
|
+
|
211
|
+
# return the object in the form of hash
|
212
|
+
def to_hash
|
213
|
+
hash = {}
|
214
|
+
self.class.attribute_map.each_pair do |attr, param|
|
215
|
+
value = self.send(attr)
|
216
|
+
next if value.nil?
|
217
|
+
hash[param] = _to_hash(value)
|
218
|
+
end
|
219
|
+
hash
|
220
|
+
end
|
221
|
+
|
222
|
+
# Method to output non-array value in the form of hash
|
223
|
+
# For object, use to_hash. Otherwise, just return the value
|
224
|
+
def _to_hash(value)
|
225
|
+
if value.is_a?(Array)
|
226
|
+
value.compact.map{ |v| _to_hash(v) }
|
227
|
+
elsif value.is_a?(Hash)
|
228
|
+
{}.tap do |hash|
|
229
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
230
|
+
end
|
231
|
+
elsif value.respond_to? :to_hash
|
232
|
+
value.to_hash
|
233
|
+
else
|
234
|
+
value
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
239
|
+
end
|
@@ -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 CodesRequest
|
21
|
+
attr_accessor :organization_id
|
22
|
+
|
23
|
+
attr_accessor :add_communication_code
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
|
29
|
+
:'organization_id' => :'organizationId',
|
30
|
+
|
31
|
+
:'add_communication_code' => :'addCommunicationCode'
|
32
|
+
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Attribute type mapping.
|
37
|
+
def self.swagger_types
|
38
|
+
{
|
39
|
+
:'organization_id' => :'String',
|
40
|
+
:'add_communication_code' => :'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[:'organizationId']
|
53
|
+
self.organization_id = attributes[:'organizationId']
|
54
|
+
end
|
55
|
+
|
56
|
+
if attributes[:'addCommunicationCode']
|
57
|
+
self.add_communication_code = attributes[:'addCommunicationCode']
|
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
|
+
organization_id == o.organization_id &&
|
67
|
+
add_communication_code == o.add_communication_code
|
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
|
+
[organization_id, add_communication_code].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
|