algolia 3.0.0.alpha.2 → 3.0.0.alpha.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +27 -0
  3. data/.gitignore +39 -0
  4. data/.openapi-generator/FILES +164 -0
  5. data/.openapi-generator/VERSION +1 -0
  6. data/.openapi-generator-ignore +23 -0
  7. data/.rubocop.yml +99 -0
  8. data/CHANGELOG.md +16 -0
  9. data/Gemfile.lock +1 -1
  10. data/algolia.gemspec +1 -1
  11. data/lib/algolia/api/insights_client.rb +52 -0
  12. data/lib/algolia/models/insights/added_to_cart_object_ids.rb +81 -31
  13. data/lib/algolia/models/insights/added_to_cart_object_ids_after_search.rb +81 -31
  14. data/lib/algolia/models/insights/clicked_filters.rb +41 -18
  15. data/lib/algolia/models/insights/clicked_object_ids.rb +39 -6
  16. data/lib/algolia/models/insights/clicked_object_ids_after_search.rb +43 -20
  17. data/lib/algolia/models/insights/converted_filters.rb +41 -18
  18. data/lib/algolia/models/insights/converted_object_ids.rb +42 -19
  19. data/lib/algolia/models/insights/converted_object_ids_after_search.rb +42 -19
  20. data/lib/algolia/models/insights/discount.rb +1 -1
  21. data/lib/algolia/models/insights/insights_events.rb +1 -1
  22. data/lib/algolia/models/insights/object_data.rb +1 -1
  23. data/lib/algolia/models/insights/object_data_after_search.rb +25 -2
  24. data/lib/algolia/models/insights/price.rb +1 -1
  25. data/lib/algolia/models/insights/purchased_object_ids.rb +81 -31
  26. data/lib/algolia/models/insights/purchased_object_ids_after_search.rb +81 -66
  27. data/lib/algolia/models/insights/value.rb +97 -0
  28. data/lib/algolia/models/insights/viewed_filters.rb +41 -18
  29. data/lib/algolia/models/insights/viewed_object_ids.rb +42 -19
  30. data/lib/algolia/version.rb +1 -1
  31. metadata +10 -3
@@ -6,26 +6,26 @@ require 'time'
6
6
  module Algolia
7
7
  module Insights
8
8
  class ConvertedFilters
9
- # Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
9
+ # The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
10
10
  attr_accessor :event_name
11
11
 
12
12
  attr_accessor :event_type
13
13
 
14
- # Name of the Algolia index.
14
+ # The name of an Algolia index.
15
15
  attr_accessor :index
16
16
 
17
17
  # Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`.
18
18
  attr_accessor :filters
19
19
 
20
- # Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
20
+ # An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
21
21
  attr_accessor :user_token
22
22
 
23
- # Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
24
- attr_accessor :timestamp
25
-
26
- # User token for authenticated users.
23
+ # An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens.
27
24
  attr_accessor :authenticated_user_token
28
25
 
26
+ # The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
27
+ attr_accessor :timestamp
28
+
29
29
  class EnumAttributeValidator
30
30
  attr_reader :datatype
31
31
  attr_reader :allowable_values
@@ -56,8 +56,8 @@ module Algolia
56
56
  :index => :index,
57
57
  :filters => :filters,
58
58
  :user_token => :userToken,
59
- :timestamp => :timestamp,
60
- :authenticated_user_token => :authenticatedUserToken
59
+ :authenticated_user_token => :authenticatedUserToken,
60
+ :timestamp => :timestamp
61
61
  }
62
62
  end
63
63
 
@@ -74,8 +74,8 @@ module Algolia
74
74
  :index => :String,
75
75
  :filters => :'Array<String>',
76
76
  :user_token => :String,
77
- :timestamp => :Integer,
78
- :authenticated_user_token => :String
77
+ :authenticated_user_token => :String,
78
+ :timestamp => :Integer
79
79
  }
80
80
  end
81
81
 
@@ -133,13 +133,13 @@ module Algolia
133
133
  self.user_token = nil
134
134
  end
135
135
 
136
- if attributes.key?(:timestamp)
137
- self.timestamp = attributes[:timestamp]
138
- end
139
-
140
136
  if attributes.key?(:authenticated_user_token)
141
137
  self.authenticated_user_token = attributes[:authenticated_user_token]
142
138
  end
139
+
140
+ if attributes.key?(:timestamp)
141
+ self.timestamp = attributes[:timestamp]
142
+ end
143
143
  end
144
144
 
145
145
  # Custom attribute writer method with validation
@@ -206,6 +206,29 @@ module Algolia
206
206
  @user_token = user_token
207
207
  end
208
208
 
209
+ # Custom attribute writer method with validation
210
+ # @param [Object] authenticated_user_token Value to be assigned
211
+ def authenticated_user_token=(authenticated_user_token)
212
+ if authenticated_user_token.nil?
213
+ raise ArgumentError, 'authenticated_user_token cannot be nil'
214
+ end
215
+
216
+ if authenticated_user_token.to_s.length > 129
217
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be smaller than or equal to 129.'
218
+ end
219
+
220
+ if authenticated_user_token.to_s.length < 1
221
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be great than or equal to 1.'
222
+ end
223
+
224
+ pattern = %r{[a-zA-Z0-9_=/+-]{1,129}}
225
+ if authenticated_user_token !~ pattern
226
+ raise ArgumentError, "invalid value for \"authenticated_user_token\", must conform to the pattern #{pattern}."
227
+ end
228
+
229
+ @authenticated_user_token = authenticated_user_token
230
+ end
231
+
209
232
  # Checks equality by comparing each attribute.
210
233
  # @param [Object] Object to be compared
211
234
  def ==(other)
@@ -217,8 +240,8 @@ module Algolia
217
240
  index == other.index &&
218
241
  filters == other.filters &&
219
242
  user_token == other.user_token &&
220
- timestamp == other.timestamp &&
221
- authenticated_user_token == other.authenticated_user_token
243
+ authenticated_user_token == other.authenticated_user_token &&
244
+ timestamp == other.timestamp
222
245
  end
223
246
 
224
247
  # @see the `==` method
@@ -230,7 +253,7 @@ module Algolia
230
253
  # Calculates hash code according to all attributes.
231
254
  # @return [Integer] Hash code
232
255
  def hash
233
- [event_name, event_type, index, filters, user_token, timestamp, authenticated_user_token].hash
256
+ [event_name, event_type, index, filters, user_token, authenticated_user_token, timestamp].hash
234
257
  end
235
258
 
236
259
  # Builds the object from hash
@@ -7,26 +7,26 @@ module Algolia
7
7
  module Insights
8
8
  # Use this event to track when users convert on items unrelated to a previous Algolia request. For example, if you don't use Algolia to build your category pages, use this event. To track conversion events related to Algolia requests, use the \"Converted object IDs after search\" event.
9
9
  class ConvertedObjectIDs
10
- # Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
10
+ # The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
11
11
  attr_accessor :event_name
12
12
 
13
13
  attr_accessor :event_type
14
14
 
15
- # Name of the Algolia index.
15
+ # The name of an Algolia index.
16
16
  attr_accessor :index
17
17
 
18
- # List of object identifiers for items of an Algolia index.
18
+ # The object IDs of the records that are part of the event.
19
19
  attr_accessor :object_ids
20
20
 
21
- # Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
21
+ # An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
22
22
  attr_accessor :user_token
23
23
 
24
- # Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
25
- attr_accessor :timestamp
26
-
27
- # User token for authenticated users.
24
+ # An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens.
28
25
  attr_accessor :authenticated_user_token
29
26
 
27
+ # The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
28
+ attr_accessor :timestamp
29
+
30
30
  class EnumAttributeValidator
31
31
  attr_reader :datatype
32
32
  attr_reader :allowable_values
@@ -57,8 +57,8 @@ module Algolia
57
57
  :index => :index,
58
58
  :object_ids => :objectIDs,
59
59
  :user_token => :userToken,
60
- :timestamp => :timestamp,
61
- :authenticated_user_token => :authenticatedUserToken
60
+ :authenticated_user_token => :authenticatedUserToken,
61
+ :timestamp => :timestamp
62
62
  }
63
63
  end
64
64
 
@@ -75,8 +75,8 @@ module Algolia
75
75
  :index => :String,
76
76
  :object_ids => :'Array<String>',
77
77
  :user_token => :String,
78
- :timestamp => :Integer,
79
- :authenticated_user_token => :String
78
+ :authenticated_user_token => :String,
79
+ :timestamp => :Integer
80
80
  }
81
81
  end
82
82
 
@@ -134,13 +134,13 @@ module Algolia
134
134
  self.user_token = nil
135
135
  end
136
136
 
137
- if attributes.key?(:timestamp)
138
- self.timestamp = attributes[:timestamp]
139
- end
140
-
141
137
  if attributes.key?(:authenticated_user_token)
142
138
  self.authenticated_user_token = attributes[:authenticated_user_token]
143
139
  end
140
+
141
+ if attributes.key?(:timestamp)
142
+ self.timestamp = attributes[:timestamp]
143
+ end
144
144
  end
145
145
 
146
146
  # Custom attribute writer method with validation
@@ -207,6 +207,29 @@ module Algolia
207
207
  @user_token = user_token
208
208
  end
209
209
 
210
+ # Custom attribute writer method with validation
211
+ # @param [Object] authenticated_user_token Value to be assigned
212
+ def authenticated_user_token=(authenticated_user_token)
213
+ if authenticated_user_token.nil?
214
+ raise ArgumentError, 'authenticated_user_token cannot be nil'
215
+ end
216
+
217
+ if authenticated_user_token.to_s.length > 129
218
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be smaller than or equal to 129.'
219
+ end
220
+
221
+ if authenticated_user_token.to_s.length < 1
222
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be great than or equal to 1.'
223
+ end
224
+
225
+ pattern = %r{[a-zA-Z0-9_=/+-]{1,129}}
226
+ if authenticated_user_token !~ pattern
227
+ raise ArgumentError, "invalid value for \"authenticated_user_token\", must conform to the pattern #{pattern}."
228
+ end
229
+
230
+ @authenticated_user_token = authenticated_user_token
231
+ end
232
+
210
233
  # Checks equality by comparing each attribute.
211
234
  # @param [Object] Object to be compared
212
235
  def ==(other)
@@ -218,8 +241,8 @@ module Algolia
218
241
  index == other.index &&
219
242
  object_ids == other.object_ids &&
220
243
  user_token == other.user_token &&
221
- timestamp == other.timestamp &&
222
- authenticated_user_token == other.authenticated_user_token
244
+ authenticated_user_token == other.authenticated_user_token &&
245
+ timestamp == other.timestamp
223
246
  end
224
247
 
225
248
  # @see the `==` method
@@ -231,7 +254,7 @@ module Algolia
231
254
  # Calculates hash code according to all attributes.
232
255
  # @return [Integer] Hash code
233
256
  def hash
234
- [event_name, event_type, index, object_ids, user_token, timestamp, authenticated_user_token].hash
257
+ [event_name, event_type, index, object_ids, user_token, authenticated_user_token, timestamp].hash
235
258
  end
236
259
 
237
260
  # Builds the object from hash
@@ -7,29 +7,29 @@ module Algolia
7
7
  module Insights
8
8
  # Use this event to track when users convert after a previous Algolia request. For example, a user clicks on an item in the search results to view the product detail page. Then, the user adds the item to their shopping cart. If you're building your category pages with Algolia, you'll also use this event.
9
9
  class ConvertedObjectIDsAfterSearch
10
- # Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
10
+ # The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
11
11
  attr_accessor :event_name
12
12
 
13
13
  attr_accessor :event_type
14
14
 
15
- # Name of the Algolia index.
15
+ # The name of an Algolia index.
16
16
  attr_accessor :index
17
17
 
18
- # List of object identifiers for items of an Algolia index.
18
+ # The object IDs of the records that are part of the event.
19
19
  attr_accessor :object_ids
20
20
 
21
21
  # Unique identifier for a search query. The query ID is required for events related to search or browse requests. If you add `clickAnalytics: true` as a search request parameter, the query ID is included in the API response.
22
22
  attr_accessor :query_id
23
23
 
24
- # Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
24
+ # An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
25
25
  attr_accessor :user_token
26
26
 
27
- # Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
28
- attr_accessor :timestamp
29
-
30
- # User token for authenticated users.
27
+ # An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens.
31
28
  attr_accessor :authenticated_user_token
32
29
 
30
+ # The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
31
+ attr_accessor :timestamp
32
+
33
33
  class EnumAttributeValidator
34
34
  attr_reader :datatype
35
35
  attr_reader :allowable_values
@@ -61,8 +61,8 @@ module Algolia
61
61
  :object_ids => :objectIDs,
62
62
  :query_id => :queryID,
63
63
  :user_token => :userToken,
64
- :timestamp => :timestamp,
65
- :authenticated_user_token => :authenticatedUserToken
64
+ :authenticated_user_token => :authenticatedUserToken,
65
+ :timestamp => :timestamp
66
66
  }
67
67
  end
68
68
 
@@ -80,8 +80,8 @@ module Algolia
80
80
  :object_ids => :'Array<String>',
81
81
  :query_id => :String,
82
82
  :user_token => :String,
83
- :timestamp => :Integer,
84
- :authenticated_user_token => :String
83
+ :authenticated_user_token => :String,
84
+ :timestamp => :Integer
85
85
  }
86
86
  end
87
87
 
@@ -145,13 +145,13 @@ module Algolia
145
145
  self.user_token = nil
146
146
  end
147
147
 
148
- if attributes.key?(:timestamp)
149
- self.timestamp = attributes[:timestamp]
150
- end
151
-
152
148
  if attributes.key?(:authenticated_user_token)
153
149
  self.authenticated_user_token = attributes[:authenticated_user_token]
154
150
  end
151
+
152
+ if attributes.key?(:timestamp)
153
+ self.timestamp = attributes[:timestamp]
154
+ end
155
155
  end
156
156
 
157
157
  # Custom attribute writer method with validation
@@ -241,6 +241,29 @@ module Algolia
241
241
  @user_token = user_token
242
242
  end
243
243
 
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] authenticated_user_token Value to be assigned
246
+ def authenticated_user_token=(authenticated_user_token)
247
+ if authenticated_user_token.nil?
248
+ raise ArgumentError, 'authenticated_user_token cannot be nil'
249
+ end
250
+
251
+ if authenticated_user_token.to_s.length > 129
252
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be smaller than or equal to 129.'
253
+ end
254
+
255
+ if authenticated_user_token.to_s.length < 1
256
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be great than or equal to 1.'
257
+ end
258
+
259
+ pattern = %r{[a-zA-Z0-9_=/+-]{1,129}}
260
+ if authenticated_user_token !~ pattern
261
+ raise ArgumentError, "invalid value for \"authenticated_user_token\", must conform to the pattern #{pattern}."
262
+ end
263
+
264
+ @authenticated_user_token = authenticated_user_token
265
+ end
266
+
244
267
  # Checks equality by comparing each attribute.
245
268
  # @param [Object] Object to be compared
246
269
  def ==(other)
@@ -253,8 +276,8 @@ module Algolia
253
276
  object_ids == other.object_ids &&
254
277
  query_id == other.query_id &&
255
278
  user_token == other.user_token &&
256
- timestamp == other.timestamp &&
257
- authenticated_user_token == other.authenticated_user_token
279
+ authenticated_user_token == other.authenticated_user_token &&
280
+ timestamp == other.timestamp
258
281
  end
259
282
 
260
283
  # @see the `==` method
@@ -266,7 +289,7 @@ module Algolia
266
289
  # Calculates hash code according to all attributes.
267
290
  # @return [Integer] Hash code
268
291
  def hash
269
- [event_name, event_type, index, object_ids, query_id, user_token, timestamp, authenticated_user_token].hash
292
+ [event_name, event_type, index, object_ids, query_id, user_token, authenticated_user_token, timestamp].hash
270
293
  end
271
294
 
272
295
  # Builds the object from hash
@@ -5,7 +5,7 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Insights
8
- # Absolute value of the discount in effect for this object, measured in `currency`.
8
+ # The absolute value of the discount for this product, in units of `currency`.
9
9
  module Discount
10
10
  class << self
11
11
  # List of class defined in oneOf (OpenAPI v3)
@@ -6,7 +6,7 @@ require 'time'
6
6
  module Algolia
7
7
  module Insights
8
8
  class InsightsEvents
9
- # List of click and conversion events. An event is an object representing a user interaction. Events have attributes that describe the interaction, such as an event name, a type, or a user token. Some attributes require other attributes to be declared, and some attributes can't be declared at the same time. **All** events must be valid, otherwise the API returns an error.
9
+ # List of click and conversion events. An event is an object representing a user interaction. Events have attributes that describe the interaction, such as an event name, a type, or a user token. **All** events must be valid, otherwise the API returns an error.
10
10
  attr_accessor :events
11
11
 
12
12
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -8,7 +8,7 @@ module Algolia
8
8
  class ObjectData
9
9
  attr_accessor :price
10
10
 
11
- # The quantity of the purchased or added-to-cart item. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item.
11
+ # The quantity of a product that has been purchased or added to the cart. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item.
12
12
  attr_accessor :quantity
13
13
 
14
14
  attr_accessor :discount
@@ -6,12 +6,12 @@ require 'time'
6
6
  module Algolia
7
7
  module Insights
8
8
  class ObjectDataAfterSearch
9
- # ID of the query that this specific record is attributable to. Used to track purchase events with multiple items originating from different searches.
9
+ # Unique identifier for a search query, used to track purchase events with multiple records that originate from different searches.
10
10
  attr_accessor :query_id
11
11
 
12
12
  attr_accessor :price
13
13
 
14
- # The quantity of the purchased or added-to-cart item. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item.
14
+ # The quantity of a product that has been purchased or added to the cart. The total value of a purchase is the sum of `quantity` multiplied with the `price` for each purchased item.
15
15
  attr_accessor :quantity
16
16
 
17
17
  attr_accessor :discount
@@ -80,6 +80,29 @@ module Algolia
80
80
  end
81
81
  end
82
82
 
83
+ # Custom attribute writer method with validation
84
+ # @param [Object] query_id Value to be assigned
85
+ def query_id=(query_id)
86
+ if query_id.nil?
87
+ raise ArgumentError, 'query_id cannot be nil'
88
+ end
89
+
90
+ if query_id.to_s.length > 32
91
+ raise ArgumentError, 'invalid value for "query_id", the character length must be smaller than or equal to 32.'
92
+ end
93
+
94
+ if query_id.to_s.length < 32
95
+ raise ArgumentError, 'invalid value for "query_id", the character length must be great than or equal to 32.'
96
+ end
97
+
98
+ pattern = /[0-9a-f]{32}/
99
+ if query_id !~ pattern
100
+ raise ArgumentError, "invalid value for \"query_id\", must conform to the pattern #{pattern}."
101
+ end
102
+
103
+ @query_id = query_id
104
+ end
105
+
83
106
  # Checks equality by comparing each attribute.
84
107
  # @param [Object] Object to be compared
85
108
  def ==(other)
@@ -5,7 +5,7 @@ require 'time'
5
5
 
6
6
  module Algolia
7
7
  module Insights
8
- # The price of the item. This should be the final price, inclusive of any discounts in effect.
8
+ # The total price of a product, including any discounts, in units of `currency`.
9
9
  module Price
10
10
  class << self
11
11
  # List of class defined in oneOf (OpenAPI v3)
@@ -7,33 +7,35 @@ module Algolia
7
7
  module Insights
8
8
  # Use this event to track when users make a purchase unrelated to a previous Algolia request. For example, if you don't use Algolia to build your category pages, use this event. To track purchase events related to Algolia requests, use the \"Purchased object IDs after search\" event.
9
9
  class PurchasedObjectIDs
10
- # Can contain up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
10
+ # The name of the event, up to 64 ASCII characters. Consider naming events consistently—for example, by adopting Segment's [object-action](https://segment.com/academy/collecting-data/naming-conventions-for-clean-data/#the-object-action-framework) framework.
11
11
  attr_accessor :event_name
12
12
 
13
13
  attr_accessor :event_type
14
14
 
15
15
  attr_accessor :event_subtype
16
16
 
17
- # Name of the Algolia index.
17
+ # The name of an Algolia index.
18
18
  attr_accessor :index
19
19
 
20
- # List of object identifiers for items of an Algolia index.
20
+ # The object IDs of the records that are part of the event.
21
21
  attr_accessor :object_ids
22
22
 
23
- # Extra information about the records involved in the event—for example, to add price and quantities of purchased products. If provided, must be the same length as `objectIDs`.
24
- attr_accessor :object_data
23
+ # An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
24
+ attr_accessor :user_token
25
+
26
+ # An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens.
27
+ attr_accessor :authenticated_user_token
25
28
 
26
- # If you include pricing information in the `objectData` parameter, you must also specify the currency as ISO-4217 currency code, such as USD or EUR.
29
+ # Three-letter [currency code](https://www.iso.org/iso-4217-currency-codes.html).
27
30
  attr_accessor :currency
28
31
 
29
- # Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
30
- attr_accessor :user_token
32
+ # Extra information about the records involved in a purchase or add-to-cart event. If specified, it must have the same length as `objectIDs`.
33
+ attr_accessor :object_data
31
34
 
32
- # Time of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
35
+ # The timestamp of the event in milliseconds in [Unix epoch time](https://wikipedia.org/wiki/Unix_time). By default, the Insights API uses the time it receives an event as its timestamp.
33
36
  attr_accessor :timestamp
34
37
 
35
- # User token for authenticated users.
36
- attr_accessor :authenticated_user_token
38
+ attr_accessor :value
37
39
 
38
40
  class EnumAttributeValidator
39
41
  attr_reader :datatype
@@ -65,11 +67,12 @@ module Algolia
65
67
  :event_subtype => :eventSubtype,
66
68
  :index => :index,
67
69
  :object_ids => :objectIDs,
68
- :object_data => :objectData,
69
- :currency => :currency,
70
70
  :user_token => :userToken,
71
+ :authenticated_user_token => :authenticatedUserToken,
72
+ :currency => :currency,
73
+ :object_data => :objectData,
71
74
  :timestamp => :timestamp,
72
- :authenticated_user_token => :authenticatedUserToken
75
+ :value => :value
73
76
  }
74
77
  end
75
78
 
@@ -86,11 +89,12 @@ module Algolia
86
89
  :event_subtype => :PurchaseEvent,
87
90
  :index => :String,
88
91
  :object_ids => :'Array<String>',
89
- :object_data => :'Array<ObjectData>',
90
- :currency => :String,
91
92
  :user_token => :String,
93
+ :authenticated_user_token => :String,
94
+ :currency => :String,
95
+ :object_data => :'Array<ObjectData>',
92
96
  :timestamp => :Integer,
93
- :authenticated_user_token => :String
97
+ :value => :Value
94
98
  }
95
99
  end
96
100
 
@@ -148,28 +152,32 @@ module Algolia
148
152
  self.object_ids = nil
149
153
  end
150
154
 
151
- if attributes.key?(:object_data)
152
- if (value = attributes[:object_data]).is_a?(Array)
153
- self.object_data = value
154
- end
155
+ if attributes.key?(:user_token)
156
+ self.user_token = attributes[:user_token]
157
+ else
158
+ self.user_token = nil
159
+ end
160
+
161
+ if attributes.key?(:authenticated_user_token)
162
+ self.authenticated_user_token = attributes[:authenticated_user_token]
155
163
  end
156
164
 
157
165
  if attributes.key?(:currency)
158
166
  self.currency = attributes[:currency]
159
167
  end
160
168
 
161
- if attributes.key?(:user_token)
162
- self.user_token = attributes[:user_token]
163
- else
164
- self.user_token = nil
169
+ if attributes.key?(:object_data)
170
+ if (value = attributes[:object_data]).is_a?(Array)
171
+ self.object_data = value
172
+ end
165
173
  end
166
174
 
167
175
  if attributes.key?(:timestamp)
168
176
  self.timestamp = attributes[:timestamp]
169
177
  end
170
178
 
171
- if attributes.key?(:authenticated_user_token)
172
- self.authenticated_user_token = attributes[:authenticated_user_token]
179
+ if attributes.key?(:value)
180
+ self.value = attributes[:value]
173
181
  end
174
182
  end
175
183
 
@@ -237,6 +245,47 @@ module Algolia
237
245
  @user_token = user_token
238
246
  end
239
247
 
248
+ # Custom attribute writer method with validation
249
+ # @param [Object] authenticated_user_token Value to be assigned
250
+ def authenticated_user_token=(authenticated_user_token)
251
+ if authenticated_user_token.nil?
252
+ raise ArgumentError, 'authenticated_user_token cannot be nil'
253
+ end
254
+
255
+ if authenticated_user_token.to_s.length > 129
256
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be smaller than or equal to 129.'
257
+ end
258
+
259
+ if authenticated_user_token.to_s.length < 1
260
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be great than or equal to 1.'
261
+ end
262
+
263
+ pattern = %r{[a-zA-Z0-9_=/+-]{1,129}}
264
+ if authenticated_user_token !~ pattern
265
+ raise ArgumentError, "invalid value for \"authenticated_user_token\", must conform to the pattern #{pattern}."
266
+ end
267
+
268
+ @authenticated_user_token = authenticated_user_token
269
+ end
270
+
271
+ # Custom attribute writer method with validation
272
+ # @param [Object] object_data Value to be assigned
273
+ def object_data=(object_data)
274
+ if object_data.nil?
275
+ raise ArgumentError, 'object_data cannot be nil'
276
+ end
277
+
278
+ if object_data.length > 20
279
+ raise ArgumentError, 'invalid value for "object_data", number of items must be less than or equal to 20.'
280
+ end
281
+
282
+ if object_data.length < 1
283
+ raise ArgumentError, 'invalid value for "object_data", number of items must be greater than or equal to 1.'
284
+ end
285
+
286
+ @object_data = object_data
287
+ end
288
+
240
289
  # Checks equality by comparing each attribute.
241
290
  # @param [Object] Object to be compared
242
291
  def ==(other)
@@ -248,11 +297,12 @@ module Algolia
248
297
  event_subtype == other.event_subtype &&
249
298
  index == other.index &&
250
299
  object_ids == other.object_ids &&
251
- object_data == other.object_data &&
252
- currency == other.currency &&
253
300
  user_token == other.user_token &&
301
+ authenticated_user_token == other.authenticated_user_token &&
302
+ currency == other.currency &&
303
+ object_data == other.object_data &&
254
304
  timestamp == other.timestamp &&
255
- authenticated_user_token == other.authenticated_user_token
305
+ value == other.value
256
306
  end
257
307
 
258
308
  # @see the `==` method
@@ -264,7 +314,7 @@ module Algolia
264
314
  # Calculates hash code according to all attributes.
265
315
  # @return [Integer] Hash code
266
316
  def hash
267
- [event_name, event_type, event_subtype, index, object_ids, object_data, currency, user_token, timestamp, authenticated_user_token].hash
317
+ [event_name, event_type, event_subtype, index, object_ids, user_token, authenticated_user_token, currency, object_data, timestamp, value].hash
268
318
  end
269
319
 
270
320
  # Builds the object from hash