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