purecloud 0.40.1 → 0.41.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.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/config-ruby.json +1 -1
  4. data/doc_out/AdditionalInfo.html.md +12 -0
  5. data/doc_out/{Entity.html.md → AuthzPerm.html.md} +3 -5
  6. data/doc_out/AuthzPermissionContext.html.md +1 -1
  7. data/doc_out/CallableTimeSet.html.md +1 -1
  8. data/doc_out/Callback.html.md +1 -0
  9. data/doc_out/CallbackIdentifier.html.md +14 -0
  10. data/doc_out/CallbackMediaParticipant.html.md +1 -0
  11. data/doc_out/ContentManagementApi.html.md +51 -0
  12. data/doc_out/ConversationsApi.html.md +120 -0
  13. data/doc_out/CreateCallbackCommand.html.md +2 -0
  14. data/doc_out/CreateCallbackResponse.html.md +14 -0
  15. data/doc_out/Dependency.html.md +1 -0
  16. data/doc_out/DependencyObject.html.md +1 -0
  17. data/doc_out/DomainEdgeSoftwareVersionDto.html.md +1 -1
  18. data/doc_out/GroupSearchCriteria.html.md +20 -0
  19. data/doc_out/GroupSearchRequest.html.md +19 -0
  20. data/doc_out/GroupsApi.html.md +2 -2
  21. data/doc_out/GroupsSearchResponse.html.md +1 -0
  22. data/doc_out/Integration.html.md +20 -0
  23. data/doc_out/IntegrationConfiguration.html.md +20 -0
  24. data/doc_out/{DeletedResourceConsumerEntityListing.html.md → IntegrationEntityListing.html.md} +3 -3
  25. data/doc_out/IntegrationStatusInfo.html.md +16 -0
  26. data/doc_out/IntegrationType.html.md +5 -3
  27. data/doc_out/JsonNode.html.md +1 -1
  28. data/doc_out/JsonNodeSearchResponse.html.md +1 -0
  29. data/doc_out/LocationSearchCriteria.html.md +20 -0
  30. data/doc_out/LocationSearchRequest.html.md +19 -0
  31. data/doc_out/LocationsApi.html.md +6 -6
  32. data/doc_out/LocationsSearchResponse.html.md +22 -0
  33. data/doc_out/NumberOrder.html.md +27 -0
  34. data/doc_out/PortBillingAddress.html.md +17 -0
  35. data/doc_out/PortContact.html.md +14 -0
  36. data/doc_out/PresenceApi.html.md +1 -1
  37. data/doc_out/QualityAudit.html.md +1 -1
  38. data/doc_out/RecordingApi.html.md +4 -2
  39. data/doc_out/ResponseSet.html.md +1 -1
  40. data/doc_out/RoutingData.html.md +17 -0
  41. data/doc_out/RuleSet.html.md +1 -1
  42. data/doc_out/SearchAggregation.html.md +3 -0
  43. data/doc_out/SearchApi.html.md +12 -12
  44. data/doc_out/SearchCriteria.html.md +1 -1
  45. data/doc_out/SearchRequest.html.md +3 -3
  46. data/doc_out/SuggestApi.html.md +2 -2
  47. data/doc_out/SuggestSearchCriteria.html.md +19 -0
  48. data/doc_out/SuggestSearchRequest.html.md +14 -0
  49. data/doc_out/Usage.html.md +13 -0
  50. data/doc_out/UsageItem.html.md +15 -0
  51. data/doc_out/UserSearchCriteria.html.md +20 -0
  52. data/doc_out/UserSearchRequest.html.md +19 -0
  53. data/doc_out/UsersApi.html.md +2 -120
  54. data/doc_out/UsersSearchResponse.html.md +1 -0
  55. data/doc_out/VoicemailMessageEntityListing.html.md +0 -7
  56. data/doc_out/Workspace.html.md +1 -0
  57. data/doc_out/WorkspaceCreate.html.md +1 -0
  58. data/doc_out/WorkspaceSummary.html.md +1 -0
  59. data/doc_out/index.html.md +3 -3
  60. data/lib/purecloud/api/content_management_api.rb +55 -0
  61. data/lib/purecloud/api/conversations_api.rb +121 -0
  62. data/lib/purecloud/api/groups_api.rb +6 -6
  63. data/lib/purecloud/api/languages_api.rb +2 -2
  64. data/lib/purecloud/api/locations_api.rb +8 -8
  65. data/lib/purecloud/api/presence_api.rb +2 -2
  66. data/lib/purecloud/api/recording_api.rb +5 -2
  67. data/lib/purecloud/api/routing_api.rb +2 -2
  68. data/lib/purecloud/api/search_api.rb +14 -14
  69. data/lib/purecloud/api/suggest_api.rb +2 -2
  70. data/lib/purecloud/api/users_api.rb +6 -128
  71. data/lib/purecloud/api_client.rb +1 -1
  72. data/lib/purecloud/models/additional_info.rb +155 -0
  73. data/lib/purecloud/models/authz_perm.rb +177 -0
  74. data/lib/purecloud/models/authz_permission_context.rb +7 -7
  75. data/lib/purecloud/models/callback.rb +15 -4
  76. data/lib/purecloud/models/{entity.rb → callback_identifier.rb} +15 -24
  77. data/lib/purecloud/models/callback_media_participant.rb +15 -4
  78. data/lib/purecloud/models/contact.rb +1 -1
  79. data/lib/purecloud/models/create_callback_command.rb +24 -4
  80. data/lib/purecloud/models/create_callback_response.rb +179 -0
  81. data/lib/purecloud/models/dependency.rb +13 -1
  82. data/lib/purecloud/models/dependency_object.rb +13 -1
  83. data/lib/purecloud/models/domain_edge_software_version_dto.rb +13 -13
  84. data/lib/purecloud/models/group_search_criteria.rb +260 -0
  85. data/lib/purecloud/models/group_search_request.rb +240 -0
  86. data/lib/purecloud/models/groups_search_response.rb +16 -4
  87. data/lib/purecloud/models/integration.rb +252 -0
  88. data/lib/purecloud/models/integration_configuration.rb +243 -0
  89. data/lib/purecloud/models/{deleted_resource_consumer_entity_listing.rb → integration_entity_listing.rb} +2 -2
  90. data/lib/purecloud/models/integration_status_info.rb +209 -0
  91. data/lib/purecloud/models/integration_type.rb +27 -1
  92. data/lib/purecloud/models/json_node.rb +13 -13
  93. data/lib/purecloud/models/json_node_search_response.rb +14 -4
  94. data/lib/purecloud/models/location_search_criteria.rb +260 -0
  95. data/lib/purecloud/models/location_search_request.rb +240 -0
  96. data/lib/purecloud/models/locations_search_response.rb +261 -0
  97. data/lib/purecloud/models/number_order.rb +339 -0
  98. data/lib/purecloud/models/number_order_request.rb +1 -1
  99. data/lib/purecloud/models/port_billing_address.rb +205 -0
  100. data/lib/purecloud/models/port_contact.rb +175 -0
  101. data/lib/purecloud/models/quality_audit.rb +1 -1
  102. data/lib/purecloud/models/reservation.rb +1 -1
  103. data/lib/purecloud/models/routing_data.rb +209 -0
  104. data/lib/purecloud/models/search_aggregation.rb +37 -5
  105. data/lib/purecloud/models/search_criteria.rb +22 -22
  106. data/lib/purecloud/models/search_request.rb +40 -39
  107. data/lib/purecloud/models/suggest_search_criteria.rb +240 -0
  108. data/lib/purecloud/models/suggest_search_request.rb +180 -0
  109. data/lib/purecloud/models/usage.rb +167 -0
  110. data/lib/purecloud/models/usage_item.rb +194 -0
  111. data/lib/purecloud/models/user_search_criteria.rb +260 -0
  112. data/lib/purecloud/models/user_search_request.rb +240 -0
  113. data/lib/purecloud/models/users_search_response.rb +16 -4
  114. data/lib/purecloud/models/voicemail_message_entity_listing.rb +4 -74
  115. data/lib/purecloud/models/workspace.rb +11 -1
  116. data/lib/purecloud/models/workspace_create.rb +14 -4
  117. data/lib/purecloud/models/workspace_summary.rb +14 -4
  118. data/lib/purecloud/version.rb +1 -1
  119. data/lib/purecloud.rb +23 -2
  120. data/newVersion.md +1 -1
  121. data/swagger.json +1 -1
  122. data/version.json +1 -1
  123. metadata +48 -6
@@ -18,12 +18,8 @@ require 'date'
18
18
 
19
19
  module PureCloud
20
20
  class SearchRequest
21
- attr_accessor :types
22
-
23
21
  attr_accessor :sort_order
24
22
 
25
- attr_accessor :query
26
-
27
23
  attr_accessor :sort_by
28
24
 
29
25
  attr_accessor :page_size
@@ -32,20 +28,21 @@ module PureCloud
32
28
 
33
29
  attr_accessor :return_fields
34
30
 
35
- attr_accessor :aggregations
36
-
37
31
  attr_accessor :expand
38
32
 
33
+ # Resource Domain type
34
+ attr_accessor :types
35
+
36
+ attr_accessor :query
37
+
38
+ attr_accessor :aggregations
39
+
39
40
  # Attribute mapping from ruby-style variable name to JSON key.
40
41
  def self.attribute_map
41
42
  {
42
43
 
43
- :'types' => :'types',
44
-
45
44
  :'sort_order' => :'sortOrder',
46
45
 
47
- :'query' => :'query',
48
-
49
46
  :'sort_by' => :'sortBy',
50
47
 
51
48
  :'page_size' => :'pageSize',
@@ -54,9 +51,13 @@ module PureCloud
54
51
 
55
52
  :'return_fields' => :'returnFields',
56
53
 
57
- :'aggregations' => :'aggregations',
54
+ :'expand' => :'expand',
58
55
 
59
- :'expand' => :'expand'
56
+ :'types' => :'types',
57
+
58
+ :'query' => :'query',
59
+
60
+ :'aggregations' => :'aggregations'
60
61
 
61
62
  }
62
63
  end
@@ -64,15 +65,15 @@ module PureCloud
64
65
  # Attribute type mapping.
65
66
  def self.swagger_types
66
67
  {
67
- :'types' => :'Array<String>',
68
68
  :'sort_order' => :'String',
69
- :'query' => :'Array<SearchCriteria>',
70
69
  :'sort_by' => :'String',
71
70
  :'page_size' => :'Integer',
72
71
  :'page_number' => :'Integer',
73
72
  :'return_fields' => :'Array<String>',
74
- :'aggregations' => :'Array<SearchAggregation>',
75
- :'expand' => :'Array<String>'
73
+ :'expand' => :'Array<String>',
74
+ :'types' => :'Array<String>',
75
+ :'query' => :'Array<SearchCriteria>',
76
+ :'aggregations' => :'Array<SearchAggregation>'
76
77
 
77
78
  }
78
79
  end
@@ -84,22 +85,10 @@ module PureCloud
84
85
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
85
86
 
86
87
 
87
- if attributes[:'types']
88
- if (value = attributes[:'types']).is_a?(Array)
89
- self.types = value
90
- end
91
- end
92
-
93
88
  if attributes[:'sortOrder']
94
89
  self.sort_order = attributes[:'sortOrder']
95
90
  end
96
91
 
97
- if attributes[:'query']
98
- if (value = attributes[:'query']).is_a?(Array)
99
- self.query = value
100
- end
101
- end
102
-
103
92
  if attributes[:'sortBy']
104
93
  self.sort_by = attributes[:'sortBy']
105
94
  end
@@ -118,18 +107,30 @@ module PureCloud
118
107
  end
119
108
  end
120
109
 
121
- if attributes[:'aggregations']
122
- if (value = attributes[:'aggregations']).is_a?(Array)
123
- self.aggregations = value
124
- end
125
- end
126
-
127
110
  if attributes[:'expand']
128
111
  if (value = attributes[:'expand']).is_a?(Array)
129
112
  self.expand = value
130
113
  end
131
114
  end
132
115
 
116
+ if attributes[:'types']
117
+ if (value = attributes[:'types']).is_a?(Array)
118
+ self.types = value
119
+ end
120
+ end
121
+
122
+ if attributes[:'query']
123
+ if (value = attributes[:'query']).is_a?(Array)
124
+ self.query = value
125
+ end
126
+ end
127
+
128
+ if attributes[:'aggregations']
129
+ if (value = attributes[:'aggregations']).is_a?(Array)
130
+ self.aggregations = value
131
+ end
132
+ end
133
+
133
134
  end
134
135
 
135
136
  # Custom attribute writer method checking allowed values (enum).
@@ -145,15 +146,15 @@ module PureCloud
145
146
  def ==(o)
146
147
  return true if self.equal?(o)
147
148
  self.class == o.class &&
148
- types == o.types &&
149
149
  sort_order == o.sort_order &&
150
- query == o.query &&
151
150
  sort_by == o.sort_by &&
152
151
  page_size == o.page_size &&
153
152
  page_number == o.page_number &&
154
153
  return_fields == o.return_fields &&
155
- aggregations == o.aggregations &&
156
- expand == o.expand
154
+ expand == o.expand &&
155
+ types == o.types &&
156
+ query == o.query &&
157
+ aggregations == o.aggregations
157
158
  end
158
159
 
159
160
  # @see the `==` method
@@ -163,7 +164,7 @@ module PureCloud
163
164
 
164
165
  # Calculate hash code according to all attributes.
165
166
  def hash
166
- [types, sort_order, query, sort_by, page_size, page_number, return_fields, aggregations, expand].hash
167
+ [sort_order, sort_by, page_size, page_number, return_fields, expand, types, query, aggregations].hash
167
168
  end
168
169
 
169
170
  # build the object from hash
@@ -0,0 +1,240 @@
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 SuggestSearchCriteria
21
+ attr_accessor :end_value
22
+
23
+ attr_accessor :values
24
+
25
+ attr_accessor :start_value
26
+
27
+ attr_accessor :fields
28
+
29
+ attr_accessor :value
30
+
31
+ attr_accessor :operator
32
+
33
+ attr_accessor :group
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+
39
+ :'end_value' => :'endValue',
40
+
41
+ :'values' => :'values',
42
+
43
+ :'start_value' => :'startValue',
44
+
45
+ :'fields' => :'fields',
46
+
47
+ :'value' => :'value',
48
+
49
+ :'operator' => :'operator',
50
+
51
+ :'group' => :'group'
52
+
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'end_value' => :'String',
60
+ :'values' => :'Array<String>',
61
+ :'start_value' => :'String',
62
+ :'fields' => :'Array<String>',
63
+ :'value' => :'String',
64
+ :'operator' => :'String',
65
+ :'group' => :'Array<SuggestSearchCriteria>'
66
+
67
+ }
68
+ end
69
+
70
+ def initialize(attributes = {})
71
+ return unless attributes.is_a?(Hash)
72
+
73
+ # convert string to symbol for hash key
74
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
75
+
76
+
77
+ if attributes[:'endValue']
78
+ self.end_value = attributes[:'endValue']
79
+ end
80
+
81
+ if attributes[:'values']
82
+ if (value = attributes[:'values']).is_a?(Array)
83
+ self.values = value
84
+ end
85
+ end
86
+
87
+ if attributes[:'startValue']
88
+ self.start_value = attributes[:'startValue']
89
+ end
90
+
91
+ if attributes[:'fields']
92
+ if (value = attributes[:'fields']).is_a?(Array)
93
+ self.fields = value
94
+ end
95
+ end
96
+
97
+ if attributes[:'value']
98
+ self.value = attributes[:'value']
99
+ end
100
+
101
+ if attributes[:'operator']
102
+ self.operator = attributes[:'operator']
103
+ end
104
+
105
+ if attributes[:'group']
106
+ if (value = attributes[:'group']).is_a?(Array)
107
+ self.group = value
108
+ end
109
+ end
110
+
111
+ end
112
+
113
+ # Custom attribute writer method checking allowed values (enum).
114
+ def operator=(operator)
115
+ allowed_values = ["AND", "OR", "NOT"]
116
+ if operator && !allowed_values.include?(operator)
117
+ fail "invalid value for 'operator', must be one of #{allowed_values}"
118
+ end
119
+ @operator = operator
120
+ end
121
+
122
+ # Check equality by comparing each attribute.
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ end_value == o.end_value &&
127
+ values == o.values &&
128
+ start_value == o.start_value &&
129
+ fields == o.fields &&
130
+ value == o.value &&
131
+ operator == o.operator &&
132
+ group == o.group
133
+ end
134
+
135
+ # @see the `==` method
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculate hash code according to all attributes.
141
+ def hash
142
+ [end_value, values, start_value, fields, value, operator, group].hash
143
+ end
144
+
145
+ # build the object from hash
146
+ def build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ self.class.swagger_types.each_pair do |key, type|
149
+ if type =~ /^Array<(.*)>/i
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
152
+ else
153
+ #TODO show warning in debug mode
154
+ end
155
+ elsif !attributes[self.class.attribute_map[key]].nil?
156
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
157
+ else
158
+ # data not found in attributes(hash), not an issue as the data can be optional
159
+ end
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ def _deserialize(type, value)
166
+ case type.to_sym
167
+ when :DateTime
168
+ DateTime.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :BOOLEAN
178
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ _model = Object.const_get("PureCloud").const_get(type).new
199
+ _model.build_from_hash(value)
200
+ end
201
+ end
202
+
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_body (backward compatibility))
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # return the object in the form of hash
213
+ def to_hash
214
+ hash = {}
215
+ self.class.attribute_map.each_pair do |attr, param|
216
+ value = self.send(attr)
217
+ next if value.nil?
218
+ hash[param] = _to_hash(value)
219
+ end
220
+ hash
221
+ end
222
+
223
+ # Method to output non-array value in the form of hash
224
+ # For object, use to_hash. Otherwise, just return the value
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map{ |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+
239
+ end
240
+ end
@@ -0,0 +1,180 @@
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 SuggestSearchRequest
21
+ # Resource Domain type
22
+ attr_accessor :types
23
+
24
+ attr_accessor :query
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+
30
+ :'types' => :'types',
31
+
32
+ :'query' => :'query'
33
+
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'types' => :'Array<String>',
41
+ :'query' => :'Array<SuggestSearchCriteria>'
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[:'types']
54
+ if (value = attributes[:'types']).is_a?(Array)
55
+ self.types = value
56
+ end
57
+ end
58
+
59
+ if attributes[:'query']
60
+ if (value = attributes[:'query']).is_a?(Array)
61
+ self.query = value
62
+ end
63
+ end
64
+
65
+ end
66
+
67
+ # Check equality by comparing each attribute.
68
+ def ==(o)
69
+ return true if self.equal?(o)
70
+ self.class == o.class &&
71
+ types == o.types &&
72
+ query == o.query
73
+ end
74
+
75
+ # @see the `==` method
76
+ def eql?(o)
77
+ self == o
78
+ end
79
+
80
+ # Calculate hash code according to all attributes.
81
+ def hash
82
+ [types, query].hash
83
+ end
84
+
85
+ # build the object from hash
86
+ def build_from_hash(attributes)
87
+ return nil unless attributes.is_a?(Hash)
88
+ self.class.swagger_types.each_pair do |key, type|
89
+ if type =~ /^Array<(.*)>/i
90
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
91
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
92
+ else
93
+ #TODO show warning in debug mode
94
+ end
95
+ elsif !attributes[self.class.attribute_map[key]].nil?
96
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
97
+ else
98
+ # data not found in attributes(hash), not an issue as the data can be optional
99
+ end
100
+ end
101
+
102
+ self
103
+ end
104
+
105
+ def _deserialize(type, value)
106
+ case type.to_sym
107
+ when :DateTime
108
+ DateTime.parse(value)
109
+ when :Date
110
+ Date.parse(value)
111
+ when :String
112
+ value.to_s
113
+ when :Integer
114
+ value.to_i
115
+ when :Float
116
+ value.to_f
117
+ when :BOOLEAN
118
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
119
+ true
120
+ else
121
+ false
122
+ end
123
+ when :Object
124
+ # generic object (usually a Hash), return directly
125
+ value
126
+ when /\AArray<(?<inner_type>.+)>\z/
127
+ inner_type = Regexp.last_match[:inner_type]
128
+ value.map { |v| _deserialize(inner_type, v) }
129
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
130
+ k_type = Regexp.last_match[:k_type]
131
+ v_type = Regexp.last_match[:v_type]
132
+ {}.tap do |hash|
133
+ value.each do |k, v|
134
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
135
+ end
136
+ end
137
+ else # model
138
+ _model = Object.const_get("PureCloud").const_get(type).new
139
+ _model.build_from_hash(value)
140
+ end
141
+ end
142
+
143
+ def to_s
144
+ to_hash.to_s
145
+ end
146
+
147
+ # to_body is an alias to to_body (backward compatibility))
148
+ def to_body
149
+ to_hash
150
+ end
151
+
152
+ # return the object in the form of hash
153
+ def to_hash
154
+ hash = {}
155
+ self.class.attribute_map.each_pair do |attr, param|
156
+ value = self.send(attr)
157
+ next if value.nil?
158
+ hash[param] = _to_hash(value)
159
+ end
160
+ hash
161
+ end
162
+
163
+ # Method to output non-array value in the form of hash
164
+ # For object, use to_hash. Otherwise, just return the value
165
+ def _to_hash(value)
166
+ if value.is_a?(Array)
167
+ value.compact.map{ |v| _to_hash(v) }
168
+ elsif value.is_a?(Hash)
169
+ {}.tap do |hash|
170
+ value.each { |k, v| hash[k] = _to_hash(v) }
171
+ end
172
+ elsif value.respond_to? :to_hash
173
+ value.to_hash
174
+ else
175
+ value
176
+ end
177
+ end
178
+
179
+ end
180
+ end