ultracart_api 3.10.67 → 3.10.69

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,222 @@
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 ConversationWebchatContext
17
+ attr_accessor :cart
18
+
19
+ attr_accessor :current_url
20
+
21
+ attr_accessor :page_view
22
+
23
+ attr_accessor :session_start
24
+
25
+ attr_accessor :session_utm
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'cart' => :'cart',
31
+ :'current_url' => :'current_url',
32
+ :'page_view' => :'page_view',
33
+ :'session_start' => :'session_start',
34
+ :'session_utm' => :'session_utm'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.swagger_types
40
+ {
41
+ :'cart' => :'Cart',
42
+ :'current_url' => :'String',
43
+ :'page_view' => :'Array<HitPageView>',
44
+ :'session_start' => :'HitSessionStart',
45
+ :'session_utm' => :'HitSessionUtm'
46
+ }
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
+
57
+ if attributes.has_key?(:'cart')
58
+ self.cart = attributes[:'cart']
59
+ end
60
+
61
+ if attributes.has_key?(:'current_url')
62
+ self.current_url = attributes[:'current_url']
63
+ end
64
+
65
+ if attributes.has_key?(:'page_view')
66
+ if (value = attributes[:'page_view']).is_a?(Array)
67
+ self.page_view = value
68
+ end
69
+ end
70
+
71
+ if attributes.has_key?(:'session_start')
72
+ self.session_start = attributes[:'session_start']
73
+ end
74
+
75
+ if attributes.has_key?(:'session_utm')
76
+ self.session_utm = attributes[:'session_utm']
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ invalid_properties = Array.new
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ cart == o.cart &&
99
+ current_url == o.current_url &&
100
+ page_view == o.page_view &&
101
+ session_start == o.session_start &&
102
+ session_utm == o.session_utm
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 [Fixnum] Hash code
113
+ def hash
114
+ [cart, current_url, page_view, session_start, session_utm].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 build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ self.class.swagger_types.each_pair do |key, type|
123
+ if type =~ /\AArray<(.*)>/i
124
+ # check to ensure the input is an array given that the attribute
125
+ # is documented as an array but the input is not
126
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
127
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
128
+ end
129
+ elsif !attributes[self.class.attribute_map[key]].nil?
130
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
131
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :DateTime
144
+ DateTime.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :BOOLEAN
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ temp_model = UltracartClient.const_get(type).new
175
+ temp_model.build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ next if value.nil?
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+ end
@@ -44,6 +44,8 @@ module UltracartClient
44
44
 
45
45
  attr_accessor :event_updated_message
46
46
 
47
+ attr_accessor :event_webchat_context
48
+
47
49
  attr_accessor :message
48
50
 
49
51
  # Type of message
@@ -88,6 +90,7 @@ module UltracartClient
88
90
  :'event_type' => :'event_type',
89
91
  :'event_typing' => :'event_typing',
90
92
  :'event_updated_message' => :'event_updated_message',
93
+ :'event_webchat_context' => :'event_webchat_context',
91
94
  :'message' => :'message',
92
95
  :'type' => :'type'
93
96
  }
@@ -110,6 +113,7 @@ module UltracartClient
110
113
  :'event_type' => :'String',
111
114
  :'event_typing' => :'ConversationEventTyping',
112
115
  :'event_updated_message' => :'ConversationMessage',
116
+ :'event_webchat_context' => :'ConversationEventWebchatContext',
113
117
  :'message' => :'ConversationMessage',
114
118
  :'type' => :'String'
115
119
  }
@@ -179,6 +183,10 @@ module UltracartClient
179
183
  self.event_updated_message = attributes[:'event_updated_message']
180
184
  end
181
185
 
186
+ if attributes.has_key?(:'event_webchat_context')
187
+ self.event_webchat_context = attributes[:'event_webchat_context']
188
+ end
189
+
182
190
  if attributes.has_key?(:'message')
183
191
  self.message = attributes[:'message']
184
192
  end
@@ -198,7 +206,7 @@ module UltracartClient
198
206
  # Check to see if the all the properties in the model are valid
199
207
  # @return true if the model is valid
200
208
  def valid?
201
- 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', 'typing', 'add coupon', 'add item'])
209
+ 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', 'typing', 'add coupon', 'add item', 'webchat context'])
202
210
  return false unless event_type_validator.valid?(@event_type)
203
211
  type_validator = EnumAttributeValidator.new('String', ['message', 'event', 'ping', 'check queue position'])
204
212
  return false unless type_validator.valid?(@type)
@@ -208,7 +216,7 @@ module UltracartClient
208
216
  # Custom attribute writer method checking allowed values (enum).
209
217
  # @param [Object] event_type Object to be assigned
210
218
  def event_type=(event_type)
211
- 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', 'typing', 'add coupon', 'add item'])
219
+ 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', 'typing', 'add coupon', 'add item', 'webchat context'])
212
220
  unless validator.valid?(event_type)
213
221
  fail ArgumentError, 'invalid value for "event_type", must be one of #{validator.allowable_values}.'
214
222
  end
@@ -244,6 +252,7 @@ module UltracartClient
244
252
  event_type == o.event_type &&
245
253
  event_typing == o.event_typing &&
246
254
  event_updated_message == o.event_updated_message &&
255
+ event_webchat_context == o.event_webchat_context &&
247
256
  message == o.message &&
248
257
  type == o.type
249
258
  end
@@ -257,7 +266,7 @@ module UltracartClient
257
266
  # Calculates hash code according to all attributes.
258
267
  # @return [Fixnum] Hash code
259
268
  def hash
260
- [conversation_uuid, event_add_coupon, event_add_item, 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
269
+ [conversation_uuid, event_add_coupon, event_add_item, 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, event_webchat_context, message, type].hash
261
270
  end
262
271
 
263
272
  # Builds the object from hash
@@ -0,0 +1,276 @@
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 HitPageView
17
+ attr_accessor :bounce
18
+
19
+ attr_accessor :meta_data
20
+
21
+ attr_accessor :method
22
+
23
+ attr_accessor :prefetch
24
+
25
+ attr_accessor :query
26
+
27
+ attr_accessor :recording
28
+
29
+ attr_accessor :redirect
30
+
31
+ attr_accessor :referrer
32
+
33
+ attr_accessor :time_on_page
34
+
35
+ attr_accessor :title
36
+
37
+ attr_accessor :url
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'bounce' => :'bounce',
43
+ :'meta_data' => :'meta_data',
44
+ :'method' => :'method',
45
+ :'prefetch' => :'prefetch',
46
+ :'query' => :'query',
47
+ :'recording' => :'recording',
48
+ :'redirect' => :'redirect',
49
+ :'referrer' => :'referrer',
50
+ :'time_on_page' => :'time_on_page',
51
+ :'title' => :'title',
52
+ :'url' => :'url'
53
+ }
54
+ end
55
+
56
+ # Attribute type mapping.
57
+ def self.swagger_types
58
+ {
59
+ :'bounce' => :'BOOLEAN',
60
+ :'meta_data' => :'Array<HitPageViewMetaData>',
61
+ :'method' => :'String',
62
+ :'prefetch' => :'BOOLEAN',
63
+ :'query' => :'String',
64
+ :'recording' => :'BOOLEAN',
65
+ :'redirect' => :'BOOLEAN',
66
+ :'referrer' => :'String',
67
+ :'time_on_page' => :'Float',
68
+ :'title' => :'String',
69
+ :'url' => :'String'
70
+ }
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ return unless attributes.is_a?(Hash)
77
+
78
+ # convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
80
+
81
+ if attributes.has_key?(:'bounce')
82
+ self.bounce = attributes[:'bounce']
83
+ end
84
+
85
+ if attributes.has_key?(:'meta_data')
86
+ if (value = attributes[:'meta_data']).is_a?(Array)
87
+ self.meta_data = value
88
+ end
89
+ end
90
+
91
+ if attributes.has_key?(:'method')
92
+ self.method = attributes[:'method']
93
+ end
94
+
95
+ if attributes.has_key?(:'prefetch')
96
+ self.prefetch = attributes[:'prefetch']
97
+ end
98
+
99
+ if attributes.has_key?(:'query')
100
+ self.query = attributes[:'query']
101
+ end
102
+
103
+ if attributes.has_key?(:'recording')
104
+ self.recording = attributes[:'recording']
105
+ end
106
+
107
+ if attributes.has_key?(:'redirect')
108
+ self.redirect = attributes[:'redirect']
109
+ end
110
+
111
+ if attributes.has_key?(:'referrer')
112
+ self.referrer = attributes[:'referrer']
113
+ end
114
+
115
+ if attributes.has_key?(:'time_on_page')
116
+ self.time_on_page = attributes[:'time_on_page']
117
+ end
118
+
119
+ if attributes.has_key?(:'title')
120
+ self.title = attributes[:'title']
121
+ end
122
+
123
+ if attributes.has_key?(:'url')
124
+ self.url = attributes[:'url']
125
+ end
126
+ end
127
+
128
+ # Show invalid properties with the reasons. Usually used together with valid?
129
+ # @return Array for valid properties with the reasons
130
+ def list_invalid_properties
131
+ invalid_properties = Array.new
132
+ invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ true
139
+ end
140
+
141
+ # Checks equality by comparing each attribute.
142
+ # @param [Object] Object to be compared
143
+ def ==(o)
144
+ return true if self.equal?(o)
145
+ self.class == o.class &&
146
+ bounce == o.bounce &&
147
+ meta_data == o.meta_data &&
148
+ method == o.method &&
149
+ prefetch == o.prefetch &&
150
+ query == o.query &&
151
+ recording == o.recording &&
152
+ redirect == o.redirect &&
153
+ referrer == o.referrer &&
154
+ time_on_page == o.time_on_page &&
155
+ title == o.title &&
156
+ url == o.url
157
+ end
158
+
159
+ # @see the `==` method
160
+ # @param [Object] Object to be compared
161
+ def eql?(o)
162
+ self == o
163
+ end
164
+
165
+ # Calculates hash code according to all attributes.
166
+ # @return [Fixnum] Hash code
167
+ def hash
168
+ [bounce, meta_data, method, prefetch, query, recording, redirect, referrer, time_on_page, title, url].hash
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def build_from_hash(attributes)
175
+ return nil unless attributes.is_a?(Hash)
176
+ self.class.swagger_types.each_pair do |key, type|
177
+ if type =~ /\AArray<(.*)>/i
178
+ # check to ensure the input is an array given that the attribute
179
+ # is documented as an array but the input is not
180
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
181
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
182
+ end
183
+ elsif !attributes[self.class.attribute_map[key]].nil?
184
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
185
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
186
+ end
187
+
188
+ self
189
+ end
190
+
191
+ # Deserializes the data based on type
192
+ # @param string type Data type
193
+ # @param string value Value to be deserialized
194
+ # @return [Object] Deserialized data
195
+ def _deserialize(type, value)
196
+ case type.to_sym
197
+ when :DateTime
198
+ DateTime.parse(value)
199
+ when :Date
200
+ Date.parse(value)
201
+ when :String
202
+ value.to_s
203
+ when :Integer
204
+ value.to_i
205
+ when :Float
206
+ value.to_f
207
+ when :BOOLEAN
208
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
209
+ true
210
+ else
211
+ false
212
+ end
213
+ when :Object
214
+ # generic object (usually a Hash), return directly
215
+ value
216
+ when /\AArray<(?<inner_type>.+)>\z/
217
+ inner_type = Regexp.last_match[:inner_type]
218
+ value.map { |v| _deserialize(inner_type, v) }
219
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
220
+ k_type = Regexp.last_match[:k_type]
221
+ v_type = Regexp.last_match[:v_type]
222
+ {}.tap do |hash|
223
+ value.each do |k, v|
224
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
225
+ end
226
+ end
227
+ else # model
228
+ temp_model = UltracartClient.const_get(type).new
229
+ temp_model.build_from_hash(value)
230
+ end
231
+ end
232
+
233
+ # Returns the string representation of the object
234
+ # @return [String] String presentation of the object
235
+ def to_s
236
+ to_hash.to_s
237
+ end
238
+
239
+ # to_body is an alias to to_hash (backward compatibility)
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_body
242
+ to_hash
243
+ end
244
+
245
+ # Returns the object in the form of hash
246
+ # @return [Hash] Returns the object in the form of hash
247
+ def to_hash
248
+ hash = {}
249
+ self.class.attribute_map.each_pair do |attr, param|
250
+ value = self.send(attr)
251
+ next if value.nil?
252
+ hash[param] = _to_hash(value)
253
+ end
254
+ hash
255
+ end
256
+
257
+ # Outputs non-array value in the form of hash
258
+ # For object, use to_hash. Otherwise, just return the value
259
+ # @param [Object] value Any valid value
260
+ # @return [Hash] Returns the value in the form of hash
261
+ def _to_hash(value)
262
+ if value.is_a?(Array)
263
+ value.compact.map { |v| _to_hash(v) }
264
+ elsif value.is_a?(Hash)
265
+ {}.tap do |hash|
266
+ value.each { |k, v| hash[k] = _to_hash(v) }
267
+ end
268
+ elsif value.respond_to? :to_hash
269
+ value.to_hash
270
+ else
271
+ value
272
+ end
273
+ end
274
+
275
+ end
276
+ end