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