ultracart_api 3.10.28 → 3.10.31

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,8 @@ module UltracartClient
20
20
 
21
21
  attr_accessor :body
22
22
 
23
+ attr_accessor :client_message_id
24
+
23
25
  attr_accessor :media_urls
24
26
 
25
27
  # Message date/time
@@ -27,17 +29,44 @@ module UltracartClient
27
29
 
28
30
  attr_accessor :transport_statuses
29
31
 
32
+ # Message type
33
+ attr_accessor :type
34
+
30
35
  attr_accessor :upload_keys
31
36
 
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
32
59
  # Attribute mapping from ruby-style variable name to JSON key.
33
60
  def self.attribute_map
34
61
  {
35
62
  :'author_conversation_participant_arn' => :'author_conversation_participant_arn',
36
63
  :'author_conversation_participant_name' => :'author_conversation_participant_name',
37
64
  :'body' => :'body',
65
+ :'client_message_id' => :'client_message_id',
38
66
  :'media_urls' => :'media_urls',
39
67
  :'message_dts' => :'message_dts',
40
68
  :'transport_statuses' => :'transport_statuses',
69
+ :'type' => :'type',
41
70
  :'upload_keys' => :'upload_keys'
42
71
  }
43
72
  end
@@ -48,9 +77,11 @@ module UltracartClient
48
77
  :'author_conversation_participant_arn' => :'String',
49
78
  :'author_conversation_participant_name' => :'String',
50
79
  :'body' => :'String',
80
+ :'client_message_id' => :'String',
51
81
  :'media_urls' => :'Array<String>',
52
82
  :'message_dts' => :'String',
53
83
  :'transport_statuses' => :'Array<ConversationMessageTransportStatus>',
84
+ :'type' => :'String',
54
85
  :'upload_keys' => :'Array<String>'
55
86
  }
56
87
  end
@@ -75,6 +106,10 @@ module UltracartClient
75
106
  self.body = attributes[:'body']
76
107
  end
77
108
 
109
+ if attributes.has_key?(:'client_message_id')
110
+ self.client_message_id = attributes[:'client_message_id']
111
+ end
112
+
78
113
  if attributes.has_key?(:'media_urls')
79
114
  if (value = attributes[:'media_urls']).is_a?(Array)
80
115
  self.media_urls = value
@@ -91,6 +126,10 @@ module UltracartClient
91
126
  end
92
127
  end
93
128
 
129
+ if attributes.has_key?(:'type')
130
+ self.type = attributes[:'type']
131
+ end
132
+
94
133
  if attributes.has_key?(:'upload_keys')
95
134
  if (value = attributes[:'upload_keys']).is_a?(Array)
96
135
  self.upload_keys = value
@@ -108,9 +147,21 @@ module UltracartClient
108
147
  # Check to see if the all the properties in the model are valid
109
148
  # @return true if the model is valid
110
149
  def valid?
150
+ type_validator = EnumAttributeValidator.new('String', ['message', 'notice'])
151
+ return false unless type_validator.valid?(@type)
111
152
  true
112
153
  end
113
154
 
155
+ # Custom attribute writer method checking allowed values (enum).
156
+ # @param [Object] type Object to be assigned
157
+ def type=(type)
158
+ validator = EnumAttributeValidator.new('String', ['message', 'notice'])
159
+ unless validator.valid?(type)
160
+ fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
161
+ end
162
+ @type = type
163
+ end
164
+
114
165
  # Checks equality by comparing each attribute.
115
166
  # @param [Object] Object to be compared
116
167
  def ==(o)
@@ -119,9 +170,11 @@ module UltracartClient
119
170
  author_conversation_participant_arn == o.author_conversation_participant_arn &&
120
171
  author_conversation_participant_name == o.author_conversation_participant_name &&
121
172
  body == o.body &&
173
+ client_message_id == o.client_message_id &&
122
174
  media_urls == o.media_urls &&
123
175
  message_dts == o.message_dts &&
124
176
  transport_statuses == o.transport_statuses &&
177
+ type == o.type &&
125
178
  upload_keys == o.upload_keys
126
179
  end
127
180
 
@@ -134,7 +187,7 @@ module UltracartClient
134
187
  # Calculates hash code according to all attributes.
135
188
  # @return [Fixnum] Hash code
136
189
  def hash
137
- [author_conversation_participant_arn, author_conversation_participant_name, body, media_urls, message_dts, transport_statuses, upload_keys].hash
190
+ [author_conversation_participant_arn, author_conversation_participant_name, body, client_message_id, media_urls, message_dts, transport_statuses, type, upload_keys].hash
138
191
  end
139
192
 
140
193
  # Builds the object from hash
@@ -33,8 +33,13 @@ module UltracartClient
33
33
 
34
34
  attr_accessor :message_count
35
35
 
36
+ # Start of the conversation date/time
37
+ attr_accessor :start_dts
38
+
36
39
  attr_accessor :unread_messages
37
40
 
41
+ attr_accessor :visible
42
+
38
43
  # Attribute mapping from ruby-style variable name to JSON key.
39
44
  def self.attribute_map
40
45
  {
@@ -47,7 +52,9 @@ module UltracartClient
47
52
  :'last_message_dts' => :'last_message_dts',
48
53
  :'merchant_id' => :'merchant_id',
49
54
  :'message_count' => :'message_count',
50
- :'unread_messages' => :'unread_messages'
55
+ :'start_dts' => :'start_dts',
56
+ :'unread_messages' => :'unread_messages',
57
+ :'visible' => :'visible'
51
58
  }
52
59
  end
53
60
 
@@ -63,7 +70,9 @@ module UltracartClient
63
70
  :'last_message_dts' => :'String',
64
71
  :'merchant_id' => :'String',
65
72
  :'message_count' => :'Integer',
66
- :'unread_messages' => :'BOOLEAN'
73
+ :'start_dts' => :'String',
74
+ :'unread_messages' => :'BOOLEAN',
75
+ :'visible' => :'BOOLEAN'
67
76
  }
68
77
  end
69
78
 
@@ -111,9 +120,17 @@ module UltracartClient
111
120
  self.message_count = attributes[:'message_count']
112
121
  end
113
122
 
123
+ if attributes.has_key?(:'start_dts')
124
+ self.start_dts = attributes[:'start_dts']
125
+ end
126
+
114
127
  if attributes.has_key?(:'unread_messages')
115
128
  self.unread_messages = attributes[:'unread_messages']
116
129
  end
130
+
131
+ if attributes.has_key?(:'visible')
132
+ self.visible = attributes[:'visible']
133
+ end
117
134
  end
118
135
 
119
136
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -143,7 +160,9 @@ module UltracartClient
143
160
  last_message_dts == o.last_message_dts &&
144
161
  merchant_id == o.merchant_id &&
145
162
  message_count == o.message_count &&
146
- unread_messages == o.unread_messages
163
+ start_dts == o.start_dts &&
164
+ unread_messages == o.unread_messages &&
165
+ visible == o.visible
147
166
  end
148
167
 
149
168
  # @see the `==` method
@@ -155,7 +174,7 @@ module UltracartClient
155
174
  # Calculates hash code according to all attributes.
156
175
  # @return [Fixnum] Hash code
157
176
  def hash
158
- [closed, conversation_arn, conversation_uuid, last_conversation_message_body, last_conversation_participant_arn, last_conversation_participant_name, last_message_dts, merchant_id, message_count, unread_messages].hash
177
+ [closed, conversation_arn, conversation_uuid, last_conversation_message_body, last_conversation_participant_arn, last_conversation_participant_name, last_message_dts, merchant_id, message_count, start_dts, unread_messages, visible].hash
159
178
  end
160
179
 
161
180
  # Builds the object from hash
@@ -0,0 +1,195 @@
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 ConversationTwilioAccount
17
+ attr_accessor :merchant_id
18
+
19
+ attr_accessor :twilio_phone_numbers
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'merchant_id' => :'merchant_id',
25
+ :'twilio_phone_numbers' => :'twilio_phone_numbers'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.swagger_types
31
+ {
32
+ :'merchant_id' => :'String',
33
+ :'twilio_phone_numbers' => :'Array<String>'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'merchant_id')
46
+ self.merchant_id = attributes[:'merchant_id']
47
+ end
48
+
49
+ if attributes.has_key?(:'twilio_phone_numbers')
50
+ if (value = attributes[:'twilio_phone_numbers']).is_a?(Array)
51
+ self.twilio_phone_numbers = value
52
+ end
53
+ end
54
+ end
55
+
56
+ # Show invalid properties with the reasons. Usually used together with valid?
57
+ # @return Array for valid properties with the reasons
58
+ def list_invalid_properties
59
+ invalid_properties = Array.new
60
+ invalid_properties
61
+ end
62
+
63
+ # Check to see if the all the properties in the model are valid
64
+ # @return true if the model is valid
65
+ def valid?
66
+ true
67
+ end
68
+
69
+ # Checks equality by comparing each attribute.
70
+ # @param [Object] Object to be compared
71
+ def ==(o)
72
+ return true if self.equal?(o)
73
+ self.class == o.class &&
74
+ merchant_id == o.merchant_id &&
75
+ twilio_phone_numbers == o.twilio_phone_numbers
76
+ end
77
+
78
+ # @see the `==` method
79
+ # @param [Object] Object to be compared
80
+ def eql?(o)
81
+ self == o
82
+ end
83
+
84
+ # Calculates hash code according to all attributes.
85
+ # @return [Fixnum] Hash code
86
+ def hash
87
+ [merchant_id, twilio_phone_numbers].hash
88
+ end
89
+
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.swagger_types.each_pair do |key, type|
96
+ if type =~ /\AArray<(.*)>/i
97
+ # check to ensure the input is an array given that the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
104
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
105
+ end
106
+
107
+ self
108
+ end
109
+
110
+ # Deserializes the data based on type
111
+ # @param string type Data type
112
+ # @param string value Value to be deserialized
113
+ # @return [Object] Deserialized data
114
+ def _deserialize(type, value)
115
+ case type.to_sym
116
+ when :DateTime
117
+ DateTime.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :BOOLEAN
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when :Object
133
+ # generic object (usually a Hash), return directly
134
+ value
135
+ when /\AArray<(?<inner_type>.+)>\z/
136
+ inner_type = Regexp.last_match[:inner_type]
137
+ value.map { |v| _deserialize(inner_type, v) }
138
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
+ k_type = Regexp.last_match[:k_type]
140
+ v_type = Regexp.last_match[:v_type]
141
+ {}.tap do |hash|
142
+ value.each do |k, v|
143
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ end
145
+ end
146
+ else # model
147
+ temp_model = UltracartClient.const_get(type).new
148
+ temp_model.build_from_hash(value)
149
+ end
150
+ end
151
+
152
+ # Returns the string representation of the object
153
+ # @return [String] String presentation of the object
154
+ def to_s
155
+ to_hash.to_s
156
+ end
157
+
158
+ # to_body is an alias to to_hash (backward compatibility)
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_body
161
+ to_hash
162
+ end
163
+
164
+ # Returns the object in the form of hash
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_hash
167
+ hash = {}
168
+ self.class.attribute_map.each_pair do |attr, param|
169
+ value = self.send(attr)
170
+ next if value.nil?
171
+ hash[param] = _to_hash(value)
172
+ end
173
+ hash
174
+ end
175
+
176
+ # Outputs non-array value in the form of hash
177
+ # For object, use to_hash. Otherwise, just return the value
178
+ # @param [Object] value Any valid value
179
+ # @return [Hash] Returns the value in the form of hash
180
+ def _to_hash(value)
181
+ if value.is_a?(Array)
182
+ value.compact.map { |v| _to_hash(v) }
183
+ elsif value.is_a?(Hash)
184
+ {}.tap do |hash|
185
+ value.each { |k, v| hash[k] = _to_hash(v) }
186
+ end
187
+ elsif value.respond_to? :to_hash
188
+ value.to_hash
189
+ else
190
+ value
191
+ end
192
+ end
193
+
194
+ end
195
+ end
@@ -27,6 +27,8 @@ module UltracartClient
27
27
 
28
28
  attr_accessor :event_queue_status_update
29
29
 
30
+ attr_accessor :event_rrweb
31
+
30
32
  # Type of event
31
33
  attr_accessor :event_type
32
34
 
@@ -68,6 +70,7 @@ module UltracartClient
68
70
  :'event_new_message' => :'event_new_message',
69
71
  :'event_queue_position' => :'event_queue_position',
70
72
  :'event_queue_status_update' => :'event_queue_status_update',
73
+ :'event_rrweb' => :'event_rrweb',
71
74
  :'event_type' => :'event_type',
72
75
  :'event_updated_message' => :'event_updated_message',
73
76
  :'message' => :'message',
@@ -84,6 +87,7 @@ module UltracartClient
84
87
  :'event_new_message' => :'ConversationSummary',
85
88
  :'event_queue_position' => :'ConversationEventQueuePosition',
86
89
  :'event_queue_status_update' => :'ConversationWebchatQueueStatus',
90
+ :'event_rrweb' => :'ConversationEventRRWeb',
87
91
  :'event_type' => :'String',
88
92
  :'event_updated_message' => :'ConversationMessage',
89
93
  :'message' => :'ConversationMessage',
@@ -123,6 +127,10 @@ module UltracartClient
123
127
  self.event_queue_status_update = attributes[:'event_queue_status_update']
124
128
  end
125
129
 
130
+ if attributes.has_key?(:'event_rrweb')
131
+ self.event_rrweb = attributes[:'event_rrweb']
132
+ end
133
+
126
134
  if attributes.has_key?(:'event_type')
127
135
  self.event_type = attributes[:'event_type']
128
136
  end
@@ -150,9 +158,9 @@ module UltracartClient
150
158
  # Check to see if the all the properties in the model are valid
151
159
  # @return true if the model is valid
152
160
  def valid?
153
- event_type_validator = EnumAttributeValidator.new('String', ['queue position', 'webchat start conversation', 'conversation closed', 'new conversation', 'new message', 'updated message', 'queue status update'])
161
+ event_type_validator = EnumAttributeValidator.new('String', ['queue position', 'webchat start conversation', 'conversation closed', 'new conversation', 'new message', 'updated message', 'queue status update', 'rrweb'])
154
162
  return false unless event_type_validator.valid?(@event_type)
155
- type_validator = EnumAttributeValidator.new('String', ['message', 'event', 'ping'])
163
+ type_validator = EnumAttributeValidator.new('String', ['message', 'event', 'ping', 'check queue position'])
156
164
  return false unless type_validator.valid?(@type)
157
165
  true
158
166
  end
@@ -160,7 +168,7 @@ module UltracartClient
160
168
  # Custom attribute writer method checking allowed values (enum).
161
169
  # @param [Object] event_type Object to be assigned
162
170
  def event_type=(event_type)
163
- validator = EnumAttributeValidator.new('String', ['queue position', 'webchat start conversation', 'conversation closed', 'new conversation', 'new message', 'updated message', 'queue status update'])
171
+ validator = EnumAttributeValidator.new('String', ['queue position', 'webchat start conversation', 'conversation closed', 'new conversation', 'new message', 'updated message', 'queue status update', 'rrweb'])
164
172
  unless validator.valid?(event_type)
165
173
  fail ArgumentError, 'invalid value for "event_type", must be one of #{validator.allowable_values}.'
166
174
  end
@@ -170,7 +178,7 @@ module UltracartClient
170
178
  # Custom attribute writer method checking allowed values (enum).
171
179
  # @param [Object] type Object to be assigned
172
180
  def type=(type)
173
- validator = EnumAttributeValidator.new('String', ['message', 'event', 'ping'])
181
+ validator = EnumAttributeValidator.new('String', ['message', 'event', 'ping', 'check queue position'])
174
182
  unless validator.valid?(type)
175
183
  fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
176
184
  end
@@ -188,6 +196,7 @@ module UltracartClient
188
196
  event_new_message == o.event_new_message &&
189
197
  event_queue_position == o.event_queue_position &&
190
198
  event_queue_status_update == o.event_queue_status_update &&
199
+ event_rrweb == o.event_rrweb &&
191
200
  event_type == o.event_type &&
192
201
  event_updated_message == o.event_updated_message &&
193
202
  message == o.message &&
@@ -203,7 +212,7 @@ module UltracartClient
203
212
  # Calculates hash code according to all attributes.
204
213
  # @return [Fixnum] Hash code
205
214
  def hash
206
- [conversation_uuid, event_conversation_closed, event_new_conversation, event_new_message, event_queue_position, event_queue_status_update, event_type, event_updated_message, message, type].hash
215
+ [conversation_uuid, event_conversation_closed, event_new_conversation, event_new_message, event_queue_position, event_queue_status_update, event_rrweb, event_type, event_updated_message, message, type].hash
207
216
  end
208
217
 
209
218
  # Builds the object from hash