ultracart_api 4.0.45.rc → 4.0.48.rc

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