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