ultracart_api 4.1.234 → 4.1.235

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,394 @@
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 SfvbTrackingCheckPlan
18
+ # The tracking provider catalog version the plan was built from.
19
+ attr_accessor :catalog_version
20
+
21
+ # The consent state the plan assumes. none, all, or the granted categories in the order statistics, preferences, marketing. Left out when the plan lists every gate instead.
22
+ attr_accessor :consent
23
+
24
+ # page_view, or purchase for a test order receipt.
25
+ attr_accessor :event
26
+
27
+ # What the plan assumes about the browser and the page.
28
+ attr_accessor :notes
29
+
30
+ # The test order a purchase plan is for. Left out for a page view.
31
+ attr_accessor :order_id
32
+
33
+ # The page path the plan is for, as given.
34
+ attr_accessor :path
35
+
36
+ # The lowercase SHA-256 hex of the UTF-8 bytes of this response written as JSON without plan_id and snippet, with object keys sorted, no white space, and keys whose value is null left out, as JavaScript JSON.stringify writes values. A results file carries it, so the CLI can tell which plan the results belong to.
37
+ attr_accessor :plan_id
38
+
39
+ # One entry per provider the storefront turns on for this event, then one per host found in custom or affiliate network HTML.
40
+ attr_accessor :providers
41
+
42
+ # Where the browser is, which decides which gates apply. eea, non-us or other. Left out when the plan lists every gate instead.
43
+ attr_accessor :region
44
+
45
+ # What providers send from UltraCart servers for this event. The browser never sees these, so they are reported as not checked.
46
+ attr_accessor :server_side
47
+
48
+ # The collector, the source of one JavaScript async arrow function. Run it with addInitScript before the action so it starts before the page scripts, then run it again with evaluate after the action. The second run waits for 3 seconds of quiet, or 15 seconds at most, and returns plan_id, page, collected_at, requests (url, initiator) and events (via, name, params). URLs keep only the query params the plan names for that host, and events only the params the plan names. It never reads cookies, storage or form fields and sends nothing anywhere.
49
+ attr_accessor :snippet
50
+
51
+ # The storefront.
52
+ attr_accessor :storefront_oid
53
+
54
+ # What the plan could not predict, and why.
55
+ attr_accessor :unchecked
56
+
57
+ class EnumAttributeValidator
58
+ attr_reader :datatype
59
+ attr_reader :allowable_values
60
+
61
+ def initialize(datatype, allowable_values)
62
+ @allowable_values = allowable_values.map do |value|
63
+ case datatype.to_s
64
+ when /Integer/i
65
+ value.to_i
66
+ when /Float/i
67
+ value.to_f
68
+ else
69
+ value
70
+ end
71
+ end
72
+ end
73
+
74
+ def valid?(value)
75
+ !value || allowable_values.include?(value)
76
+ end
77
+ end
78
+
79
+ # Attribute mapping from ruby-style variable name to JSON key.
80
+ def self.attribute_map
81
+ {
82
+ :'catalog_version' => :'catalog_version',
83
+ :'consent' => :'consent',
84
+ :'event' => :'event',
85
+ :'notes' => :'notes',
86
+ :'order_id' => :'order_id',
87
+ :'path' => :'path',
88
+ :'plan_id' => :'plan_id',
89
+ :'providers' => :'providers',
90
+ :'region' => :'region',
91
+ :'server_side' => :'server_side',
92
+ :'snippet' => :'snippet',
93
+ :'storefront_oid' => :'storefront_oid',
94
+ :'unchecked' => :'unchecked'
95
+ }
96
+ end
97
+
98
+ # Returns all the JSON keys this model knows about
99
+ def self.acceptable_attributes
100
+ attribute_map.values
101
+ end
102
+
103
+ # Attribute type mapping.
104
+ def self.openapi_types
105
+ {
106
+ :'catalog_version' => :'Integer',
107
+ :'consent' => :'String',
108
+ :'event' => :'String',
109
+ :'notes' => :'Array<String>',
110
+ :'order_id' => :'String',
111
+ :'path' => :'String',
112
+ :'plan_id' => :'String',
113
+ :'providers' => :'Array<SfvbTrackingCheckPlanProvider>',
114
+ :'region' => :'String',
115
+ :'server_side' => :'Array<SfvbTrackingCheckPlanServerSide>',
116
+ :'snippet' => :'String',
117
+ :'storefront_oid' => :'Integer',
118
+ :'unchecked' => :'Array<SfvbTrackingCheckPlanUnchecked>'
119
+ }
120
+ end
121
+
122
+ # List of attributes with nullable: true
123
+ def self.openapi_nullable
124
+ Set.new([
125
+ ])
126
+ end
127
+
128
+ # Initializes the object
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ def initialize(attributes = {})
131
+ if (!attributes.is_a?(Hash))
132
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbTrackingCheckPlan` initialize method"
133
+ end
134
+
135
+ # check to see if the attribute exists and convert string to symbol for hash key
136
+ attributes = attributes.each_with_object({}) { |(k, v), h|
137
+ if (!self.class.attribute_map.key?(k.to_sym))
138
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbTrackingCheckPlan`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
139
+ end
140
+ h[k.to_sym] = v
141
+ }
142
+
143
+ if attributes.key?(:'catalog_version')
144
+ self.catalog_version = attributes[:'catalog_version']
145
+ end
146
+
147
+ if attributes.key?(:'consent')
148
+ self.consent = attributes[:'consent']
149
+ end
150
+
151
+ if attributes.key?(:'event')
152
+ self.event = attributes[:'event']
153
+ end
154
+
155
+ if attributes.key?(:'notes')
156
+ if (value = attributes[:'notes']).is_a?(Array)
157
+ self.notes = value
158
+ end
159
+ end
160
+
161
+ if attributes.key?(:'order_id')
162
+ self.order_id = attributes[:'order_id']
163
+ end
164
+
165
+ if attributes.key?(:'path')
166
+ self.path = attributes[:'path']
167
+ end
168
+
169
+ if attributes.key?(:'plan_id')
170
+ self.plan_id = attributes[:'plan_id']
171
+ end
172
+
173
+ if attributes.key?(:'providers')
174
+ if (value = attributes[:'providers']).is_a?(Array)
175
+ self.providers = value
176
+ end
177
+ end
178
+
179
+ if attributes.key?(:'region')
180
+ self.region = attributes[:'region']
181
+ end
182
+
183
+ if attributes.key?(:'server_side')
184
+ if (value = attributes[:'server_side']).is_a?(Array)
185
+ self.server_side = value
186
+ end
187
+ end
188
+
189
+ if attributes.key?(:'snippet')
190
+ self.snippet = attributes[:'snippet']
191
+ end
192
+
193
+ if attributes.key?(:'storefront_oid')
194
+ self.storefront_oid = attributes[:'storefront_oid']
195
+ end
196
+
197
+ if attributes.key?(:'unchecked')
198
+ if (value = attributes[:'unchecked']).is_a?(Array)
199
+ self.unchecked = value
200
+ end
201
+ end
202
+ end
203
+
204
+ # Show invalid properties with the reasons. Usually used together with valid?
205
+ # @return Array for valid properties with the reasons
206
+ def list_invalid_properties
207
+ invalid_properties = Array.new
208
+ invalid_properties
209
+ end
210
+
211
+ # Check to see if the all the properties in the model are valid
212
+ # @return true if the model is valid
213
+ def valid?
214
+ event_validator = EnumAttributeValidator.new('String', ["page_view", "purchase"])
215
+ return false unless event_validator.valid?(@event)
216
+ region_validator = EnumAttributeValidator.new('String', ["eea", "non-us", "other"])
217
+ return false unless region_validator.valid?(@region)
218
+ true
219
+ end
220
+
221
+ # Custom attribute writer method checking allowed values (enum).
222
+ # @param [Object] event Object to be assigned
223
+ def event=(event)
224
+ validator = EnumAttributeValidator.new('String', ["page_view", "purchase"])
225
+ unless validator.valid?(event)
226
+ fail ArgumentError, "invalid value for \"event\", must be one of #{validator.allowable_values}."
227
+ end
228
+ @event = event
229
+ end
230
+
231
+ # Custom attribute writer method checking allowed values (enum).
232
+ # @param [Object] region Object to be assigned
233
+ def region=(region)
234
+ validator = EnumAttributeValidator.new('String', ["eea", "non-us", "other"])
235
+ unless validator.valid?(region)
236
+ fail ArgumentError, "invalid value for \"region\", must be one of #{validator.allowable_values}."
237
+ end
238
+ @region = region
239
+ end
240
+
241
+ # Checks equality by comparing each attribute.
242
+ # @param [Object] Object to be compared
243
+ def ==(o)
244
+ return true if self.equal?(o)
245
+ self.class == o.class &&
246
+ catalog_version == o.catalog_version &&
247
+ consent == o.consent &&
248
+ event == o.event &&
249
+ notes == o.notes &&
250
+ order_id == o.order_id &&
251
+ path == o.path &&
252
+ plan_id == o.plan_id &&
253
+ providers == o.providers &&
254
+ region == o.region &&
255
+ server_side == o.server_side &&
256
+ snippet == o.snippet &&
257
+ storefront_oid == o.storefront_oid &&
258
+ unchecked == o.unchecked
259
+ end
260
+
261
+ # @see the `==` method
262
+ # @param [Object] Object to be compared
263
+ def eql?(o)
264
+ self == o
265
+ end
266
+
267
+ # Calculates hash code according to all attributes.
268
+ # @return [Integer] Hash code
269
+ def hash
270
+ [catalog_version, consent, event, notes, order_id, path, plan_id, providers, region, server_side, snippet, storefront_oid, unchecked].hash
271
+ end
272
+
273
+ # Builds the object from hash
274
+ # @param [Hash] attributes Model attributes in the form of hash
275
+ # @return [Object] Returns the model itself
276
+ def self.build_from_hash(attributes)
277
+ new.build_from_hash(attributes)
278
+ end
279
+
280
+ # Builds the object from hash
281
+ # @param [Hash] attributes Model attributes in the form of hash
282
+ # @return [Object] Returns the model itself
283
+ def build_from_hash(attributes)
284
+ return nil unless attributes.is_a?(Hash)
285
+ attributes = attributes.transform_keys(&:to_sym)
286
+ self.class.openapi_types.each_pair do |key, type|
287
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
288
+ self.send("#{key}=", nil)
289
+ elsif type =~ /\AArray<(.*)>/i
290
+ # check to ensure the input is an array given that the attribute
291
+ # is documented as an array but the input is not
292
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
293
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
294
+ end
295
+ elsif !attributes[self.class.attribute_map[key]].nil?
296
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
297
+ end
298
+ end
299
+
300
+ self
301
+ end
302
+
303
+ # Deserializes the data based on type
304
+ # @param string type Data type
305
+ # @param string value Value to be deserialized
306
+ # @return [Object] Deserialized data
307
+ def _deserialize(type, value)
308
+ case type.to_sym
309
+ when :Time
310
+ Time.parse(value)
311
+ when :Date
312
+ Date.parse(value)
313
+ when :String
314
+ value.to_s
315
+ when :Integer
316
+ value.to_i
317
+ when :Float
318
+ value.to_f
319
+ when :Boolean
320
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
321
+ true
322
+ else
323
+ false
324
+ end
325
+ when :Object
326
+ # generic object (usually a Hash), return directly
327
+ value
328
+ when /\AArray<(?<inner_type>.+)>\z/
329
+ inner_type = Regexp.last_match[:inner_type]
330
+ value.map { |v| _deserialize(inner_type, v) }
331
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
332
+ k_type = Regexp.last_match[:k_type]
333
+ v_type = Regexp.last_match[:v_type]
334
+ {}.tap do |hash|
335
+ value.each do |k, v|
336
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
337
+ end
338
+ end
339
+ else # model
340
+ # models (e.g. Pet) or oneOf
341
+ klass = UltracartClient.const_get(type)
342
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
343
+ end
344
+ end
345
+
346
+ # Returns the string representation of the object
347
+ # @return [String] String presentation of the object
348
+ def to_s
349
+ to_hash.to_s
350
+ end
351
+
352
+ # to_body is an alias to to_hash (backward compatibility)
353
+ # @return [Hash] Returns the object in the form of hash
354
+ def to_body
355
+ to_hash
356
+ end
357
+
358
+ # Returns the object in the form of hash
359
+ # @return [Hash] Returns the object in the form of hash
360
+ def to_hash
361
+ hash = {}
362
+ self.class.attribute_map.each_pair do |attr, param|
363
+ value = self.send(attr)
364
+ if value.nil?
365
+ is_nullable = self.class.openapi_nullable.include?(attr)
366
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
367
+ end
368
+
369
+ hash[param] = _to_hash(value)
370
+ end
371
+ hash
372
+ end
373
+
374
+ # Outputs non-array value in the form of hash
375
+ # For object, use to_hash. Otherwise, just return the value
376
+ # @param [Object] value Any valid value
377
+ # @return [Hash] Returns the value in the form of hash
378
+ def _to_hash(value)
379
+ if value.is_a?(Array)
380
+ value.compact.map { |v| _to_hash(v) }
381
+ elsif value.is_a?(Hash)
382
+ {}.tap do |hash|
383
+ value.each { |k, v| hash[k] = _to_hash(v) }
384
+ end
385
+ elsif value.respond_to? :to_hash
386
+ value.to_hash
387
+ else
388
+ value
389
+ end
390
+ end
391
+
392
+ end
393
+
394
+ end
@@ -0,0 +1,274 @@
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 SfvbTrackingCheckPlanEvent
18
+ # The event name or command.
19
+ attr_accessor :name
20
+
21
+ # Params the call must carry, as text. A star means present with any value.
22
+ attr_accessor :params
23
+
24
+ # dataLayer, gtag or fbq.
25
+ attr_accessor :via
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'name' => :'name',
53
+ :'params' => :'params',
54
+ :'via' => :'via'
55
+ }
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'name' => :'String',
67
+ :'params' => :'Object',
68
+ :'via' => :'String'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbTrackingCheckPlanEvent` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ attributes = attributes.each_with_object({}) { |(k, v), h|
87
+ if (!self.class.attribute_map.key?(k.to_sym))
88
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbTrackingCheckPlanEvent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
89
+ end
90
+ h[k.to_sym] = v
91
+ }
92
+
93
+ if attributes.key?(:'name')
94
+ self.name = attributes[:'name']
95
+ end
96
+
97
+ if attributes.key?(:'params')
98
+ self.params = attributes[:'params']
99
+ end
100
+
101
+ if attributes.key?(:'via')
102
+ self.via = attributes[:'via']
103
+ end
104
+ end
105
+
106
+ # Show invalid properties with the reasons. Usually used together with valid?
107
+ # @return Array for valid properties with the reasons
108
+ def list_invalid_properties
109
+ invalid_properties = Array.new
110
+ invalid_properties
111
+ end
112
+
113
+ # Check to see if the all the properties in the model are valid
114
+ # @return true if the model is valid
115
+ def valid?
116
+ via_validator = EnumAttributeValidator.new('String', ["dataLayer", "gtag", "fbq"])
117
+ return false unless via_validator.valid?(@via)
118
+ true
119
+ end
120
+
121
+ # Custom attribute writer method checking allowed values (enum).
122
+ # @param [Object] via Object to be assigned
123
+ def via=(via)
124
+ validator = EnumAttributeValidator.new('String', ["dataLayer", "gtag", "fbq"])
125
+ unless validator.valid?(via)
126
+ fail ArgumentError, "invalid value for \"via\", must be one of #{validator.allowable_values}."
127
+ end
128
+ @via = via
129
+ end
130
+
131
+ # Checks equality by comparing each attribute.
132
+ # @param [Object] Object to be compared
133
+ def ==(o)
134
+ return true if self.equal?(o)
135
+ self.class == o.class &&
136
+ name == o.name &&
137
+ params == o.params &&
138
+ via == o.via
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Integer] Hash code
149
+ def hash
150
+ [name, params, via].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def self.build_from_hash(attributes)
157
+ new.build_from_hash(attributes)
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ attributes = attributes.transform_keys(&:to_sym)
166
+ self.class.openapi_types.each_pair do |key, type|
167
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
168
+ self.send("#{key}=", nil)
169
+ elsif type =~ /\AArray<(.*)>/i
170
+ # check to ensure the input is an array given that the attribute
171
+ # is documented as an array but the input is not
172
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
173
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
174
+ end
175
+ elsif !attributes[self.class.attribute_map[key]].nil?
176
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
177
+ end
178
+ end
179
+
180
+ self
181
+ end
182
+
183
+ # Deserializes the data based on type
184
+ # @param string type Data type
185
+ # @param string value Value to be deserialized
186
+ # @return [Object] Deserialized data
187
+ def _deserialize(type, value)
188
+ case type.to_sym
189
+ when :Time
190
+ Time.parse(value)
191
+ when :Date
192
+ Date.parse(value)
193
+ when :String
194
+ value.to_s
195
+ when :Integer
196
+ value.to_i
197
+ when :Float
198
+ value.to_f
199
+ when :Boolean
200
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
201
+ true
202
+ else
203
+ false
204
+ end
205
+ when :Object
206
+ # generic object (usually a Hash), return directly
207
+ value
208
+ when /\AArray<(?<inner_type>.+)>\z/
209
+ inner_type = Regexp.last_match[:inner_type]
210
+ value.map { |v| _deserialize(inner_type, v) }
211
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
212
+ k_type = Regexp.last_match[:k_type]
213
+ v_type = Regexp.last_match[:v_type]
214
+ {}.tap do |hash|
215
+ value.each do |k, v|
216
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
217
+ end
218
+ end
219
+ else # model
220
+ # models (e.g. Pet) or oneOf
221
+ klass = UltracartClient.const_get(type)
222
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ if value.nil?
245
+ is_nullable = self.class.openapi_nullable.include?(attr)
246
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
247
+ end
248
+
249
+ hash[param] = _to_hash(value)
250
+ end
251
+ hash
252
+ end
253
+
254
+ # Outputs non-array value in the form of hash
255
+ # For object, use to_hash. Otherwise, just return the value
256
+ # @param [Object] value Any valid value
257
+ # @return [Hash] Returns the value in the form of hash
258
+ def _to_hash(value)
259
+ if value.is_a?(Array)
260
+ value.compact.map { |v| _to_hash(v) }
261
+ elsif value.is_a?(Hash)
262
+ {}.tap do |hash|
263
+ value.each { |k, v| hash[k] = _to_hash(v) }
264
+ end
265
+ elsif value.respond_to? :to_hash
266
+ value.to_hash
267
+ else
268
+ value
269
+ end
270
+ end
271
+
272
+ end
273
+
274
+ end