ultracart_api 4.0.85.rc → 4.0.87.rc

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