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
@@ -7,36 +7,38 @@ module Algolia
7
7
  module Insights
8
8
  # Use this event to track when users add items to their shopping cart after a previous Algolia request. If you're building your category pages with Algolia, you'll also use this event.
9
9
  class AddedToCartObjectIDsAfterSearch
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
20
  # 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.
21
21
  attr_accessor :query_id
22
22
 
23
- # List of object identifiers for items of an Algolia index.
23
+ # The object IDs of the records that are part of the event.
24
24
  attr_accessor :object_ids
25
25
 
26
- # 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`.
27
- attr_accessor :object_data
26
+ # An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
27
+ attr_accessor :user_token
28
+
29
+ # An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens.
30
+ attr_accessor :authenticated_user_token
28
31
 
29
- # 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.
32
+ # Three-letter [currency code](https://www.iso.org/iso-4217-currency-codes.html).
30
33
  attr_accessor :currency
31
34
 
32
- # Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
33
- attr_accessor :user_token
35
+ # Extra information about the records involved in a purchase or add-to-cart events. If provided, it must be the same length as `objectIDs`.
36
+ attr_accessor :object_data
34
37
 
35
- # 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.
38
+ # 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.
36
39
  attr_accessor :timestamp
37
40
 
38
- # User token for authenticated users.
39
- attr_accessor :authenticated_user_token
41
+ attr_accessor :value
40
42
 
41
43
  class EnumAttributeValidator
42
44
  attr_reader :datatype
@@ -69,11 +71,12 @@ module Algolia
69
71
  :index => :index,
70
72
  :query_id => :queryID,
71
73
  :object_ids => :objectIDs,
72
- :object_data => :objectData,
73
- :currency => :currency,
74
74
  :user_token => :userToken,
75
+ :authenticated_user_token => :authenticatedUserToken,
76
+ :currency => :currency,
77
+ :object_data => :objectData,
75
78
  :timestamp => :timestamp,
76
- :authenticated_user_token => :authenticatedUserToken
79
+ :value => :value
77
80
  }
78
81
  end
79
82
 
@@ -91,11 +94,12 @@ module Algolia
91
94
  :index => :String,
92
95
  :query_id => :String,
93
96
  :object_ids => :'Array<String>',
94
- :object_data => :'Array<ObjectDataAfterSearch>',
95
- :currency => :String,
96
97
  :user_token => :String,
98
+ :authenticated_user_token => :String,
99
+ :currency => :String,
100
+ :object_data => :'Array<ObjectDataAfterSearch>',
97
101
  :timestamp => :Integer,
98
- :authenticated_user_token => :String
102
+ :value => :Value
99
103
  }
100
104
  end
101
105
 
@@ -159,28 +163,32 @@ module Algolia
159
163
  self.object_ids = nil
160
164
  end
161
165
 
162
- if attributes.key?(:object_data)
163
- if (value = attributes[:object_data]).is_a?(Array)
164
- self.object_data = value
165
- end
166
+ if attributes.key?(:user_token)
167
+ self.user_token = attributes[:user_token]
168
+ else
169
+ self.user_token = nil
170
+ end
171
+
172
+ if attributes.key?(:authenticated_user_token)
173
+ self.authenticated_user_token = attributes[:authenticated_user_token]
166
174
  end
167
175
 
168
176
  if attributes.key?(:currency)
169
177
  self.currency = attributes[:currency]
170
178
  end
171
179
 
172
- if attributes.key?(:user_token)
173
- self.user_token = attributes[:user_token]
174
- else
175
- self.user_token = nil
180
+ if attributes.key?(:object_data)
181
+ if (value = attributes[:object_data]).is_a?(Array)
182
+ self.object_data = value
183
+ end
176
184
  end
177
185
 
178
186
  if attributes.key?(:timestamp)
179
187
  self.timestamp = attributes[:timestamp]
180
188
  end
181
189
 
182
- if attributes.key?(:authenticated_user_token)
183
- self.authenticated_user_token = attributes[:authenticated_user_token]
190
+ if attributes.key?(:value)
191
+ self.value = attributes[:value]
184
192
  end
185
193
  end
186
194
 
@@ -271,6 +279,47 @@ module Algolia
271
279
  @user_token = user_token
272
280
  end
273
281
 
282
+ # Custom attribute writer method with validation
283
+ # @param [Object] authenticated_user_token Value to be assigned
284
+ def authenticated_user_token=(authenticated_user_token)
285
+ if authenticated_user_token.nil?
286
+ raise ArgumentError, 'authenticated_user_token cannot be nil'
287
+ end
288
+
289
+ if authenticated_user_token.to_s.length > 129
290
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be smaller than or equal to 129.'
291
+ end
292
+
293
+ if authenticated_user_token.to_s.length < 1
294
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be great than or equal to 1.'
295
+ end
296
+
297
+ pattern = %r{[a-zA-Z0-9_=/+-]{1,129}}
298
+ if authenticated_user_token !~ pattern
299
+ raise ArgumentError, "invalid value for \"authenticated_user_token\", must conform to the pattern #{pattern}."
300
+ end
301
+
302
+ @authenticated_user_token = authenticated_user_token
303
+ end
304
+
305
+ # Custom attribute writer method with validation
306
+ # @param [Object] object_data Value to be assigned
307
+ def object_data=(object_data)
308
+ if object_data.nil?
309
+ raise ArgumentError, 'object_data cannot be nil'
310
+ end
311
+
312
+ if object_data.length > 20
313
+ raise ArgumentError, 'invalid value for "object_data", number of items must be less than or equal to 20.'
314
+ end
315
+
316
+ if object_data.length < 1
317
+ raise ArgumentError, 'invalid value for "object_data", number of items must be greater than or equal to 1.'
318
+ end
319
+
320
+ @object_data = object_data
321
+ end
322
+
274
323
  # Checks equality by comparing each attribute.
275
324
  # @param [Object] Object to be compared
276
325
  def ==(other)
@@ -283,11 +332,12 @@ module Algolia
283
332
  index == other.index &&
284
333
  query_id == other.query_id &&
285
334
  object_ids == other.object_ids &&
286
- object_data == other.object_data &&
287
- currency == other.currency &&
288
335
  user_token == other.user_token &&
336
+ authenticated_user_token == other.authenticated_user_token &&
337
+ currency == other.currency &&
338
+ object_data == other.object_data &&
289
339
  timestamp == other.timestamp &&
290
- authenticated_user_token == other.authenticated_user_token
340
+ value == other.value
291
341
  end
292
342
 
293
343
  # @see the `==` method
@@ -299,7 +349,7 @@ module Algolia
299
349
  # Calculates hash code according to all attributes.
300
350
  # @return [Integer] Hash code
301
351
  def hash
302
- [event_name, event_type, event_subtype, index, query_id, object_ids, object_data, currency, user_token, timestamp, authenticated_user_token].hash
352
+ [event_name, event_type, event_subtype, index, query_id, object_ids, user_token, authenticated_user_token, currency, object_data, timestamp, value].hash
303
353
  end
304
354
 
305
355
  # Builds the object from hash
@@ -7,26 +7,26 @@ module Algolia
7
7
  module Insights
8
8
  # Use this event to track when users click facet filters in your user interface.
9
9
  class ClickedFilters
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
18
  # Facet filters. Each facet filter string must be URL-encoded, such as, `discount:10%25`.
19
19
  attr_accessor :filters
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
  :filters => :filters,
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
  :filters => :'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
  filters == other.filters &&
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, filters, user_token, timestamp, authenticated_user_token].hash
257
+ [event_name, event_type, index, filters, user_token, authenticated_user_token, timestamp].hash
235
258
  end
236
259
 
237
260
  # Builds the object from hash
@@ -7,21 +7,24 @@ module Algolia
7
7
  module Insights
8
8
  # Use this event to track when users click 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 click events related to Algolia requests, use the \"Clicked object IDs after search\" event.
9
9
  class ClickedObjectIDs
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.
24
+ # An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens.
25
+ attr_accessor :authenticated_user_token
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.
25
28
  attr_accessor :timestamp
26
29
 
27
30
  class EnumAttributeValidator
@@ -54,6 +57,7 @@ module Algolia
54
57
  :index => :index,
55
58
  :object_ids => :objectIDs,
56
59
  :user_token => :userToken,
60
+ :authenticated_user_token => :authenticatedUserToken,
57
61
  :timestamp => :timestamp
58
62
  }
59
63
  end
@@ -71,6 +75,7 @@ module Algolia
71
75
  :index => :String,
72
76
  :object_ids => :'Array<String>',
73
77
  :user_token => :String,
78
+ :authenticated_user_token => :String,
74
79
  :timestamp => :Integer
75
80
  }
76
81
  end
@@ -129,6 +134,10 @@ module Algolia
129
134
  self.user_token = nil
130
135
  end
131
136
 
137
+ if attributes.key?(:authenticated_user_token)
138
+ self.authenticated_user_token = attributes[:authenticated_user_token]
139
+ end
140
+
132
141
  if attributes.key?(:timestamp)
133
142
  self.timestamp = attributes[:timestamp]
134
143
  end
@@ -198,6 +207,29 @@ module Algolia
198
207
  @user_token = user_token
199
208
  end
200
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
+
201
233
  # Checks equality by comparing each attribute.
202
234
  # @param [Object] Object to be compared
203
235
  def ==(other)
@@ -209,6 +241,7 @@ module Algolia
209
241
  index == other.index &&
210
242
  object_ids == other.object_ids &&
211
243
  user_token == other.user_token &&
244
+ authenticated_user_token == other.authenticated_user_token &&
212
245
  timestamp == other.timestamp
213
246
  end
214
247
 
@@ -221,7 +254,7 @@ module Algolia
221
254
  # Calculates hash code according to all attributes.
222
255
  # @return [Integer] Hash code
223
256
  def hash
224
- [event_name, event_type, index, object_ids, user_token, timestamp].hash
257
+ [event_name, event_type, index, object_ids, user_token, authenticated_user_token, timestamp].hash
225
258
  end
226
259
 
227
260
  # Builds the object from hash
@@ -7,32 +7,32 @@ module Algolia
7
7
  module Insights
8
8
  # Click event after an Algolia request. Use this event to track when users click items in the search results. If you're building your category pages with Algolia, you'll also use this event.
9
9
  class ClickedObjectIDsAfterSearch
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
- # Position of the clicked objects in the search results. The first search result has a position of 1 (not 0). You must provide 1 `position` for each `objectID`.
21
+ # The position of the clicked item the search results. The first search result has a position of 1 (not 0). You must provide 1 `position` for each `objectID`.
22
22
  attr_accessor :positions
23
23
 
24
24
  # 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.
25
25
  attr_accessor :query_id
26
26
 
27
- # Anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
27
+ # An anonymous or pseudonymous user identifier. > **Note**: Never include personally identifiable information in user tokens.
28
28
  attr_accessor :user_token
29
29
 
30
- # 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.
31
- attr_accessor :timestamp
32
-
33
- # User token for authenticated users.
30
+ # An identifier for authenticated users. > **Note**: Never include personally identifiable information in user tokens.
34
31
  attr_accessor :authenticated_user_token
35
32
 
33
+ # 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.
34
+ attr_accessor :timestamp
35
+
36
36
  class EnumAttributeValidator
37
37
  attr_reader :datatype
38
38
  attr_reader :allowable_values
@@ -65,8 +65,8 @@ module Algolia
65
65
  :positions => :positions,
66
66
  :query_id => :queryID,
67
67
  :user_token => :userToken,
68
- :timestamp => :timestamp,
69
- :authenticated_user_token => :authenticatedUserToken
68
+ :authenticated_user_token => :authenticatedUserToken,
69
+ :timestamp => :timestamp
70
70
  }
71
71
  end
72
72
 
@@ -85,8 +85,8 @@ module Algolia
85
85
  :positions => :'Array<Integer>',
86
86
  :query_id => :String,
87
87
  :user_token => :String,
88
- :timestamp => :Integer,
89
- :authenticated_user_token => :String
88
+ :authenticated_user_token => :String,
89
+ :timestamp => :Integer
90
90
  }
91
91
  end
92
92
 
@@ -158,13 +158,13 @@ module Algolia
158
158
  self.user_token = nil
159
159
  end
160
160
 
161
- if attributes.key?(:timestamp)
162
- self.timestamp = attributes[:timestamp]
163
- end
164
-
165
161
  if attributes.key?(:authenticated_user_token)
166
162
  self.authenticated_user_token = attributes[:authenticated_user_token]
167
163
  end
164
+
165
+ if attributes.key?(:timestamp)
166
+ self.timestamp = attributes[:timestamp]
167
+ end
168
168
  end
169
169
 
170
170
  # Custom attribute writer method with validation
@@ -272,6 +272,29 @@ module Algolia
272
272
  @user_token = user_token
273
273
  end
274
274
 
275
+ # Custom attribute writer method with validation
276
+ # @param [Object] authenticated_user_token Value to be assigned
277
+ def authenticated_user_token=(authenticated_user_token)
278
+ if authenticated_user_token.nil?
279
+ raise ArgumentError, 'authenticated_user_token cannot be nil'
280
+ end
281
+
282
+ if authenticated_user_token.to_s.length > 129
283
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be smaller than or equal to 129.'
284
+ end
285
+
286
+ if authenticated_user_token.to_s.length < 1
287
+ raise ArgumentError, 'invalid value for "authenticated_user_token", the character length must be great than or equal to 1.'
288
+ end
289
+
290
+ pattern = %r{[a-zA-Z0-9_=/+-]{1,129}}
291
+ if authenticated_user_token !~ pattern
292
+ raise ArgumentError, "invalid value for \"authenticated_user_token\", must conform to the pattern #{pattern}."
293
+ end
294
+
295
+ @authenticated_user_token = authenticated_user_token
296
+ end
297
+
275
298
  # Checks equality by comparing each attribute.
276
299
  # @param [Object] Object to be compared
277
300
  def ==(other)
@@ -285,8 +308,8 @@ module Algolia
285
308
  positions == other.positions &&
286
309
  query_id == other.query_id &&
287
310
  user_token == other.user_token &&
288
- timestamp == other.timestamp &&
289
- authenticated_user_token == other.authenticated_user_token
311
+ authenticated_user_token == other.authenticated_user_token &&
312
+ timestamp == other.timestamp
290
313
  end
291
314
 
292
315
  # @see the `==` method
@@ -298,7 +321,7 @@ module Algolia
298
321
  # Calculates hash code according to all attributes.
299
322
  # @return [Integer] Hash code
300
323
  def hash
301
- [event_name, event_type, index, object_ids, positions, query_id, user_token, timestamp, authenticated_user_token].hash
324
+ [event_name, event_type, index, object_ids, positions, query_id, user_token, authenticated_user_token, timestamp].hash
302
325
  end
303
326
 
304
327
  # Builds the object from hash