ultracart_api 3.10.25 → 3.10.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -4
- data/docs/ConversationApi.md +99 -0
- data/docs/ConversationMessage.md +1 -0
- data/docs/ConversationWebchatQueueStatus.md +22 -0
- data/docs/ConversationWebchatQueueStatusAgent.md +12 -0
- data/docs/ConversationWebchatQueueStatusQueueEntry.md +13 -0
- data/docs/ConversationWebchatQueueStatusUpdateRequest.md +8 -0
- data/docs/ConversationWebchatQueueStatusesResponse.md +12 -0
- data/docs/ConversationWebsocketMessage.md +1 -0
- data/lib/ultracart_api/api/conversation_api.rb +109 -0
- data/lib/ultracart_api/models/conversation_message.rb +15 -4
- data/lib/ultracart_api/models/conversation_webchat_queue_status.rb +315 -0
- data/lib/ultracart_api/models/conversation_webchat_queue_status_agent.rb +221 -0
- data/lib/ultracart_api/models/conversation_webchat_queue_status_queue_entry.rb +230 -0
- data/lib/ultracart_api/models/conversation_webchat_queue_status_update_request.rb +184 -0
- data/lib/ultracart_api/models/conversation_webchat_queue_statuses_response.rb +223 -0
- data/lib/ultracart_api/models/conversation_websocket_message.rb +12 -3
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +5 -0
- metadata +12 -2
@@ -0,0 +1,315 @@
|
|
1
|
+
=begin
|
2
|
+
#UltraCart Rest API V2
|
3
|
+
|
4
|
+
#UltraCart REST API Version 2
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.0
|
7
|
+
Contact: support@ultracart.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.15-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module UltracartClient
|
16
|
+
class ConversationWebchatQueueStatus
|
17
|
+
attr_accessor :agent_available_count
|
18
|
+
|
19
|
+
attr_accessor :agent_busy_count
|
20
|
+
|
21
|
+
attr_accessor :agent_count
|
22
|
+
|
23
|
+
attr_accessor :agent_unavailable_count
|
24
|
+
|
25
|
+
attr_accessor :agents
|
26
|
+
|
27
|
+
attr_accessor :customer_abandon_count
|
28
|
+
|
29
|
+
attr_accessor :customer_active_count
|
30
|
+
|
31
|
+
attr_accessor :customer_average_abandon_time_seconds
|
32
|
+
|
33
|
+
attr_accessor :customer_average_chat_time_seconds
|
34
|
+
|
35
|
+
attr_accessor :customer_average_hold_time_seconds
|
36
|
+
|
37
|
+
attr_accessor :customer_chat_count
|
38
|
+
|
39
|
+
attr_accessor :customer_waiting_count
|
40
|
+
|
41
|
+
# Date/time that the oldest person joined the queue
|
42
|
+
attr_accessor :customer_waiting_join_dts
|
43
|
+
|
44
|
+
attr_accessor :queue_entries
|
45
|
+
|
46
|
+
attr_accessor :queue_name
|
47
|
+
|
48
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
49
|
+
def self.attribute_map
|
50
|
+
{
|
51
|
+
:'agent_available_count' => :'agent_available_count',
|
52
|
+
:'agent_busy_count' => :'agent_busy_count',
|
53
|
+
:'agent_count' => :'agent_count',
|
54
|
+
:'agent_unavailable_count' => :'agent_unavailable_count',
|
55
|
+
:'agents' => :'agents',
|
56
|
+
:'customer_abandon_count' => :'customer_abandon_count',
|
57
|
+
:'customer_active_count' => :'customer_active_count',
|
58
|
+
:'customer_average_abandon_time_seconds' => :'customer_average_abandon_time_seconds',
|
59
|
+
:'customer_average_chat_time_seconds' => :'customer_average_chat_time_seconds',
|
60
|
+
:'customer_average_hold_time_seconds' => :'customer_average_hold_time_seconds',
|
61
|
+
:'customer_chat_count' => :'customer_chat_count',
|
62
|
+
:'customer_waiting_count' => :'customer_waiting_count',
|
63
|
+
:'customer_waiting_join_dts' => :'customer_waiting_join_dts',
|
64
|
+
:'queue_entries' => :'queue_entries',
|
65
|
+
:'queue_name' => :'queue_name'
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# Attribute type mapping.
|
70
|
+
def self.swagger_types
|
71
|
+
{
|
72
|
+
:'agent_available_count' => :'Integer',
|
73
|
+
:'agent_busy_count' => :'Integer',
|
74
|
+
:'agent_count' => :'Integer',
|
75
|
+
:'agent_unavailable_count' => :'Integer',
|
76
|
+
:'agents' => :'Array<ConversationWebchatQueueStatusAgent>',
|
77
|
+
:'customer_abandon_count' => :'Integer',
|
78
|
+
:'customer_active_count' => :'Integer',
|
79
|
+
:'customer_average_abandon_time_seconds' => :'Integer',
|
80
|
+
:'customer_average_chat_time_seconds' => :'Integer',
|
81
|
+
:'customer_average_hold_time_seconds' => :'Integer',
|
82
|
+
:'customer_chat_count' => :'Integer',
|
83
|
+
:'customer_waiting_count' => :'Integer',
|
84
|
+
:'customer_waiting_join_dts' => :'String',
|
85
|
+
:'queue_entries' => :'Array<ConversationWebchatQueueStatusQueueEntry>',
|
86
|
+
:'queue_name' => :'String'
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
# Initializes the object
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
def initialize(attributes = {})
|
93
|
+
return unless attributes.is_a?(Hash)
|
94
|
+
|
95
|
+
# convert string to symbol for hash key
|
96
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
97
|
+
|
98
|
+
if attributes.has_key?(:'agent_available_count')
|
99
|
+
self.agent_available_count = attributes[:'agent_available_count']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.has_key?(:'agent_busy_count')
|
103
|
+
self.agent_busy_count = attributes[:'agent_busy_count']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.has_key?(:'agent_count')
|
107
|
+
self.agent_count = attributes[:'agent_count']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.has_key?(:'agent_unavailable_count')
|
111
|
+
self.agent_unavailable_count = attributes[:'agent_unavailable_count']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.has_key?(:'agents')
|
115
|
+
if (value = attributes[:'agents']).is_a?(Array)
|
116
|
+
self.agents = value
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.has_key?(:'customer_abandon_count')
|
121
|
+
self.customer_abandon_count = attributes[:'customer_abandon_count']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.has_key?(:'customer_active_count')
|
125
|
+
self.customer_active_count = attributes[:'customer_active_count']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.has_key?(:'customer_average_abandon_time_seconds')
|
129
|
+
self.customer_average_abandon_time_seconds = attributes[:'customer_average_abandon_time_seconds']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.has_key?(:'customer_average_chat_time_seconds')
|
133
|
+
self.customer_average_chat_time_seconds = attributes[:'customer_average_chat_time_seconds']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.has_key?(:'customer_average_hold_time_seconds')
|
137
|
+
self.customer_average_hold_time_seconds = attributes[:'customer_average_hold_time_seconds']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.has_key?(:'customer_chat_count')
|
141
|
+
self.customer_chat_count = attributes[:'customer_chat_count']
|
142
|
+
end
|
143
|
+
|
144
|
+
if attributes.has_key?(:'customer_waiting_count')
|
145
|
+
self.customer_waiting_count = attributes[:'customer_waiting_count']
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes.has_key?(:'customer_waiting_join_dts')
|
149
|
+
self.customer_waiting_join_dts = attributes[:'customer_waiting_join_dts']
|
150
|
+
end
|
151
|
+
|
152
|
+
if attributes.has_key?(:'queue_entries')
|
153
|
+
if (value = attributes[:'queue_entries']).is_a?(Array)
|
154
|
+
self.queue_entries = value
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.has_key?(:'queue_name')
|
159
|
+
self.queue_name = attributes[:'queue_name']
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
164
|
+
# @return Array for valid properties with the reasons
|
165
|
+
def list_invalid_properties
|
166
|
+
invalid_properties = Array.new
|
167
|
+
invalid_properties
|
168
|
+
end
|
169
|
+
|
170
|
+
# Check to see if the all the properties in the model are valid
|
171
|
+
# @return true if the model is valid
|
172
|
+
def valid?
|
173
|
+
true
|
174
|
+
end
|
175
|
+
|
176
|
+
# Checks equality by comparing each attribute.
|
177
|
+
# @param [Object] Object to be compared
|
178
|
+
def ==(o)
|
179
|
+
return true if self.equal?(o)
|
180
|
+
self.class == o.class &&
|
181
|
+
agent_available_count == o.agent_available_count &&
|
182
|
+
agent_busy_count == o.agent_busy_count &&
|
183
|
+
agent_count == o.agent_count &&
|
184
|
+
agent_unavailable_count == o.agent_unavailable_count &&
|
185
|
+
agents == o.agents &&
|
186
|
+
customer_abandon_count == o.customer_abandon_count &&
|
187
|
+
customer_active_count == o.customer_active_count &&
|
188
|
+
customer_average_abandon_time_seconds == o.customer_average_abandon_time_seconds &&
|
189
|
+
customer_average_chat_time_seconds == o.customer_average_chat_time_seconds &&
|
190
|
+
customer_average_hold_time_seconds == o.customer_average_hold_time_seconds &&
|
191
|
+
customer_chat_count == o.customer_chat_count &&
|
192
|
+
customer_waiting_count == o.customer_waiting_count &&
|
193
|
+
customer_waiting_join_dts == o.customer_waiting_join_dts &&
|
194
|
+
queue_entries == o.queue_entries &&
|
195
|
+
queue_name == o.queue_name
|
196
|
+
end
|
197
|
+
|
198
|
+
# @see the `==` method
|
199
|
+
# @param [Object] Object to be compared
|
200
|
+
def eql?(o)
|
201
|
+
self == o
|
202
|
+
end
|
203
|
+
|
204
|
+
# Calculates hash code according to all attributes.
|
205
|
+
# @return [Fixnum] Hash code
|
206
|
+
def hash
|
207
|
+
[agent_available_count, agent_busy_count, agent_count, agent_unavailable_count, agents, customer_abandon_count, customer_active_count, customer_average_abandon_time_seconds, customer_average_chat_time_seconds, customer_average_hold_time_seconds, customer_chat_count, customer_waiting_count, customer_waiting_join_dts, queue_entries, queue_name].hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Builds the object from hash
|
211
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
212
|
+
# @return [Object] Returns the model itself
|
213
|
+
def build_from_hash(attributes)
|
214
|
+
return nil unless attributes.is_a?(Hash)
|
215
|
+
self.class.swagger_types.each_pair do |key, type|
|
216
|
+
if type =~ /\AArray<(.*)>/i
|
217
|
+
# check to ensure the input is an array given that the attribute
|
218
|
+
# is documented as an array but the input is not
|
219
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
220
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
221
|
+
end
|
222
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
223
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
224
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
225
|
+
end
|
226
|
+
|
227
|
+
self
|
228
|
+
end
|
229
|
+
|
230
|
+
# Deserializes the data based on type
|
231
|
+
# @param string type Data type
|
232
|
+
# @param string value Value to be deserialized
|
233
|
+
# @return [Object] Deserialized data
|
234
|
+
def _deserialize(type, value)
|
235
|
+
case type.to_sym
|
236
|
+
when :DateTime
|
237
|
+
DateTime.parse(value)
|
238
|
+
when :Date
|
239
|
+
Date.parse(value)
|
240
|
+
when :String
|
241
|
+
value.to_s
|
242
|
+
when :Integer
|
243
|
+
value.to_i
|
244
|
+
when :Float
|
245
|
+
value.to_f
|
246
|
+
when :BOOLEAN
|
247
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
248
|
+
true
|
249
|
+
else
|
250
|
+
false
|
251
|
+
end
|
252
|
+
when :Object
|
253
|
+
# generic object (usually a Hash), return directly
|
254
|
+
value
|
255
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
256
|
+
inner_type = Regexp.last_match[:inner_type]
|
257
|
+
value.map { |v| _deserialize(inner_type, v) }
|
258
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
259
|
+
k_type = Regexp.last_match[:k_type]
|
260
|
+
v_type = Regexp.last_match[:v_type]
|
261
|
+
{}.tap do |hash|
|
262
|
+
value.each do |k, v|
|
263
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
else # model
|
267
|
+
temp_model = UltracartClient.const_get(type).new
|
268
|
+
temp_model.build_from_hash(value)
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
# Returns the string representation of the object
|
273
|
+
# @return [String] String presentation of the object
|
274
|
+
def to_s
|
275
|
+
to_hash.to_s
|
276
|
+
end
|
277
|
+
|
278
|
+
# to_body is an alias to to_hash (backward compatibility)
|
279
|
+
# @return [Hash] Returns the object in the form of hash
|
280
|
+
def to_body
|
281
|
+
to_hash
|
282
|
+
end
|
283
|
+
|
284
|
+
# Returns the object in the form of hash
|
285
|
+
# @return [Hash] Returns the object in the form of hash
|
286
|
+
def to_hash
|
287
|
+
hash = {}
|
288
|
+
self.class.attribute_map.each_pair do |attr, param|
|
289
|
+
value = self.send(attr)
|
290
|
+
next if value.nil?
|
291
|
+
hash[param] = _to_hash(value)
|
292
|
+
end
|
293
|
+
hash
|
294
|
+
end
|
295
|
+
|
296
|
+
# Outputs non-array value in the form of hash
|
297
|
+
# For object, use to_hash. Otherwise, just return the value
|
298
|
+
# @param [Object] value Any valid value
|
299
|
+
# @return [Hash] Returns the value in the form of hash
|
300
|
+
def _to_hash(value)
|
301
|
+
if value.is_a?(Array)
|
302
|
+
value.compact.map { |v| _to_hash(v) }
|
303
|
+
elsif value.is_a?(Hash)
|
304
|
+
{}.tap do |hash|
|
305
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
306
|
+
end
|
307
|
+
elsif value.respond_to? :to_hash
|
308
|
+
value.to_hash
|
309
|
+
else
|
310
|
+
value
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
end
|
315
|
+
end
|
@@ -0,0 +1,221 @@
|
|
1
|
+
=begin
|
2
|
+
#UltraCart Rest API V2
|
3
|
+
|
4
|
+
#UltraCart REST API Version 2
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.0
|
7
|
+
Contact: support@ultracart.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.15-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module UltracartClient
|
16
|
+
class ConversationWebchatQueueStatusAgent
|
17
|
+
attr_accessor :agent_status
|
18
|
+
|
19
|
+
attr_accessor :conversation_participant_arn
|
20
|
+
|
21
|
+
attr_accessor :conversation_participant_name
|
22
|
+
|
23
|
+
# Date/time that this agent took their last chat
|
24
|
+
attr_accessor :last_chat_dts
|
25
|
+
|
26
|
+
attr_accessor :next_round_robin
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'agent_status' => :'agent_status',
|
32
|
+
:'conversation_participant_arn' => :'conversation_participant_arn',
|
33
|
+
:'conversation_participant_name' => :'conversation_participant_name',
|
34
|
+
:'last_chat_dts' => :'last_chat_dts',
|
35
|
+
:'next_round_robin' => :'next_round_robin'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.swagger_types
|
41
|
+
{
|
42
|
+
:'agent_status' => :'String',
|
43
|
+
:'conversation_participant_arn' => :'String',
|
44
|
+
:'conversation_participant_name' => :'String',
|
45
|
+
:'last_chat_dts' => :'String',
|
46
|
+
:'next_round_robin' => :'BOOLEAN'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
57
|
+
|
58
|
+
if attributes.has_key?(:'agent_status')
|
59
|
+
self.agent_status = attributes[:'agent_status']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'conversation_participant_arn')
|
63
|
+
self.conversation_participant_arn = attributes[:'conversation_participant_arn']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'conversation_participant_name')
|
67
|
+
self.conversation_participant_name = attributes[:'conversation_participant_name']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'last_chat_dts')
|
71
|
+
self.last_chat_dts = attributes[:'last_chat_dts']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:'next_round_robin')
|
75
|
+
self.next_round_robin = attributes[:'next_round_robin']
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properties with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
invalid_properties = Array.new
|
83
|
+
invalid_properties
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check to see if the all the properties in the model are valid
|
87
|
+
# @return true if the model is valid
|
88
|
+
def valid?
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
agent_status == o.agent_status &&
|
98
|
+
conversation_participant_arn == o.conversation_participant_arn &&
|
99
|
+
conversation_participant_name == o.conversation_participant_name &&
|
100
|
+
last_chat_dts == o.last_chat_dts &&
|
101
|
+
next_round_robin == o.next_round_robin
|
102
|
+
end
|
103
|
+
|
104
|
+
# @see the `==` method
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def eql?(o)
|
107
|
+
self == o
|
108
|
+
end
|
109
|
+
|
110
|
+
# Calculates hash code according to all attributes.
|
111
|
+
# @return [Fixnum] Hash code
|
112
|
+
def hash
|
113
|
+
[agent_status, conversation_participant_arn, conversation_participant_name, last_chat_dts, next_round_robin].hash
|
114
|
+
end
|
115
|
+
|
116
|
+
# Builds the object from hash
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
+
# @return [Object] Returns the model itself
|
119
|
+
def build_from_hash(attributes)
|
120
|
+
return nil unless attributes.is_a?(Hash)
|
121
|
+
self.class.swagger_types.each_pair do |key, type|
|
122
|
+
if type =~ /\AArray<(.*)>/i
|
123
|
+
# check to ensure the input is an array given that the attribute
|
124
|
+
# is documented as an array but the input is not
|
125
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
126
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
127
|
+
end
|
128
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
129
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
130
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
131
|
+
end
|
132
|
+
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
# Deserializes the data based on type
|
137
|
+
# @param string type Data type
|
138
|
+
# @param string value Value to be deserialized
|
139
|
+
# @return [Object] Deserialized data
|
140
|
+
def _deserialize(type, value)
|
141
|
+
case type.to_sym
|
142
|
+
when :DateTime
|
143
|
+
DateTime.parse(value)
|
144
|
+
when :Date
|
145
|
+
Date.parse(value)
|
146
|
+
when :String
|
147
|
+
value.to_s
|
148
|
+
when :Integer
|
149
|
+
value.to_i
|
150
|
+
when :Float
|
151
|
+
value.to_f
|
152
|
+
when :BOOLEAN
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
when :Object
|
159
|
+
# generic object (usually a Hash), return directly
|
160
|
+
value
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
temp_model = UltracartClient.const_get(type).new
|
174
|
+
temp_model.build_from_hash(value)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the string representation of the object
|
179
|
+
# @return [String] String presentation of the object
|
180
|
+
def to_s
|
181
|
+
to_hash.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
# to_body is an alias to to_hash (backward compatibility)
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_body
|
187
|
+
to_hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the object in the form of hash
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_hash
|
193
|
+
hash = {}
|
194
|
+
self.class.attribute_map.each_pair do |attr, param|
|
195
|
+
value = self.send(attr)
|
196
|
+
next if value.nil?
|
197
|
+
hash[param] = _to_hash(value)
|
198
|
+
end
|
199
|
+
hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# Outputs non-array value in the form of hash
|
203
|
+
# For object, use to_hash. Otherwise, just return the value
|
204
|
+
# @param [Object] value Any valid value
|
205
|
+
# @return [Hash] Returns the value in the form of hash
|
206
|
+
def _to_hash(value)
|
207
|
+
if value.is_a?(Array)
|
208
|
+
value.compact.map { |v| _to_hash(v) }
|
209
|
+
elsif value.is_a?(Hash)
|
210
|
+
{}.tap do |hash|
|
211
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
212
|
+
end
|
213
|
+
elsif value.respond_to? :to_hash
|
214
|
+
value.to_hash
|
215
|
+
else
|
216
|
+
value
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
221
|
+
end
|