ultracart_api 4.0.137 → 4.0.139

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,304 @@
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 ConversationSentiment
18
+ # The last time the detect sentiment was run on this conversation
19
+ attr_accessor :last_detect_sentiment
20
+
21
+ # The mixed score
22
+ attr_accessor :mixed
23
+
24
+ # The negative score
25
+ attr_accessor :negative
26
+
27
+ # The neutral score
28
+ attr_accessor :neutral
29
+
30
+ # The positive score
31
+ attr_accessor :positive
32
+
33
+ # The overall sentiment
34
+ attr_accessor :sentiment
35
+
36
+ class EnumAttributeValidator
37
+ attr_reader :datatype
38
+ attr_reader :allowable_values
39
+
40
+ def initialize(datatype, allowable_values)
41
+ @allowable_values = allowable_values.map do |value|
42
+ case datatype.to_s
43
+ when /Integer/i
44
+ value.to_i
45
+ when /Float/i
46
+ value.to_f
47
+ else
48
+ value
49
+ end
50
+ end
51
+ end
52
+
53
+ def valid?(value)
54
+ !value || allowable_values.include?(value)
55
+ end
56
+ end
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'last_detect_sentiment' => :'last_detect_sentiment',
62
+ :'mixed' => :'mixed',
63
+ :'negative' => :'negative',
64
+ :'neutral' => :'neutral',
65
+ :'positive' => :'positive',
66
+ :'sentiment' => :'sentiment'
67
+ }
68
+ end
69
+
70
+ # Returns all the JSON keys this model knows about
71
+ def self.acceptable_attributes
72
+ attribute_map.values
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.openapi_types
77
+ {
78
+ :'last_detect_sentiment' => :'String',
79
+ :'mixed' => :'Float',
80
+ :'negative' => :'Float',
81
+ :'neutral' => :'Float',
82
+ :'positive' => :'Float',
83
+ :'sentiment' => :'String'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ ])
91
+ end
92
+
93
+ # Initializes the object
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ def initialize(attributes = {})
96
+ if (!attributes.is_a?(Hash))
97
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationSentiment` initialize method"
98
+ end
99
+
100
+ # check to see if the attribute exists and convert string to symbol for hash key
101
+ attributes = attributes.each_with_object({}) { |(k, v), h|
102
+ if (!self.class.attribute_map.key?(k.to_sym))
103
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationSentiment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
104
+ end
105
+ h[k.to_sym] = v
106
+ }
107
+
108
+ if attributes.key?(:'last_detect_sentiment')
109
+ self.last_detect_sentiment = attributes[:'last_detect_sentiment']
110
+ end
111
+
112
+ if attributes.key?(:'mixed')
113
+ self.mixed = attributes[:'mixed']
114
+ end
115
+
116
+ if attributes.key?(:'negative')
117
+ self.negative = attributes[:'negative']
118
+ end
119
+
120
+ if attributes.key?(:'neutral')
121
+ self.neutral = attributes[:'neutral']
122
+ end
123
+
124
+ if attributes.key?(:'positive')
125
+ self.positive = attributes[:'positive']
126
+ end
127
+
128
+ if attributes.key?(:'sentiment')
129
+ self.sentiment = attributes[:'sentiment']
130
+ end
131
+ end
132
+
133
+ # Show invalid properties with the reasons. Usually used together with valid?
134
+ # @return Array for valid properties with the reasons
135
+ def list_invalid_properties
136
+ invalid_properties = Array.new
137
+ invalid_properties
138
+ end
139
+
140
+ # Check to see if the all the properties in the model are valid
141
+ # @return true if the model is valid
142
+ def valid?
143
+ sentiment_validator = EnumAttributeValidator.new('String', ["POSITIVE", "NEUTRAL", "NEGATIVE", "MIXED"])
144
+ return false unless sentiment_validator.valid?(@sentiment)
145
+ true
146
+ end
147
+
148
+ # Custom attribute writer method checking allowed values (enum).
149
+ # @param [Object] sentiment Object to be assigned
150
+ def sentiment=(sentiment)
151
+ validator = EnumAttributeValidator.new('String', ["POSITIVE", "NEUTRAL", "NEGATIVE", "MIXED"])
152
+ unless validator.valid?(sentiment)
153
+ fail ArgumentError, "invalid value for \"sentiment\", must be one of #{validator.allowable_values}."
154
+ end
155
+ @sentiment = sentiment
156
+ end
157
+
158
+ # Checks equality by comparing each attribute.
159
+ # @param [Object] Object to be compared
160
+ def ==(o)
161
+ return true if self.equal?(o)
162
+ self.class == o.class &&
163
+ last_detect_sentiment == o.last_detect_sentiment &&
164
+ mixed == o.mixed &&
165
+ negative == o.negative &&
166
+ neutral == o.neutral &&
167
+ positive == o.positive &&
168
+ sentiment == o.sentiment
169
+ end
170
+
171
+ # @see the `==` method
172
+ # @param [Object] Object to be compared
173
+ def eql?(o)
174
+ self == o
175
+ end
176
+
177
+ # Calculates hash code according to all attributes.
178
+ # @return [Integer] Hash code
179
+ def hash
180
+ [last_detect_sentiment, mixed, negative, neutral, positive, sentiment].hash
181
+ end
182
+
183
+ # Builds the object from hash
184
+ # @param [Hash] attributes Model attributes in the form of hash
185
+ # @return [Object] Returns the model itself
186
+ def self.build_from_hash(attributes)
187
+ new.build_from_hash(attributes)
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def build_from_hash(attributes)
194
+ return nil unless attributes.is_a?(Hash)
195
+ attributes = attributes.transform_keys(&:to_sym)
196
+ self.class.openapi_types.each_pair do |key, type|
197
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
198
+ self.send("#{key}=", nil)
199
+ elsif type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
203
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
204
+ end
205
+ elsif !attributes[self.class.attribute_map[key]].nil?
206
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
207
+ end
208
+ end
209
+
210
+ self
211
+ end
212
+
213
+ # Deserializes the data based on type
214
+ # @param string type Data type
215
+ # @param string value Value to be deserialized
216
+ # @return [Object] Deserialized data
217
+ def _deserialize(type, value)
218
+ case type.to_sym
219
+ when :Time
220
+ Time.parse(value)
221
+ when :Date
222
+ Date.parse(value)
223
+ when :String
224
+ value.to_s
225
+ when :Integer
226
+ value.to_i
227
+ when :Float
228
+ value.to_f
229
+ when :Boolean
230
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
231
+ true
232
+ else
233
+ false
234
+ end
235
+ when :Object
236
+ # generic object (usually a Hash), return directly
237
+ value
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ # models (e.g. Pet) or oneOf
251
+ klass = UltracartClient.const_get(type)
252
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
253
+ end
254
+ end
255
+
256
+ # Returns the string representation of the object
257
+ # @return [String] String presentation of the object
258
+ def to_s
259
+ to_hash.to_s
260
+ end
261
+
262
+ # to_body is an alias to to_hash (backward compatibility)
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_body
265
+ to_hash
266
+ end
267
+
268
+ # Returns the object in the form of hash
269
+ # @return [Hash] Returns the object in the form of hash
270
+ def to_hash
271
+ hash = {}
272
+ self.class.attribute_map.each_pair do |attr, param|
273
+ value = self.send(attr)
274
+ if value.nil?
275
+ is_nullable = self.class.openapi_nullable.include?(attr)
276
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
277
+ end
278
+
279
+ hash[param] = _to_hash(value)
280
+ end
281
+ hash
282
+ end
283
+
284
+ # Outputs non-array value in the form of hash
285
+ # For object, use to_hash. Otherwise, just return the value
286
+ # @param [Object] value Any valid value
287
+ # @return [Hash] Returns the value in the form of hash
288
+ def _to_hash(value)
289
+ if value.is_a?(Array)
290
+ value.compact.map { |v| _to_hash(v) }
291
+ elsif value.is_a?(Hash)
292
+ {}.tap do |hash|
293
+ value.each { |k, v| hash[k] = _to_hash(v) }
294
+ end
295
+ elsif value.respond_to? :to_hash
296
+ value.to_hash
297
+ else
298
+ value
299
+ end
300
+ end
301
+
302
+ end
303
+
304
+ end
@@ -45,6 +45,8 @@ module UltracartClient
45
45
 
46
46
  attr_accessor :participants
47
47
 
48
+ attr_accessor :sentiment
49
+
48
50
  # Start of the conversation date/time
49
51
  attr_accessor :start_dts
50
52
 
@@ -90,6 +92,7 @@ module UltracartClient
90
92
  :'merchant_id' => :'merchant_id',
91
93
  :'message_count' => :'message_count',
92
94
  :'participants' => :'participants',
95
+ :'sentiment' => :'sentiment',
93
96
  :'start_dts' => :'start_dts',
94
97
  :'unread_messages' => :'unread_messages',
95
98
  :'visible' => :'visible'
@@ -117,6 +120,7 @@ module UltracartClient
117
120
  :'merchant_id' => :'String',
118
121
  :'message_count' => :'Integer',
119
122
  :'participants' => :'Array<ConversationParticipant>',
123
+ :'sentiment' => :'ConversationSentiment',
120
124
  :'start_dts' => :'String',
121
125
  :'unread_messages' => :'Boolean',
122
126
  :'visible' => :'Boolean'
@@ -198,6 +202,10 @@ module UltracartClient
198
202
  end
199
203
  end
200
204
 
205
+ if attributes.key?(:'sentiment')
206
+ self.sentiment = attributes[:'sentiment']
207
+ end
208
+
201
209
  if attributes.key?(:'start_dts')
202
210
  self.start_dts = attributes[:'start_dts']
203
211
  end
@@ -254,6 +262,7 @@ module UltracartClient
254
262
  merchant_id == o.merchant_id &&
255
263
  message_count == o.message_count &&
256
264
  participants == o.participants &&
265
+ sentiment == o.sentiment &&
257
266
  start_dts == o.start_dts &&
258
267
  unread_messages == o.unread_messages &&
259
268
  visible == o.visible
@@ -268,7 +277,7 @@ module UltracartClient
268
277
  # Calculates hash code according to all attributes.
269
278
  # @return [Integer] Hash code
270
279
  def hash
271
- [closed, conversation_arn, conversation_uuid, customer_first_message_unresponded_to_dts, last_conversation_message_body, last_conversation_participant_arn, last_conversation_participant_name, last_interactive_message_dts, last_message_dts, medium, merchant_id, message_count, participants, start_dts, unread_messages, visible].hash
280
+ [closed, conversation_arn, conversation_uuid, customer_first_message_unresponded_to_dts, last_conversation_message_body, last_conversation_participant_arn, last_conversation_participant_name, last_interactive_message_dts, last_message_dts, medium, merchant_id, message_count, participants, sentiment, start_dts, unread_messages, visible].hash
272
281
  end
273
282
 
274
283
  # Builds the object from hash