ultracart_api 4.0.52.rc → 4.0.55.rc

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,238 @@
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 ConversationEventReadMessage
18
+ attr_accessor :conversation_message_uuid
19
+
20
+ # Message date/time
21
+ attr_accessor :message_dts
22
+
23
+ attr_accessor :message_epoch
24
+
25
+ # Attribute mapping from ruby-style variable name to JSON key.
26
+ def self.attribute_map
27
+ {
28
+ :'conversation_message_uuid' => :'conversation_message_uuid',
29
+ :'message_dts' => :'message_dts',
30
+ :'message_epoch' => :'message_epoch'
31
+ }
32
+ end
33
+
34
+ # Returns all the JSON keys this model knows about
35
+ def self.acceptable_attributes
36
+ attribute_map.values
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.openapi_types
41
+ {
42
+ :'conversation_message_uuid' => :'String',
43
+ :'message_dts' => :'String',
44
+ :'message_epoch' => :'Integer'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationEventReadMessage` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationEventReadMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'conversation_message_uuid')
70
+ self.conversation_message_uuid = attributes[:'conversation_message_uuid']
71
+ end
72
+
73
+ if attributes.key?(:'message_dts')
74
+ self.message_dts = attributes[:'message_dts']
75
+ end
76
+
77
+ if attributes.key?(:'message_epoch')
78
+ self.message_epoch = attributes[:'message_epoch']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ conversation_message_uuid == o.conversation_message_uuid &&
101
+ message_dts == o.message_dts &&
102
+ message_epoch == o.message_epoch
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [conversation_message_uuid, message_dts, message_epoch].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ new.build_from_hash(attributes)
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ self.class.openapi_types.each_pair do |key, type|
131
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
132
+ self.send("#{key}=", nil)
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = UltracartClient.const_get(type)
186
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -32,6 +32,9 @@ module UltracartClient
32
32
  # Message date/time
33
33
  attr_accessor :message_dts
34
34
 
35
+ # Message epoch milliseconds
36
+ attr_accessor :message_epoch
37
+
35
38
  attr_accessor :transport_statuses
36
39
 
37
40
  # Message type
@@ -72,6 +75,7 @@ module UltracartClient
72
75
  :'media_urls' => :'media_urls',
73
76
  :'merchant_id' => :'merchant_id',
74
77
  :'message_dts' => :'message_dts',
78
+ :'message_epoch' => :'message_epoch',
75
79
  :'transport_statuses' => :'transport_statuses',
76
80
  :'type' => :'type',
77
81
  :'upload_keys' => :'upload_keys'
@@ -94,6 +98,7 @@ module UltracartClient
94
98
  :'media_urls' => :'Array<String>',
95
99
  :'merchant_id' => :'String',
96
100
  :'message_dts' => :'String',
101
+ :'message_epoch' => :'Integer',
97
102
  :'transport_statuses' => :'Array<ConversationMessageTransportStatus>',
98
103
  :'type' => :'String',
99
104
  :'upload_keys' => :'Array<String>'
@@ -155,6 +160,10 @@ module UltracartClient
155
160
  self.message_dts = attributes[:'message_dts']
156
161
  end
157
162
 
163
+ if attributes.key?(:'message_epoch')
164
+ self.message_epoch = attributes[:'message_epoch']
165
+ end
166
+
158
167
  if attributes.key?(:'transport_statuses')
159
168
  if (value = attributes[:'transport_statuses']).is_a?(Array)
160
169
  self.transport_statuses = value
@@ -210,6 +219,7 @@ module UltracartClient
210
219
  media_urls == o.media_urls &&
211
220
  merchant_id == o.merchant_id &&
212
221
  message_dts == o.message_dts &&
222
+ message_epoch == o.message_epoch &&
213
223
  transport_statuses == o.transport_statuses &&
214
224
  type == o.type &&
215
225
  upload_keys == o.upload_keys
@@ -224,7 +234,7 @@ module UltracartClient
224
234
  # Calculates hash code according to all attributes.
225
235
  # @return [Integer] Hash code
226
236
  def hash
227
- [author_conversation_participant_arn, author_conversation_participant_name, body, client_message_id, conversation_message_uuid, media_urls, merchant_id, message_dts, transport_statuses, type, upload_keys].hash
237
+ [author_conversation_participant_arn, author_conversation_participant_name, body, client_message_id, conversation_message_uuid, media_urls, merchant_id, message_dts, message_epoch, transport_statuses, type, upload_keys].hash
228
238
  end
229
239
 
230
240
  # Builds the object from hash
@@ -17,8 +17,31 @@ module UltracartClient
17
17
  class ConversationMessageTransportStatus
18
18
  attr_accessor :conversation_participant_arn
19
19
 
20
+ # The status of the message transport
20
21
  attr_accessor :status
21
22
 
23
+ class EnumAttributeValidator
24
+ attr_reader :datatype
25
+ attr_reader :allowable_values
26
+
27
+ def initialize(datatype, allowable_values)
28
+ @allowable_values = allowable_values.map do |value|
29
+ case datatype.to_s
30
+ when /Integer/i
31
+ value.to_i
32
+ when /Float/i
33
+ value.to_f
34
+ else
35
+ value
36
+ end
37
+ end
38
+ end
39
+
40
+ def valid?(value)
41
+ !value || allowable_values.include?(value)
42
+ end
43
+ end
44
+
22
45
  # Attribute mapping from ruby-style variable name to JSON key.
23
46
  def self.attribute_map
24
47
  {
@@ -80,9 +103,21 @@ module UltracartClient
80
103
  # Check to see if the all the properties in the model are valid
81
104
  # @return true if the model is valid
82
105
  def valid?
106
+ status_validator = EnumAttributeValidator.new('String', ["accepted", "scheduled", "queued", "sending", "sent", "read", "TWILIO_CREDENTIALS_MISSING", "SENT_TO_TWILIO", "TWILIO_ERROR", "SENT_TO_PINPOINT", "PINPOINT_ERROR"])
107
+ return false unless status_validator.valid?(@status)
83
108
  true
84
109
  end
85
110
 
111
+ # Custom attribute writer method checking allowed values (enum).
112
+ # @param [Object] status Object to be assigned
113
+ def status=(status)
114
+ validator = EnumAttributeValidator.new('String', ["accepted", "scheduled", "queued", "sending", "sent", "read", "TWILIO_CREDENTIALS_MISSING", "SENT_TO_TWILIO", "TWILIO_ERROR", "SENT_TO_PINPOINT", "PINPOINT_ERROR"])
115
+ unless validator.valid?(status)
116
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
117
+ end
118
+ @status = status
119
+ end
120
+
86
121
  # Checks equality by comparing each attribute.
87
122
  # @param [Object] Object to be compared
88
123
  def ==(o)
@@ -32,6 +32,8 @@ module UltracartClient
32
32
 
33
33
  attr_accessor :status
34
34
 
35
+ attr_accessor :unread_messages
36
+
35
37
  # Attribute mapping from ruby-style variable name to JSON key.
36
38
  def self.attribute_map
37
39
  {
@@ -41,7 +43,8 @@ module UltracartClient
41
43
  :'joined_dts' => :'joined_dts',
42
44
  :'last_message_dts' => :'last_message_dts',
43
45
  :'left_dts' => :'left_dts',
44
- :'status' => :'status'
46
+ :'status' => :'status',
47
+ :'unread_messages' => :'unread_messages'
45
48
  }
46
49
  end
47
50
 
@@ -59,7 +62,8 @@ module UltracartClient
59
62
  :'joined_dts' => :'String',
60
63
  :'last_message_dts' => :'String',
61
64
  :'left_dts' => :'String',
62
- :'status' => :'String'
65
+ :'status' => :'String',
66
+ :'unread_messages' => :'Integer'
63
67
  }
64
68
  end
65
69
 
@@ -111,6 +115,10 @@ module UltracartClient
111
115
  if attributes.key?(:'status')
112
116
  self.status = attributes[:'status']
113
117
  end
118
+
119
+ if attributes.key?(:'unread_messages')
120
+ self.unread_messages = attributes[:'unread_messages']
121
+ end
114
122
  end
115
123
 
116
124
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -137,7 +145,8 @@ module UltracartClient
137
145
  joined_dts == o.joined_dts &&
138
146
  last_message_dts == o.last_message_dts &&
139
147
  left_dts == o.left_dts &&
140
- status == o.status
148
+ status == o.status &&
149
+ unread_messages == o.unread_messages
141
150
  end
142
151
 
143
152
  # @see the `==` method
@@ -149,7 +158,7 @@ module UltracartClient
149
158
  # Calculates hash code according to all attributes.
150
159
  # @return [Integer] Hash code
151
160
  def hash
152
- [conversation_participant_arn, conversation_participant_name, conversation_participant_uuid, joined_dts, last_message_dts, left_dts, status].hash
161
+ [conversation_participant_arn, conversation_participant_name, conversation_participant_uuid, joined_dts, last_message_dts, left_dts, status, unread_messages].hash
153
162
  end
154
163
 
155
164
  # Builds the object from hash
@@ -30,6 +30,8 @@ module UltracartClient
30
30
 
31
31
  attr_accessor :event_queue_status_update
32
32
 
33
+ attr_accessor :event_read_message
34
+
33
35
  attr_accessor :event_rrweb
34
36
 
35
37
  # Type of event
@@ -76,6 +78,7 @@ module UltracartClient
76
78
  :'event_participant_update' => :'event_participant_update',
77
79
  :'event_queue_position' => :'event_queue_position',
78
80
  :'event_queue_status_update' => :'event_queue_status_update',
81
+ :'event_read_message' => :'event_read_message',
79
82
  :'event_rrweb' => :'event_rrweb',
80
83
  :'event_type' => :'event_type',
81
84
  :'event_typing' => :'event_typing',
@@ -100,6 +103,7 @@ module UltracartClient
100
103
  :'event_participant_update' => :'ConversationSummary',
101
104
  :'event_queue_position' => :'ConversationEventQueuePosition',
102
105
  :'event_queue_status_update' => :'ConversationWebchatQueueStatus',
106
+ :'event_read_message' => :'ConversationEventReadMessage',
103
107
  :'event_rrweb' => :'ConversationEventRRWeb',
104
108
  :'event_type' => :'String',
105
109
  :'event_typing' => :'ConversationEventTyping',
@@ -158,6 +162,10 @@ module UltracartClient
158
162
  self.event_queue_status_update = attributes[:'event_queue_status_update']
159
163
  end
160
164
 
165
+ if attributes.key?(:'event_read_message')
166
+ self.event_read_message = attributes[:'event_read_message']
167
+ end
168
+
161
169
  if attributes.key?(:'event_rrweb')
162
170
  self.event_rrweb = attributes[:'event_rrweb']
163
171
  end
@@ -193,7 +201,7 @@ module UltracartClient
193
201
  # Check to see if the all the properties in the model are valid
194
202
  # @return true if the model is valid
195
203
  def valid?
196
- event_type_validator = EnumAttributeValidator.new('String', ["queue position", "webchat start conversation", "conversation closed", "new conversation", "new message", "updated message", "queue status update", "rrweb", "participant update"])
204
+ event_type_validator = EnumAttributeValidator.new('String', ["queue position", "webchat start conversation", "conversation closed", "new conversation", "new message", "updated message", "queue status update", "rrweb", "participant update", "read message"])
197
205
  return false unless event_type_validator.valid?(@event_type)
198
206
  type_validator = EnumAttributeValidator.new('String', ["message", "event", "ping", "check queue position"])
199
207
  return false unless type_validator.valid?(@type)
@@ -203,7 +211,7 @@ module UltracartClient
203
211
  # Custom attribute writer method checking allowed values (enum).
204
212
  # @param [Object] event_type Object to be assigned
205
213
  def event_type=(event_type)
206
- validator = EnumAttributeValidator.new('String', ["queue position", "webchat start conversation", "conversation closed", "new conversation", "new message", "updated message", "queue status update", "rrweb", "participant update"])
214
+ validator = EnumAttributeValidator.new('String', ["queue position", "webchat start conversation", "conversation closed", "new conversation", "new message", "updated message", "queue status update", "rrweb", "participant update", "read message"])
207
215
  unless validator.valid?(event_type)
208
216
  fail ArgumentError, "invalid value for \"event_type\", must be one of #{validator.allowable_values}."
209
217
  end
@@ -232,6 +240,7 @@ module UltracartClient
232
240
  event_participant_update == o.event_participant_update &&
233
241
  event_queue_position == o.event_queue_position &&
234
242
  event_queue_status_update == o.event_queue_status_update &&
243
+ event_read_message == o.event_read_message &&
235
244
  event_rrweb == o.event_rrweb &&
236
245
  event_type == o.event_type &&
237
246
  event_typing == o.event_typing &&
@@ -249,7 +258,7 @@ module UltracartClient
249
258
  # Calculates hash code according to all attributes.
250
259
  # @return [Integer] Hash code
251
260
  def hash
252
- [conversation_uuid, event_conversation_closed, event_new_conversation, event_new_message, event_participant_update, event_queue_position, event_queue_status_update, event_rrweb, event_type, event_typing, event_updated_message, message, type].hash
261
+ [conversation_uuid, event_conversation_closed, event_new_conversation, event_new_message, event_participant_update, event_queue_position, event_queue_status_update, event_read_message, event_rrweb, event_type, event_typing, event_updated_message, message, type].hash
253
262
  end
254
263
 
255
264
  # Builds the object from hash
@@ -262,7 +262,7 @@ module UltracartClient
262
262
  :'merchant_code' => :'String',
263
263
  :'merchant_notes' => :'String',
264
264
  :'multiple_amounts_off_items' => :'CouponMultipleAmountsOffItems',
265
- :'no_discount' => :'Object',
265
+ :'no_discount' => :'CouponNoDiscount',
266
266
  :'percent_off_item_with_items_quantity_purchase' => :'CouponPercentOffItemWithItemsQuantityPurchase',
267
267
  :'percent_off_items' => :'CouponPercentOffItems',
268
268
  :'percent_off_items_and_free_shipping' => :'CouponPercentOffItemsAndFreeShipping',