ultracart_api 3.10.21 → 3.10.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -4
- data/docs/AutoOrder.md +1 -0
- data/docs/AutoOrderManagement.md +8 -0
- data/docs/ConversationAgentAuth.md +13 -0
- data/docs/ConversationAgentAuthResponse.md +5 -5
- data/docs/ConversationApi.md +6 -5
- data/docs/ConversationEventQueuePosition.md +9 -0
- data/docs/ConversationMessage.md +1 -0
- data/docs/ConversationMessageTransportStatus.md +9 -0
- data/docs/ConversationMultimediaUploadUrl.md +9 -0
- data/docs/ConversationMultimediaUploadUrlResponse.md +12 -0
- data/docs/ConversationResponse.md +12 -0
- data/docs/ConversationStartRequest.md +1 -0
- data/docs/ConversationStartResponse.md +1 -2
- data/docs/ConversationWebsocketMessage.md +16 -0
- data/lib/ultracart_api/api/conversation_api.rb +9 -8
- data/lib/ultracart_api/models/auto_order.rb +10 -1
- data/lib/ultracart_api/models/auto_order_management.rb +185 -0
- data/lib/ultracart_api/models/conversation_agent_auth.rb +231 -0
- data/lib/ultracart_api/models/conversation_agent_auth_response.rb +32 -33
- data/lib/ultracart_api/models/conversation_event_queue_position.rb +195 -0
- data/lib/ultracart_api/models/conversation_message.rb +15 -4
- data/lib/ultracart_api/models/conversation_message_transport_status.rb +193 -0
- data/lib/ultracart_api/models/conversation_multimedia_upload_url.rb +193 -0
- data/lib/ultracart_api/models/conversation_multimedia_upload_url_response.rb +221 -0
- data/lib/ultracart_api/models/conversation_response.rb +221 -0
- data/lib/ultracart_api/models/conversation_start_request.rb +13 -4
- data/lib/ultracart_api/models/conversation_start_response.rb +7 -16
- data/lib/ultracart_api/models/conversation_websocket_message.rb +305 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +8 -0
- metadata +18 -2
@@ -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 ConversationResponse
|
17
|
+
attr_accessor :conversation
|
18
|
+
|
19
|
+
attr_accessor :error
|
20
|
+
|
21
|
+
attr_accessor :metadata
|
22
|
+
|
23
|
+
# Indicates if API call was successful
|
24
|
+
attr_accessor :success
|
25
|
+
|
26
|
+
attr_accessor :warning
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'conversation' => :'conversation',
|
32
|
+
:'error' => :'error',
|
33
|
+
:'metadata' => :'metadata',
|
34
|
+
:'success' => :'success',
|
35
|
+
:'warning' => :'warning'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.swagger_types
|
41
|
+
{
|
42
|
+
:'conversation' => :'Conversation',
|
43
|
+
:'error' => :'Error',
|
44
|
+
:'metadata' => :'ResponseMetadata',
|
45
|
+
:'success' => :'BOOLEAN',
|
46
|
+
:'warning' => :'Warning'
|
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?(:'conversation')
|
59
|
+
self.conversation = attributes[:'conversation']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'error')
|
63
|
+
self.error = attributes[:'error']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'metadata')
|
67
|
+
self.metadata = attributes[:'metadata']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'success')
|
71
|
+
self.success = attributes[:'success']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:'warning')
|
75
|
+
self.warning = attributes[:'warning']
|
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
|
+
conversation == o.conversation &&
|
98
|
+
error == o.error &&
|
99
|
+
metadata == o.metadata &&
|
100
|
+
success == o.success &&
|
101
|
+
warning == o.warning
|
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
|
+
[conversation, error, metadata, success, warning].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
|
@@ -18,11 +18,14 @@ module UltracartClient
|
|
18
18
|
|
19
19
|
attr_accessor :conversation_arn
|
20
20
|
|
21
|
+
attr_accessor :conversation_webchat_queue_uuid
|
22
|
+
|
21
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
24
|
def self.attribute_map
|
23
25
|
{
|
24
26
|
:'add_conversation_participant_arns' => :'add_conversation_participant_arns',
|
25
|
-
:'conversation_arn' => :'conversation_arn'
|
27
|
+
:'conversation_arn' => :'conversation_arn',
|
28
|
+
:'conversation_webchat_queue_uuid' => :'conversation_webchat_queue_uuid'
|
26
29
|
}
|
27
30
|
end
|
28
31
|
|
@@ -30,7 +33,8 @@ module UltracartClient
|
|
30
33
|
def self.swagger_types
|
31
34
|
{
|
32
35
|
:'add_conversation_participant_arns' => :'Array<String>',
|
33
|
-
:'conversation_arn' => :'String'
|
36
|
+
:'conversation_arn' => :'String',
|
37
|
+
:'conversation_webchat_queue_uuid' => :'String'
|
34
38
|
}
|
35
39
|
end
|
36
40
|
|
@@ -51,6 +55,10 @@ module UltracartClient
|
|
51
55
|
if attributes.has_key?(:'conversation_arn')
|
52
56
|
self.conversation_arn = attributes[:'conversation_arn']
|
53
57
|
end
|
58
|
+
|
59
|
+
if attributes.has_key?(:'conversation_webchat_queue_uuid')
|
60
|
+
self.conversation_webchat_queue_uuid = attributes[:'conversation_webchat_queue_uuid']
|
61
|
+
end
|
54
62
|
end
|
55
63
|
|
56
64
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -72,7 +80,8 @@ module UltracartClient
|
|
72
80
|
return true if self.equal?(o)
|
73
81
|
self.class == o.class &&
|
74
82
|
add_conversation_participant_arns == o.add_conversation_participant_arns &&
|
75
|
-
conversation_arn == o.conversation_arn
|
83
|
+
conversation_arn == o.conversation_arn &&
|
84
|
+
conversation_webchat_queue_uuid == o.conversation_webchat_queue_uuid
|
76
85
|
end
|
77
86
|
|
78
87
|
# @see the `==` method
|
@@ -84,7 +93,7 @@ module UltracartClient
|
|
84
93
|
# Calculates hash code according to all attributes.
|
85
94
|
# @return [Fixnum] Hash code
|
86
95
|
def hash
|
87
|
-
[add_conversation_participant_arns, conversation_arn].hash
|
96
|
+
[add_conversation_participant_arns, conversation_arn, conversation_webchat_queue_uuid].hash
|
88
97
|
end
|
89
98
|
|
90
99
|
# Builds the object from hash
|
@@ -14,23 +14,19 @@ require 'date'
|
|
14
14
|
|
15
15
|
module UltracartClient
|
16
16
|
class ConversationStartResponse
|
17
|
-
attr_accessor :
|
18
|
-
|
19
|
-
attr_accessor :conversation_uuid
|
17
|
+
attr_accessor :conversation
|
20
18
|
|
21
19
|
# Attribute mapping from ruby-style variable name to JSON key.
|
22
20
|
def self.attribute_map
|
23
21
|
{
|
24
|
-
:'
|
25
|
-
:'conversation_uuid' => :'conversation_uuid'
|
22
|
+
:'conversation' => :'conversation'
|
26
23
|
}
|
27
24
|
end
|
28
25
|
|
29
26
|
# Attribute type mapping.
|
30
27
|
def self.swagger_types
|
31
28
|
{
|
32
|
-
:'
|
33
|
-
:'conversation_uuid' => :'String'
|
29
|
+
:'conversation' => :'Conversation'
|
34
30
|
}
|
35
31
|
end
|
36
32
|
|
@@ -42,12 +38,8 @@ module UltracartClient
|
|
42
38
|
# convert string to symbol for hash key
|
43
39
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
44
40
|
|
45
|
-
if attributes.has_key?(:'
|
46
|
-
self.
|
47
|
-
end
|
48
|
-
|
49
|
-
if attributes.has_key?(:'conversation_uuid')
|
50
|
-
self.conversation_uuid = attributes[:'conversation_uuid']
|
41
|
+
if attributes.has_key?(:'conversation')
|
42
|
+
self.conversation = attributes[:'conversation']
|
51
43
|
end
|
52
44
|
end
|
53
45
|
|
@@ -69,8 +61,7 @@ module UltracartClient
|
|
69
61
|
def ==(o)
|
70
62
|
return true if self.equal?(o)
|
71
63
|
self.class == o.class &&
|
72
|
-
|
73
|
-
conversation_uuid == o.conversation_uuid
|
64
|
+
conversation == o.conversation
|
74
65
|
end
|
75
66
|
|
76
67
|
# @see the `==` method
|
@@ -82,7 +73,7 @@ module UltracartClient
|
|
82
73
|
# Calculates hash code according to all attributes.
|
83
74
|
# @return [Fixnum] Hash code
|
84
75
|
def hash
|
85
|
-
[
|
76
|
+
[conversation].hash
|
86
77
|
end
|
87
78
|
|
88
79
|
# Builds the object from hash
|
@@ -0,0 +1,305 @@
|
|
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 ConversationWebsocketMessage
|
17
|
+
# Conversation UUID if the websocket message is tied to a specific conversation
|
18
|
+
attr_accessor :conversation_uuid
|
19
|
+
|
20
|
+
attr_accessor :event_conversation_closed
|
21
|
+
|
22
|
+
attr_accessor :event_new_conversation
|
23
|
+
|
24
|
+
attr_accessor :event_new_message
|
25
|
+
|
26
|
+
attr_accessor :event_queue_position
|
27
|
+
|
28
|
+
# Type of event
|
29
|
+
attr_accessor :event_type
|
30
|
+
|
31
|
+
attr_accessor :event_updated_message
|
32
|
+
|
33
|
+
attr_accessor :message
|
34
|
+
|
35
|
+
# Type of message
|
36
|
+
attr_accessor :type
|
37
|
+
|
38
|
+
class EnumAttributeValidator
|
39
|
+
attr_reader :datatype
|
40
|
+
attr_reader :allowable_values
|
41
|
+
|
42
|
+
def initialize(datatype, allowable_values)
|
43
|
+
@allowable_values = allowable_values.map do |value|
|
44
|
+
case datatype.to_s
|
45
|
+
when /Integer/i
|
46
|
+
value.to_i
|
47
|
+
when /Float/i
|
48
|
+
value.to_f
|
49
|
+
else
|
50
|
+
value
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def valid?(value)
|
56
|
+
!value || allowable_values.include?(value)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
61
|
+
def self.attribute_map
|
62
|
+
{
|
63
|
+
:'conversation_uuid' => :'conversation_uuid',
|
64
|
+
:'event_conversation_closed' => :'event_conversation_closed',
|
65
|
+
:'event_new_conversation' => :'event_new_conversation',
|
66
|
+
:'event_new_message' => :'event_new_message',
|
67
|
+
:'event_queue_position' => :'event_queue_position',
|
68
|
+
:'event_type' => :'event_type',
|
69
|
+
:'event_updated_message' => :'event_updated_message',
|
70
|
+
:'message' => :'message',
|
71
|
+
:'type' => :'type'
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
# Attribute type mapping.
|
76
|
+
def self.swagger_types
|
77
|
+
{
|
78
|
+
:'conversation_uuid' => :'String',
|
79
|
+
:'event_conversation_closed' => :'Conversation',
|
80
|
+
:'event_new_conversation' => :'Conversation',
|
81
|
+
:'event_new_message' => :'Conversation',
|
82
|
+
:'event_queue_position' => :'ConversationEventQueuePosition',
|
83
|
+
:'event_type' => :'String',
|
84
|
+
:'event_updated_message' => :'ConversationMessage',
|
85
|
+
:'message' => :'ConversationMessage',
|
86
|
+
:'type' => :'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?(:'conversation_uuid')
|
99
|
+
self.conversation_uuid = attributes[:'conversation_uuid']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.has_key?(:'event_conversation_closed')
|
103
|
+
self.event_conversation_closed = attributes[:'event_conversation_closed']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.has_key?(:'event_new_conversation')
|
107
|
+
self.event_new_conversation = attributes[:'event_new_conversation']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.has_key?(:'event_new_message')
|
111
|
+
self.event_new_message = attributes[:'event_new_message']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.has_key?(:'event_queue_position')
|
115
|
+
self.event_queue_position = attributes[:'event_queue_position']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.has_key?(:'event_type')
|
119
|
+
self.event_type = attributes[:'event_type']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.has_key?(:'event_updated_message')
|
123
|
+
self.event_updated_message = attributes[:'event_updated_message']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.has_key?(:'message')
|
127
|
+
self.message = attributes[:'message']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.has_key?(:'type')
|
131
|
+
self.type = attributes[:'type']
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
136
|
+
# @return Array for valid properties with the reasons
|
137
|
+
def list_invalid_properties
|
138
|
+
invalid_properties = Array.new
|
139
|
+
invalid_properties
|
140
|
+
end
|
141
|
+
|
142
|
+
# Check to see if the all the properties in the model are valid
|
143
|
+
# @return true if the model is valid
|
144
|
+
def valid?
|
145
|
+
event_type_validator = EnumAttributeValidator.new('String', ['queue position', 'webchat start conversation', 'conversation closed', 'new conversation', 'new message', 'updated message'])
|
146
|
+
return false unless event_type_validator.valid?(@event_type)
|
147
|
+
type_validator = EnumAttributeValidator.new('String', ['message', 'event', 'ping'])
|
148
|
+
return false unless type_validator.valid?(@type)
|
149
|
+
true
|
150
|
+
end
|
151
|
+
|
152
|
+
# Custom attribute writer method checking allowed values (enum).
|
153
|
+
# @param [Object] event_type Object to be assigned
|
154
|
+
def event_type=(event_type)
|
155
|
+
validator = EnumAttributeValidator.new('String', ['queue position', 'webchat start conversation', 'conversation closed', 'new conversation', 'new message', 'updated message'])
|
156
|
+
unless validator.valid?(event_type)
|
157
|
+
fail ArgumentError, 'invalid value for "event_type", must be one of #{validator.allowable_values}.'
|
158
|
+
end
|
159
|
+
@event_type = event_type
|
160
|
+
end
|
161
|
+
|
162
|
+
# Custom attribute writer method checking allowed values (enum).
|
163
|
+
# @param [Object] type Object to be assigned
|
164
|
+
def type=(type)
|
165
|
+
validator = EnumAttributeValidator.new('String', ['message', 'event', 'ping'])
|
166
|
+
unless validator.valid?(type)
|
167
|
+
fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
|
168
|
+
end
|
169
|
+
@type = type
|
170
|
+
end
|
171
|
+
|
172
|
+
# Checks equality by comparing each attribute.
|
173
|
+
# @param [Object] Object to be compared
|
174
|
+
def ==(o)
|
175
|
+
return true if self.equal?(o)
|
176
|
+
self.class == o.class &&
|
177
|
+
conversation_uuid == o.conversation_uuid &&
|
178
|
+
event_conversation_closed == o.event_conversation_closed &&
|
179
|
+
event_new_conversation == o.event_new_conversation &&
|
180
|
+
event_new_message == o.event_new_message &&
|
181
|
+
event_queue_position == o.event_queue_position &&
|
182
|
+
event_type == o.event_type &&
|
183
|
+
event_updated_message == o.event_updated_message &&
|
184
|
+
message == o.message &&
|
185
|
+
type == o.type
|
186
|
+
end
|
187
|
+
|
188
|
+
# @see the `==` method
|
189
|
+
# @param [Object] Object to be compared
|
190
|
+
def eql?(o)
|
191
|
+
self == o
|
192
|
+
end
|
193
|
+
|
194
|
+
# Calculates hash code according to all attributes.
|
195
|
+
# @return [Fixnum] Hash code
|
196
|
+
def hash
|
197
|
+
[conversation_uuid, event_conversation_closed, event_new_conversation, event_new_message, event_queue_position, event_type, event_updated_message, message, type].hash
|
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
|
+
self.class.swagger_types.each_pair do |key, type|
|
206
|
+
if type =~ /\AArray<(.*)>/i
|
207
|
+
# check to ensure the input is an array given that the attribute
|
208
|
+
# is documented as an array but the input is not
|
209
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
210
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
211
|
+
end
|
212
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
213
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
214
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
215
|
+
end
|
216
|
+
|
217
|
+
self
|
218
|
+
end
|
219
|
+
|
220
|
+
# Deserializes the data based on type
|
221
|
+
# @param string type Data type
|
222
|
+
# @param string value Value to be deserialized
|
223
|
+
# @return [Object] Deserialized data
|
224
|
+
def _deserialize(type, value)
|
225
|
+
case type.to_sym
|
226
|
+
when :DateTime
|
227
|
+
DateTime.parse(value)
|
228
|
+
when :Date
|
229
|
+
Date.parse(value)
|
230
|
+
when :String
|
231
|
+
value.to_s
|
232
|
+
when :Integer
|
233
|
+
value.to_i
|
234
|
+
when :Float
|
235
|
+
value.to_f
|
236
|
+
when :BOOLEAN
|
237
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
238
|
+
true
|
239
|
+
else
|
240
|
+
false
|
241
|
+
end
|
242
|
+
when :Object
|
243
|
+
# generic object (usually a Hash), return directly
|
244
|
+
value
|
245
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
246
|
+
inner_type = Regexp.last_match[:inner_type]
|
247
|
+
value.map { |v| _deserialize(inner_type, v) }
|
248
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
249
|
+
k_type = Regexp.last_match[:k_type]
|
250
|
+
v_type = Regexp.last_match[:v_type]
|
251
|
+
{}.tap do |hash|
|
252
|
+
value.each do |k, v|
|
253
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
else # model
|
257
|
+
temp_model = UltracartClient.const_get(type).new
|
258
|
+
temp_model.build_from_hash(value)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
# Returns the string representation of the object
|
263
|
+
# @return [String] String presentation of the object
|
264
|
+
def to_s
|
265
|
+
to_hash.to_s
|
266
|
+
end
|
267
|
+
|
268
|
+
# to_body is an alias to to_hash (backward compatibility)
|
269
|
+
# @return [Hash] Returns the object in the form of hash
|
270
|
+
def to_body
|
271
|
+
to_hash
|
272
|
+
end
|
273
|
+
|
274
|
+
# Returns the object in the form of hash
|
275
|
+
# @return [Hash] Returns the object in the form of hash
|
276
|
+
def to_hash
|
277
|
+
hash = {}
|
278
|
+
self.class.attribute_map.each_pair do |attr, param|
|
279
|
+
value = self.send(attr)
|
280
|
+
next if value.nil?
|
281
|
+
hash[param] = _to_hash(value)
|
282
|
+
end
|
283
|
+
hash
|
284
|
+
end
|
285
|
+
|
286
|
+
# Outputs non-array value in the form of hash
|
287
|
+
# For object, use to_hash. Otherwise, just return the value
|
288
|
+
# @param [Object] value Any valid value
|
289
|
+
# @return [Hash] Returns the value in the form of hash
|
290
|
+
def _to_hash(value)
|
291
|
+
if value.is_a?(Array)
|
292
|
+
value.compact.map { |v| _to_hash(v) }
|
293
|
+
elsif value.is_a?(Hash)
|
294
|
+
{}.tap do |hash|
|
295
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
296
|
+
end
|
297
|
+
elsif value.respond_to? :to_hash
|
298
|
+
value.to_hash
|
299
|
+
else
|
300
|
+
value
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
end
|
305
|
+
end
|
data/lib/ultracart_api.rb
CHANGED
@@ -44,6 +44,7 @@ require 'ultracart_api/models/auto_order_item_future_schedule'
|
|
44
44
|
require 'ultracart_api/models/auto_order_item_option'
|
45
45
|
require 'ultracart_api/models/auto_order_item_simple_schedule'
|
46
46
|
require 'ultracart_api/models/auto_order_log'
|
47
|
+
require 'ultracart_api/models/auto_order_management'
|
47
48
|
require 'ultracart_api/models/auto_order_query'
|
48
49
|
require 'ultracart_api/models/auto_order_query_batch'
|
49
50
|
require 'ultracart_api/models/auto_order_response'
|
@@ -134,12 +135,19 @@ require 'ultracart_api/models/checkout_setup_browser_key_response'
|
|
134
135
|
require 'ultracart_api/models/checkout_state_province_response'
|
135
136
|
require 'ultracart_api/models/city_state_zip'
|
136
137
|
require 'ultracart_api/models/conversation'
|
138
|
+
require 'ultracart_api/models/conversation_agent_auth'
|
137
139
|
require 'ultracart_api/models/conversation_agent_auth_response'
|
140
|
+
require 'ultracart_api/models/conversation_event_queue_position'
|
138
141
|
require 'ultracart_api/models/conversation_message'
|
142
|
+
require 'ultracart_api/models/conversation_message_transport_status'
|
143
|
+
require 'ultracart_api/models/conversation_multimedia_upload_url'
|
144
|
+
require 'ultracart_api/models/conversation_multimedia_upload_url_response'
|
139
145
|
require 'ultracart_api/models/conversation_participant'
|
146
|
+
require 'ultracart_api/models/conversation_response'
|
140
147
|
require 'ultracart_api/models/conversation_start_request'
|
141
148
|
require 'ultracart_api/models/conversation_start_response'
|
142
149
|
require 'ultracart_api/models/conversation_summary'
|
150
|
+
require 'ultracart_api/models/conversation_websocket_message'
|
143
151
|
require 'ultracart_api/models/conversations_response'
|
144
152
|
require 'ultracart_api/models/countries_response'
|
145
153
|
require 'ultracart_api/models/country'
|