@@ -5,27 +5,33 @@ class InsightsClient
5
5
attr_accessor :api_client
6
6
7
7
def initialize ( config = nil )
8
- raise ' `config` is missing.' if config . nil?
9
- raise ' `app_id` is missing.' if config . app_id . nil? || config . app_id == ''
10
- raise ' `api_key` is missing.' if config . api_key . nil? || config . api_key == ''
8
+ raise " `config` is missing." if config . nil?
9
+ raise " `app_id` is missing." if config . app_id . nil? || config . app_id == ""
10
+ raise " `api_key` is missing." if config . api_key . nil? || config . api_key == ""
11
11
12
12
@api_client = Algolia ::ApiClient . new ( config )
13
13
end
14
14
15
15
def self . create ( app_id , api_key , region = nil , opts = { } )
16
16
hosts = [ ]
17
- regions = [ 'de' , 'us' ]
17
+ regions = [ "de" , "us" ]
18
18
19
19
if region . is_a? ( Hash ) && ( opts . nil? || opts . empty? )
20
20
opts = region
21
21
region = nil
22
22
end
23
23
24
- raise "`region` must be one of the following: #{ regions . join ( ', ' ) } " if !region . nil? && ( !region . is_a? ( String ) || !regions . include? ( region ) )
24
+ if !region . nil? && ( !region . is_a? ( String ) || !regions . include? ( region ) )
25
+ raise "`region` must be one of the following: #{ regions . join ( ", " ) } "
26
+ end
25
27
26
- hosts << Transport ::StatefulHost . new ( region . nil? ? 'insights.algolia.io' : 'insights.{region}.algolia.io' . sub! ( '{region}' , region ) , accept : CallType ::READ | CallType ::WRITE )
28
+ hosts <<
29
+ Transport ::StatefulHost . new (
30
+ region . nil? ? "insights.algolia.io" : "insights.{region}.algolia.io" . sub! ( "{region}" , region ) ,
31
+ accept : CallType ::READ | CallType ::WRITE
32
+ )
27
33
28
- config = Algolia ::Configuration . new ( app_id , api_key , hosts , ' Insights' , opts )
34
+ config = Algolia ::Configuration . new ( app_id , api_key , hosts , " Insights" , opts )
29
35
create_with_config ( config )
30
36
end
31
37
@@ -45,7 +51,7 @@ def custom_delete_with_http_info(path, parameters = nil, request_options = {})
45
51
raise ArgumentError , "Parameter `path` is required when calling `custom_delete`."
46
52
end
47
53
48
- path = ' /{path}' . sub ( '{' + ' path' + '}' , path . to_s )
54
+ path = " /{path}" . sub ( "{" + " path" + "}" , path . to_s )
49
55
query_params = { }
50
56
query_params = query_params . merge ( parameters ) unless parameters . nil?
51
57
query_params = query_params . merge ( request_options [ :query_params ] ) unless request_options [ :query_params ] . nil?
@@ -55,7 +61,7 @@ def custom_delete_with_http_info(path, parameters = nil, request_options = {})
55
61
post_body = request_options [ :debug_body ]
56
62
57
63
new_options = request_options . merge (
58
- :operation => :' InsightsClient.custom_delete' ,
64
+ :operation => :" InsightsClient.custom_delete" ,
59
65
:header_params => header_params ,
60
66
:query_params => query_params ,
61
67
:body => post_body ,
@@ -73,7 +79,7 @@ def custom_delete_with_http_info(path, parameters = nil, request_options = {})
73
79
# @return [Object]
74
80
def custom_delete ( path , parameters = nil , request_options = { } )
75
81
response = custom_delete_with_http_info ( path , parameters , request_options )
76
- @api_client . deserialize ( response . body , request_options [ :debug_return_type ] || ' Object' )
82
+ @api_client . deserialize ( response . body , request_options [ :debug_return_type ] || " Object" )
77
83
end
78
84
79
85
# This method allow you to send requests to the Algolia REST API.
@@ -88,7 +94,7 @@ def custom_get_with_http_info(path, parameters = nil, request_options = {})
88
94
raise ArgumentError , "Parameter `path` is required when calling `custom_get`."
89
95
end
90
96
91
- path = ' /{path}' . sub ( '{' + ' path' + '}' , path . to_s )
97
+ path = " /{path}" . sub ( "{" + " path" + "}" , path . to_s )
92
98
query_params = { }
93
99
query_params = query_params . merge ( parameters ) unless parameters . nil?
94
100
query_params = query_params . merge ( request_options [ :query_params ] ) unless request_options [ :query_params ] . nil?
@@ -98,7 +104,7 @@ def custom_get_with_http_info(path, parameters = nil, request_options = {})
98
104
post_body = request_options [ :debug_body ]
99
105
100
106
new_options = request_options . merge (
101
- :operation => :' InsightsClient.custom_get' ,
107
+ :operation => :" InsightsClient.custom_get" ,
102
108
:header_params => header_params ,
103
109
:query_params => query_params ,
104
110
:body => post_body ,
@@ -116,7 +122,7 @@ def custom_get_with_http_info(path, parameters = nil, request_options = {})
116
122
# @return [Object]
117
123
def custom_get ( path , parameters = nil , request_options = { } )
118
124
response = custom_get_with_http_info ( path , parameters , request_options )
119
- @api_client . deserialize ( response . body , request_options [ :debug_return_type ] || ' Object' )
125
+ @api_client . deserialize ( response . body , request_options [ :debug_return_type ] || " Object" )
120
126
end
121
127
122
128
# This method allow you to send requests to the Algolia REST API.
@@ -132,7 +138,7 @@ def custom_post_with_http_info(path, parameters = nil, body = nil, request_optio
132
138
raise ArgumentError , "Parameter `path` is required when calling `custom_post`."
133
139
end
134
140
135
- path = ' /{path}' . sub ( '{' + ' path' + '}' , path . to_s )
141
+ path = " /{path}" . sub ( "{" + " path" + "}" , path . to_s )
136
142
query_params = { }
137
143
query_params = query_params . merge ( parameters ) unless parameters . nil?
138
144
query_params = query_params . merge ( request_options [ :query_params ] ) unless request_options [ :query_params ] . nil?
@@ -142,7 +148,7 @@ def custom_post_with_http_info(path, parameters = nil, body = nil, request_optio
142
148
post_body = request_options [ :debug_body ] || @api_client . object_to_http_body ( body )
143
149
144
150
new_options = request_options . merge (
145
- :operation => :' InsightsClient.custom_post' ,
151
+ :operation => :" InsightsClient.custom_post" ,
146
152
:header_params => header_params ,
147
153
:query_params => query_params ,
148
154
:body => post_body ,
@@ -161,7 +167,7 @@ def custom_post_with_http_info(path, parameters = nil, body = nil, request_optio
161
167
# @return [Object]
162
168
def custom_post ( path , parameters = nil , body = nil , request_options = { } )
163
169
response = custom_post_with_http_info ( path , parameters , body , request_options )
164
- @api_client . deserialize ( response . body , request_options [ :debug_return_type ] || ' Object' )
170
+ @api_client . deserialize ( response . body , request_options [ :debug_return_type ] || " Object" )
165
171
end
166
172
167
173
# This method allow you to send requests to the Algolia REST API.
@@ -177,7 +183,7 @@ def custom_put_with_http_info(path, parameters = nil, body = nil, request_option
177
183
raise ArgumentError , "Parameter `path` is required when calling `custom_put`."
178
184
end
179
185
180
- path = ' /{path}' . sub ( '{' + ' path' + '}' , path . to_s )
186
+ path = " /{path}" . sub ( "{" + " path" + "}" , path . to_s )
181
187
query_params = { }
182
188
query_params = query_params . merge ( parameters ) unless parameters . nil?
183
189
query_params = query_params . merge ( request_options [ :query_params ] ) unless request_options [ :query_params ] . nil?
@@ -187,7 +193,7 @@ def custom_put_with_http_info(path, parameters = nil, body = nil, request_option
187
193
post_body = request_options [ :debug_body ] || @api_client . object_to_http_body ( body )
188
194
189
195
new_options = request_options . merge (
190
- :operation => :' InsightsClient.custom_put' ,
196
+ :operation => :" InsightsClient.custom_put" ,
191
197
:header_params => header_params ,
192
198
:query_params => query_params ,
193
199
:body => post_body ,
@@ -206,7 +212,7 @@ def custom_put_with_http_info(path, parameters = nil, body = nil, request_option
206
212
# @return [Object]
207
213
def custom_put ( path , parameters = nil , body = nil , request_options = { } )
208
214
response = custom_put_with_http_info ( path , parameters , body , request_options )
209
- @api_client . deserialize ( response . body , request_options [ :debug_return_type ] || ' Object' )
215
+ @api_client . deserialize ( response . body , request_options [ :debug_return_type ] || " Object" )
210
216
end
211
217
212
218
# Deletes all events related to the specified user token from events metrics and analytics. To delete a personalization user profile, see [Delete a user profile](/specs/personalization#tag/profiles/operation/deleteUserProfile).
@@ -219,20 +225,30 @@ def delete_user_token_with_http_info(user_token, request_options = {})
219
225
if @api_client . config . client_side_validation && user_token . nil?
220
226
raise ArgumentError , "Parameter `user_token` is required when calling `delete_user_token`."
221
227
end
228
+
222
229
if @api_client . config . client_side_validation && user_token . to_s . length > 129
223
- raise ArgumentError , 'invalid value for "user_token" when calling InsightsClient.delete_user_token, the character length must be smaller than or equal to 129.'
230
+ raise (
231
+ ArgumentError ,
232
+ "invalid value for \" user_token\" when calling InsightsClient.delete_user_token, the character length must be smaller than or equal to 129."
233
+ )
224
234
end
225
235
226
236
if @api_client . config . client_side_validation && user_token . to_s . length < 1
227
- raise ArgumentError , 'invalid value for "user_token" when calling InsightsClient.delete_user_token, the character length must be great than or equal to 1.'
237
+ raise (
238
+ ArgumentError ,
239
+ "invalid value for \" user_token\" when calling InsightsClient.delete_user_token, the character length must be great than or equal to 1."
240
+ )
228
241
end
229
242
230
- pattern = %r{ [a-zA-Z0-9_=/+-]{1,129}}
243
+ pattern = / [a-zA-Z0-9_=\ / +-]{1,129}/
231
244
if @api_client . config . client_side_validation && user_token !~ pattern
232
- raise ArgumentError , "invalid value for 'user_token' when calling InsightsClient.delete_user_token, must conform to the pattern #{ pattern } ."
245
+ raise (
246
+ ArgumentError ,
247
+ "invalid value for 'user_token' when calling InsightsClient.delete_user_token, must conform to the pattern #{ pattern } ."
248
+ )
233
249
end
234
250
235
- path = ' /1/usertokens/{userToken}' . sub ( '{' + ' userToken' + '}' , Transport . encode_uri ( user_token . to_s ) )
251
+ path = " /1/usertokens/{userToken}" . sub ( "{" + " userToken" + "}" , Transport . encode_uri ( user_token . to_s ) )
236
252
query_params = { }
237
253
query_params = query_params . merge ( request_options [ :query_params ] ) unless request_options [ :query_params ] . nil?
238
254
header_params = { }
@@ -241,7 +257,7 @@ def delete_user_token_with_http_info(user_token, request_options = {})
241
257
post_body = request_options [ :debug_body ]
242
258
243
259
new_options = request_options . merge (
244
- :operation => :' InsightsClient.delete_user_token' ,
260
+ :operation => :" InsightsClient.delete_user_token" ,
245
261
:header_params => header_params ,
246
262
:query_params => query_params ,
247
263
:body => post_body ,
@@ -272,7 +288,7 @@ def push_events_with_http_info(insights_events, request_options = {})
272
288
raise ArgumentError , "Parameter `insights_events` is required when calling `push_events`."
273
289
end
274
290
275
- path = ' /1/events'
291
+ path = " /1/events"
276
292
query_params = { }
277
293
query_params = query_params . merge ( request_options [ :query_params ] ) unless request_options [ :query_params ] . nil?
278
294
header_params = { }
@@ -281,7 +297,7 @@ def push_events_with_http_info(insights_events, request_options = {})
281
297
post_body = request_options [ :debug_body ] || @api_client . object_to_http_body ( insights_events )
282
298
283
299
new_options = request_options . merge (
284
- :operation => :' InsightsClient.push_events' ,
300
+ :operation => :" InsightsClient.push_events" ,
285
301
:header_params => header_params ,
286
302
:query_params => query_params ,
287
303
:body => post_body ,
@@ -298,7 +314,8 @@ def push_events_with_http_info(insights_events, request_options = {})
298
314
# @return [EventsResponse]
299
315
def push_events ( insights_events , request_options = { } )
300
316
response = push_events_with_http_info ( insights_events , request_options )
301
- @api_client . deserialize ( response . body , request_options [ :debug_return_type ] || ' Insights::EventsResponse' )
317
+ @api_client . deserialize ( response . body , request_options [ :debug_return_type ] || " Insights::EventsResponse" )
302
318
end
319
+
303
320
end
304
321
end
0 commit comments