suggestgrid 0.1.15.pre.SNAPSHOT → 0.1.17.pre.SNAPSHOT
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/suggest_grid/api_helper.rb +2 -2
- data/lib/suggest_grid/configuration.rb +1 -1
- data/lib/suggest_grid/controllers/action_controller.rb +24 -18
- data/lib/suggest_grid/controllers/metadata_controller.rb +36 -32
- data/lib/suggest_grid/controllers/recommendation_controller.rb +12 -12
- data/lib/suggest_grid/controllers/similarity_controller.rb +12 -12
- data/lib/suggest_grid/controllers/type_controller.rb +12 -12
- data/lib/suggest_grid/exceptions/bulk_schema_error_response_exception.rb +37 -0
- data/lib/suggest_grid/exceptions/detailed_error_response_exception.rb +42 -0
- data/lib/suggest_grid/exceptions/error_response_exception.rb +37 -0
- data/lib/suggest_grid/exceptions/limit_exceeded_error_response_exception.rb +47 -0
- data/lib/suggest_grid/models/action.rb +15 -19
- data/lib/suggest_grid/models/base_model.rb +32 -0
- data/lib/suggest_grid/models/count_response.rb +12 -16
- data/lib/suggest_grid/models/delete_error_response.rb +80 -0
- data/lib/suggest_grid/models/delete_success_response.rb +62 -0
- data/lib/suggest_grid/models/get_recommended_items_body.rb +39 -32
- data/lib/suggest_grid/models/get_recommended_users_body.rb +39 -32
- data/lib/suggest_grid/models/get_similar_items_body.rb +27 -30
- data/lib/suggest_grid/models/get_similar_users_body.rb +27 -30
- data/lib/suggest_grid/models/get_type_response.rb +12 -16
- data/lib/suggest_grid/models/get_types_response.rb +12 -16
- data/lib/suggest_grid/models/items_response.rb +12 -16
- data/lib/suggest_grid/models/message_response.rb +11 -15
- data/lib/suggest_grid/models/metadata.rb +34 -39
- data/lib/suggest_grid/models/metadata_information_response.rb +11 -15
- data/lib/suggest_grid/models/schema_error_response.rb +13 -17
- data/lib/suggest_grid/models/type_request_body.rb +12 -15
- data/lib/suggest_grid/models/users_response.rb +12 -16
- data/lib/suggest_grid.rb +7 -2
- data/spec/swagger.yaml +235 -121
- metadata +10 -5
- data/lib/suggest_grid/models/bulk_schema_error_response.rb +0 -53
- data/lib/suggest_grid/models/error_response.rb +0 -48
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ada01f923b1b9dd491c6a8a6666b7ffe8f709b8c
|
4
|
+
data.tar.gz: 72fe56da2934b0387707159761dce05a084ca608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19d22bb73bc52bb9d7a9d9bda5a55088a30d16264da5c993e55040e1359fbfce1ff860d940247385689fe82098312dfaecf70234bcd4ee0607e52106efc0bdc1
|
7
|
+
data.tar.gz: 9970d65ae9a06d043835180da9da72e4c6ec578a381cb549cc22d9f2232e732f12e1f689936acb15a76fe2f50de3acb093aff564e4896a741f32eef696fec8fa
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ Let's implement this feature in five minutes with SuggestGrid!
|
|
20
20
|
|
21
21
|
### 1. Configuration
|
22
22
|
|
23
|
-
We are beginning the development by adding the client as a dependency
|
23
|
+
We are beginning the development by adding the client as a dependency.
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
gem 'suggest_grid', git: 'https://github.com/suggestgrid/suggestgrid-ruby.git'
|
@@ -113,8 +113,8 @@ module SuggestGrid
|
|
113
113
|
retval = Hash.new
|
114
114
|
|
115
115
|
# If this is a structure, resolve it's field names.
|
116
|
-
if obj.
|
117
|
-
obj = obj.
|
116
|
+
if obj.kind_of? BaseModel
|
117
|
+
obj = obj.to_hash
|
118
118
|
end
|
119
119
|
|
120
120
|
# Create a form encoded hash for this object.
|
@@ -58,9 +58,9 @@ module SuggestGrid
|
|
58
58
|
|
59
59
|
# Endpoint error handling using HTTP status codes.
|
60
60
|
if _response.status_code == 400
|
61
|
-
raise
|
61
|
+
raise ErrorResponseException.new '400 - Required `user_id` or `item_id` parameters are missing from the request body.', _context
|
62
62
|
elsif _response.status_code == 429
|
63
|
-
raise
|
63
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
64
64
|
elsif _response.status_code == 500
|
65
65
|
raise APIException.new '500 - Unexpected internal error.', _context
|
66
66
|
end
|
@@ -74,9 +74,9 @@ module SuggestGrid
|
|
74
74
|
end
|
75
75
|
|
76
76
|
# Post an Action
|
77
|
-
# @param [Action]
|
77
|
+
# @param [Action] action Required parameter: The action to be posted.
|
78
78
|
# @return MessageResponse response from the API call
|
79
|
-
def post_action(
|
79
|
+
def post_action(action)
|
80
80
|
# the base uri for api requests
|
81
81
|
_query_builder = Configuration.base_uri.dup
|
82
82
|
|
@@ -94,7 +94,7 @@ module SuggestGrid
|
|
94
94
|
}
|
95
95
|
|
96
96
|
# Create the HttpRequest object for the call
|
97
|
-
_request = @http_client.post _query_url, headers: _headers, parameters:
|
97
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: action.to_json, username: Configuration.basic_auth_user_name, password: Configuration.basic_auth_password
|
98
98
|
|
99
99
|
# Call the on_before_request callback
|
100
100
|
@http_call_back.on_before_request(_request) if @http_call_back
|
@@ -110,13 +110,13 @@ module SuggestGrid
|
|
110
110
|
|
111
111
|
# Endpoint error handling using HTTP status codes.
|
112
112
|
if _response.status_code == 400
|
113
|
-
raise
|
113
|
+
raise ErrorResponseException.new '400 - Required `user_id` or `item_id` parameters are missing from the request body.', _context
|
114
114
|
elsif _response.status_code == 402
|
115
|
-
raise
|
115
|
+
raise ErrorResponseException.new '402 - Action limit exceeded.', _context
|
116
116
|
elsif _response.status_code == 404
|
117
|
-
raise
|
117
|
+
raise ErrorResponseException.new '404 - Type does not exists.', _context
|
118
118
|
elsif _response.status_code == 429
|
119
|
-
raise
|
119
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
120
120
|
elsif _response.status_code == 500
|
121
121
|
raise APIException.new '500 - Unexpected internal error.', _context
|
122
122
|
end
|
@@ -179,13 +179,15 @@ module SuggestGrid
|
|
179
179
|
|
180
180
|
# Endpoint error handling using HTTP status codes.
|
181
181
|
if _response.status_code == 400
|
182
|
-
raise
|
182
|
+
raise ErrorResponseException.new '400 - Required `user_id` or `item_id` parameters are missing from the request body.', _context
|
183
183
|
elsif _response.status_code == 404
|
184
|
-
raise
|
184
|
+
raise ErrorResponseException.new '404 - Type does not exists.', _context
|
185
185
|
elsif _response.status_code == 422
|
186
|
-
raise
|
186
|
+
raise ErrorResponseException.new '422 - No query parameter (`user_id`, `item_id`, or `older_than`) is given. In order to delete all actionsdelete the type.', _context
|
187
187
|
elsif _response.status_code == 429
|
188
|
-
raise
|
188
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
189
|
+
elsif _response.status_code == 505
|
190
|
+
raise ErrorResponseException.new '505 - Request timed out.', _context
|
189
191
|
elsif _response.status_code == 500
|
190
192
|
raise APIException.new '500 - Unexpected internal error.', _context
|
191
193
|
end
|
@@ -199,7 +201,7 @@ module SuggestGrid
|
|
199
201
|
end
|
200
202
|
|
201
203
|
# Post Bulk Actions
|
202
|
-
# @param [Collection] actions Required parameter: List of actions to be posted.
|
204
|
+
# @param [Collection] actions Required parameter: List of actions to be posted.
|
203
205
|
# @return MessageResponse response from the API call
|
204
206
|
def post_bulk_actions(actions)
|
205
207
|
body = ''
|
@@ -223,7 +225,7 @@ module SuggestGrid
|
|
223
225
|
}
|
224
226
|
|
225
227
|
# Create the HttpRequest object for the call
|
226
|
-
_request = @http_client.post _query_url, headers: _headers, parameters:
|
228
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: actions, username: Configuration.basic_auth_user_name, password: Configuration.basic_auth_password
|
227
229
|
|
228
230
|
# Call the on_before_request callback
|
229
231
|
@http_call_back.on_before_request(_request) if @http_call_back
|
@@ -238,10 +240,14 @@ module SuggestGrid
|
|
238
240
|
@http_call_back.on_after_response(_context) if @http_call_back
|
239
241
|
|
240
242
|
# Endpoint error handling using HTTP status codes.
|
241
|
-
if _response.status_code ==
|
242
|
-
raise
|
243
|
+
if _response.status_code == 209
|
244
|
+
raise BulkSchemaErrorResponseException.new '209 - Some metadata is not uploaded successfully.', _context
|
245
|
+
elsif _response.status_code == 400
|
246
|
+
raise ErrorResponseException.new '400 - Body is missing.', _context
|
247
|
+
elsif _response.status_code == 402
|
248
|
+
raise ErrorResponseException.new '402 - Action limit exceeded.', _context
|
243
249
|
elsif _response.status_code == 429
|
244
|
-
raise
|
250
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
245
251
|
elsif _response.status_code == 500
|
246
252
|
raise APIException.new '500 - Unexpected internal error.', _context
|
247
253
|
end
|
@@ -9,7 +9,7 @@ module SuggestGrid
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# Delete a User
|
12
|
-
# @param [String] user_id Required parameter: The
|
12
|
+
# @param [String] user_id Required parameter: The user id to delete its metadata.
|
13
13
|
# @return MessageResponse response from the API call
|
14
14
|
def delete_user(user_id)
|
15
15
|
# the base uri for api requests
|
@@ -49,7 +49,7 @@ module SuggestGrid
|
|
49
49
|
|
50
50
|
# Endpoint error handling using HTTP status codes.
|
51
51
|
if _response.status_code == 429
|
52
|
-
raise
|
52
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
53
53
|
elsif _response.status_code == 500
|
54
54
|
raise APIException.new '500 - Unexpected internal error.', _context
|
55
55
|
end
|
@@ -97,7 +97,7 @@ module SuggestGrid
|
|
97
97
|
|
98
98
|
# Endpoint error handling using HTTP status codes.
|
99
99
|
if _response.status_code == 429
|
100
|
-
raise
|
100
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
101
101
|
elsif _response.status_code == 500
|
102
102
|
raise APIException.new '500 - Unexpected internal error.', _context
|
103
103
|
end
|
@@ -111,9 +111,9 @@ module SuggestGrid
|
|
111
111
|
end
|
112
112
|
|
113
113
|
# Post a User
|
114
|
-
# @param [Metadata]
|
114
|
+
# @param [Metadata] user Required parameter: The metadata to be saved. Metadata format has its restrictions.
|
115
115
|
# @return MessageResponse response from the API call
|
116
|
-
def post_user(
|
116
|
+
def post_user(user)
|
117
117
|
# the base uri for api requests
|
118
118
|
_query_builder = Configuration.base_uri.dup
|
119
119
|
|
@@ -131,7 +131,7 @@ module SuggestGrid
|
|
131
131
|
}
|
132
132
|
|
133
133
|
# Create the HttpRequest object for the call
|
134
|
-
_request = @http_client.post _query_url, headers: _headers, parameters:
|
134
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: user.to_json, username: Configuration.basic_auth_user_name, password: Configuration.basic_auth_password
|
135
135
|
|
136
136
|
# Call the on_before_request callback
|
137
137
|
@http_call_back.on_before_request(_request) if @http_call_back
|
@@ -147,9 +147,9 @@ module SuggestGrid
|
|
147
147
|
|
148
148
|
# Endpoint error handling using HTTP status codes.
|
149
149
|
if _response.status_code == 400
|
150
|
-
raise
|
150
|
+
raise DetailedErrorResponseException.new '400 - Metadata is invalid.', _context
|
151
151
|
elsif _response.status_code == 429
|
152
|
-
raise
|
152
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
153
153
|
elsif _response.status_code == 500
|
154
154
|
raise APIException.new '500 - Unexpected internal error.', _context
|
155
155
|
end
|
@@ -197,7 +197,7 @@ module SuggestGrid
|
|
197
197
|
|
198
198
|
# Endpoint error handling using HTTP status codes.
|
199
199
|
if _response.status_code == 429
|
200
|
-
raise
|
200
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
201
201
|
elsif _response.status_code == 500
|
202
202
|
raise APIException.new '500 - Unexpected internal error.', _context
|
203
203
|
end
|
@@ -211,7 +211,7 @@ module SuggestGrid
|
|
211
211
|
end
|
212
212
|
|
213
213
|
# Delete an Item
|
214
|
-
# @param [String] item_id Required parameter: The
|
214
|
+
# @param [String] item_id Required parameter: The item id to delete its metadata.
|
215
215
|
# @return MessageResponse response from the API call
|
216
216
|
def delete_item(item_id)
|
217
217
|
# the base uri for api requests
|
@@ -251,7 +251,7 @@ module SuggestGrid
|
|
251
251
|
|
252
252
|
# Endpoint error handling using HTTP status codes.
|
253
253
|
if _response.status_code == 429
|
254
|
-
raise
|
254
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
255
255
|
elsif _response.status_code == 500
|
256
256
|
raise APIException.new '500 - Unexpected internal error.', _context
|
257
257
|
end
|
@@ -299,7 +299,7 @@ module SuggestGrid
|
|
299
299
|
|
300
300
|
# Endpoint error handling using HTTP status codes.
|
301
301
|
if _response.status_code == 429
|
302
|
-
raise
|
302
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
303
303
|
elsif _response.status_code == 500
|
304
304
|
raise APIException.new '500 - Unexpected internal error.', _context
|
305
305
|
end
|
@@ -313,9 +313,9 @@ module SuggestGrid
|
|
313
313
|
end
|
314
314
|
|
315
315
|
# Post an Item
|
316
|
-
# @param [Metadata]
|
316
|
+
# @param [Metadata] item Required parameter: The metadata to be saved. Metadata format has its restrictions.
|
317
317
|
# @return MessageResponse response from the API call
|
318
|
-
def post_item(
|
318
|
+
def post_item(item)
|
319
319
|
# the base uri for api requests
|
320
320
|
_query_builder = Configuration.base_uri.dup
|
321
321
|
|
@@ -333,7 +333,7 @@ module SuggestGrid
|
|
333
333
|
}
|
334
334
|
|
335
335
|
# Create the HttpRequest object for the call
|
336
|
-
_request = @http_client.post _query_url, headers: _headers, parameters:
|
336
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: item.to_json, username: Configuration.basic_auth_user_name, password: Configuration.basic_auth_password
|
337
337
|
|
338
338
|
# Call the on_before_request callback
|
339
339
|
@http_call_back.on_before_request(_request) if @http_call_back
|
@@ -349,9 +349,9 @@ module SuggestGrid
|
|
349
349
|
|
350
350
|
# Endpoint error handling using HTTP status codes.
|
351
351
|
if _response.status_code == 400
|
352
|
-
raise
|
352
|
+
raise DetailedErrorResponseException.new '400 - Metadata is invalid.', _context
|
353
353
|
elsif _response.status_code == 429
|
354
|
-
raise
|
354
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
355
355
|
elsif _response.status_code == 500
|
356
356
|
raise APIException.new '500 - Unexpected internal error.', _context
|
357
357
|
end
|
@@ -399,7 +399,7 @@ module SuggestGrid
|
|
399
399
|
|
400
400
|
# Endpoint error handling using HTTP status codes.
|
401
401
|
if _response.status_code == 429
|
402
|
-
raise
|
402
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
403
403
|
elsif _response.status_code == 500
|
404
404
|
raise APIException.new '500 - Unexpected internal error.', _context
|
405
405
|
end
|
@@ -413,12 +413,12 @@ module SuggestGrid
|
|
413
413
|
end
|
414
414
|
|
415
415
|
# Post Bulk Users
|
416
|
-
# @param [Collection]
|
416
|
+
# @param [Collection] users Required parameter: List of user metadata, whose size is limited to 10 thousand.
|
417
417
|
# @return MessageResponse response from the API call
|
418
|
-
def post_bulk_users(
|
418
|
+
def post_bulk_users(users)
|
419
419
|
body = ''
|
420
|
-
|
421
|
-
body += "#{
|
420
|
+
users.each do |user|
|
421
|
+
body += "#{user.to_json}\n"
|
422
422
|
end
|
423
423
|
# the base uri for api requests
|
424
424
|
_query_builder = Configuration.base_uri.dup
|
@@ -437,7 +437,7 @@ module SuggestGrid
|
|
437
437
|
}
|
438
438
|
|
439
439
|
# Create the HttpRequest object for the call
|
440
|
-
_request = @http_client.post _query_url, headers: _headers, parameters:
|
440
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: users, username: Configuration.basic_auth_user_name, password: Configuration.basic_auth_password
|
441
441
|
|
442
442
|
# Call the on_before_request callback
|
443
443
|
@http_call_back.on_before_request(_request) if @http_call_back
|
@@ -453,9 +453,11 @@ module SuggestGrid
|
|
453
453
|
|
454
454
|
# Endpoint error handling using HTTP status codes.
|
455
455
|
if _response.status_code == 209
|
456
|
-
raise
|
456
|
+
raise BulkSchemaErrorResponseException.new '209 - Some metadata is not uploaded successfully.', _context
|
457
|
+
elsif _response.status_code == 400
|
458
|
+
raise ErrorResponseException.new '400 - Body is missing.', _context
|
457
459
|
elsif _response.status_code == 429
|
458
|
-
raise
|
460
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
459
461
|
elsif _response.status_code == 500
|
460
462
|
raise APIException.new '500 - Unexpected internal error.', _context
|
461
463
|
end
|
@@ -469,12 +471,12 @@ module SuggestGrid
|
|
469
471
|
end
|
470
472
|
|
471
473
|
# Post Bulk Items
|
472
|
-
# @param [Collection]
|
474
|
+
# @param [Collection] items Required parameter: List of item metadata, whose size is limited to 10 thousand.
|
473
475
|
# @return MessageResponse response from the API call
|
474
|
-
def post_bulk_items(
|
476
|
+
def post_bulk_items(items)
|
475
477
|
body = ''
|
476
|
-
|
477
|
-
body += "#{
|
478
|
+
items.each do |item|
|
479
|
+
body += "#{item.to_json}\n"
|
478
480
|
end
|
479
481
|
# the base uri for api requests
|
480
482
|
_query_builder = Configuration.base_uri.dup
|
@@ -493,7 +495,7 @@ module SuggestGrid
|
|
493
495
|
}
|
494
496
|
|
495
497
|
# Create the HttpRequest object for the call
|
496
|
-
_request = @http_client.post _query_url, headers: _headers, parameters:
|
498
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: items, username: Configuration.basic_auth_user_name, password: Configuration.basic_auth_password
|
497
499
|
|
498
500
|
# Call the on_before_request callback
|
499
501
|
@http_call_back.on_before_request(_request) if @http_call_back
|
@@ -509,9 +511,11 @@ module SuggestGrid
|
|
509
511
|
|
510
512
|
# Endpoint error handling using HTTP status codes.
|
511
513
|
if _response.status_code == 209
|
512
|
-
raise
|
514
|
+
raise BulkSchemaErrorResponseException.new '209 - Some metadata is not uploaded successfully.', _context
|
515
|
+
elsif _response.status_code == 400
|
516
|
+
raise ErrorResponseException.new '400 - Body is missing.', _context
|
513
517
|
elsif _response.status_code == 429
|
514
|
-
raise
|
518
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
515
519
|
elsif _response.status_code == 500
|
516
520
|
raise APIException.new '500 - Unexpected internal error.', _context
|
517
521
|
end
|
@@ -9,9 +9,9 @@ module SuggestGrid
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# Get Recommended Users
|
12
|
-
# @param [GetRecommendedUsersBody]
|
12
|
+
# @param [GetRecommendedUsersBody] query Required parameter: The query for recommended users.
|
13
13
|
# @return UsersResponse response from the API call
|
14
|
-
def get_recommended_users(
|
14
|
+
def get_recommended_users(query)
|
15
15
|
# the base uri for api requests
|
16
16
|
_query_builder = Configuration.base_uri.dup
|
17
17
|
|
@@ -29,7 +29,7 @@ module SuggestGrid
|
|
29
29
|
}
|
30
30
|
|
31
31
|
# Create the HttpRequest object for the call
|
32
|
-
_request = @http_client.post _query_url, headers: _headers, parameters:
|
32
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: query.to_json, username: Configuration.basic_auth_user_name, password: Configuration.basic_auth_password
|
33
33
|
|
34
34
|
# Call the on_before_request callback
|
35
35
|
@http_call_back.on_before_request(_request) if @http_call_back
|
@@ -45,11 +45,11 @@ module SuggestGrid
|
|
45
45
|
|
46
46
|
# Endpoint error handling using HTTP status codes.
|
47
47
|
if _response.status_code == 400
|
48
|
-
raise
|
48
|
+
raise ErrorResponseException.new '400 - Request body is invalid.', _context
|
49
49
|
elsif _response.status_code == 422
|
50
|
-
raise
|
50
|
+
raise ErrorResponseException.new '422 - Required parameters are missing.', _context
|
51
51
|
elsif _response.status_code == 429
|
52
|
-
raise
|
52
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
53
53
|
elsif _response.status_code == 500
|
54
54
|
raise APIException.new '500 - Unexpected internal error.', _context
|
55
55
|
end
|
@@ -63,9 +63,9 @@ module SuggestGrid
|
|
63
63
|
end
|
64
64
|
|
65
65
|
# Get Recommended Items
|
66
|
-
# @param [GetRecommendedItemsBody]
|
66
|
+
# @param [GetRecommendedItemsBody] query Required parameter: The query for recommended items.
|
67
67
|
# @return ItemsResponse response from the API call
|
68
|
-
def get_recommended_items(
|
68
|
+
def get_recommended_items(query)
|
69
69
|
# the base uri for api requests
|
70
70
|
_query_builder = Configuration.base_uri.dup
|
71
71
|
|
@@ -83,7 +83,7 @@ module SuggestGrid
|
|
83
83
|
}
|
84
84
|
|
85
85
|
# Create the HttpRequest object for the call
|
86
|
-
_request = @http_client.post _query_url, headers: _headers, parameters:
|
86
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: query.to_json, username: Configuration.basic_auth_user_name, password: Configuration.basic_auth_password
|
87
87
|
|
88
88
|
# Call the on_before_request callback
|
89
89
|
@http_call_back.on_before_request(_request) if @http_call_back
|
@@ -99,11 +99,11 @@ module SuggestGrid
|
|
99
99
|
|
100
100
|
# Endpoint error handling using HTTP status codes.
|
101
101
|
if _response.status_code == 400
|
102
|
-
raise
|
102
|
+
raise ErrorResponseException.new '400 - Request body is invalid.', _context
|
103
103
|
elsif _response.status_code == 422
|
104
|
-
raise
|
104
|
+
raise ErrorResponseException.new '422 - Required parameters are missing.', _context
|
105
105
|
elsif _response.status_code == 429
|
106
|
-
raise
|
106
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
107
107
|
elsif _response.status_code == 500
|
108
108
|
raise APIException.new '500 - Unexpected internal error.', _context
|
109
109
|
end
|
@@ -9,9 +9,9 @@ module SuggestGrid
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# Get Similar Users
|
12
|
-
# @param [GetSimilarUsersBody]
|
12
|
+
# @param [GetSimilarUsersBody] query Required parameter: The query for similar users.
|
13
13
|
# @return UsersResponse response from the API call
|
14
|
-
def get_similar_users(
|
14
|
+
def get_similar_users(query)
|
15
15
|
# the base uri for api requests
|
16
16
|
_query_builder = Configuration.base_uri.dup
|
17
17
|
|
@@ -29,7 +29,7 @@ module SuggestGrid
|
|
29
29
|
}
|
30
30
|
|
31
31
|
# Create the HttpRequest object for the call
|
32
|
-
_request = @http_client.post _query_url, headers: _headers, parameters:
|
32
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: query.to_json, username: Configuration.basic_auth_user_name, password: Configuration.basic_auth_password
|
33
33
|
|
34
34
|
# Call the on_before_request callback
|
35
35
|
@http_call_back.on_before_request(_request) if @http_call_back
|
@@ -45,11 +45,11 @@ module SuggestGrid
|
|
45
45
|
|
46
46
|
# Endpoint error handling using HTTP status codes.
|
47
47
|
if _response.status_code == 400
|
48
|
-
raise
|
48
|
+
raise ErrorResponseException.new '400 - Request body is invalid.', _context
|
49
49
|
elsif _response.status_code == 422
|
50
|
-
raise
|
50
|
+
raise ErrorResponseException.new '422 - Required parameters are missing.', _context
|
51
51
|
elsif _response.status_code == 429
|
52
|
-
raise
|
52
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
53
53
|
elsif _response.status_code == 500
|
54
54
|
raise APIException.new '500 - Unexpected internal error.', _context
|
55
55
|
end
|
@@ -63,9 +63,9 @@ module SuggestGrid
|
|
63
63
|
end
|
64
64
|
|
65
65
|
# Get Similar Items
|
66
|
-
# @param [GetSimilarItemsBody]
|
66
|
+
# @param [GetSimilarItemsBody] query Required parameter: The query for similar items.
|
67
67
|
# @return ItemsResponse response from the API call
|
68
|
-
def get_similar_items(
|
68
|
+
def get_similar_items(query)
|
69
69
|
# the base uri for api requests
|
70
70
|
_query_builder = Configuration.base_uri.dup
|
71
71
|
|
@@ -83,7 +83,7 @@ module SuggestGrid
|
|
83
83
|
}
|
84
84
|
|
85
85
|
# Create the HttpRequest object for the call
|
86
|
-
_request = @http_client.post _query_url, headers: _headers, parameters:
|
86
|
+
_request = @http_client.post _query_url, headers: _headers, parameters: query.to_json, username: Configuration.basic_auth_user_name, password: Configuration.basic_auth_password
|
87
87
|
|
88
88
|
# Call the on_before_request callback
|
89
89
|
@http_call_back.on_before_request(_request) if @http_call_back
|
@@ -99,11 +99,11 @@ module SuggestGrid
|
|
99
99
|
|
100
100
|
# Endpoint error handling using HTTP status codes.
|
101
101
|
if _response.status_code == 400
|
102
|
-
raise
|
102
|
+
raise ErrorResponseException.new '400 - Request body is invalid.', _context
|
103
103
|
elsif _response.status_code == 422
|
104
|
-
raise
|
104
|
+
raise ErrorResponseException.new '422 - Required parameters are missing.', _context
|
105
105
|
elsif _response.status_code == 429
|
106
|
-
raise
|
106
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
107
107
|
elsif _response.status_code == 500
|
108
108
|
raise APIException.new '500 - Unexpected internal error.', _context
|
109
109
|
end
|
@@ -43,7 +43,7 @@ module SuggestGrid
|
|
43
43
|
|
44
44
|
# Endpoint error handling using HTTP status codes.
|
45
45
|
if _response.status_code == 429
|
46
|
-
raise
|
46
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
47
47
|
elsif _response.status_code == 500
|
48
48
|
raise APIException.new '500 - Unexpected internal error.', _context
|
49
49
|
end
|
@@ -91,7 +91,7 @@ module SuggestGrid
|
|
91
91
|
|
92
92
|
# Endpoint error handling using HTTP status codes.
|
93
93
|
if _response.status_code == 429
|
94
|
-
raise
|
94
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
95
95
|
elsif _response.status_code == 500
|
96
96
|
raise APIException.new '500 - Unexpected internal error.', _context
|
97
97
|
end
|
@@ -145,7 +145,7 @@ module SuggestGrid
|
|
145
145
|
|
146
146
|
# Endpoint error handling using HTTP status codes.
|
147
147
|
if _response.status_code == 429
|
148
|
-
raise
|
148
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
149
149
|
elsif _response.status_code == 500
|
150
150
|
raise APIException.new '500 - Unexpected internal error.', _context
|
151
151
|
end
|
@@ -160,10 +160,10 @@ module SuggestGrid
|
|
160
160
|
|
161
161
|
# Create a New Type
|
162
162
|
# @param [String] type Required parameter: The name of the type to be created.
|
163
|
-
# @param [TypeRequestBody]
|
163
|
+
# @param [TypeRequestBody] settings Optional parameter: Optional settings for the rating parameter.
|
164
164
|
# @return MessageResponse response from the API call
|
165
165
|
def create_type(type,
|
166
|
-
|
166
|
+
settings = nil)
|
167
167
|
# the base uri for api requests
|
168
168
|
_query_builder = Configuration.base_uri.dup
|
169
169
|
|
@@ -186,7 +186,7 @@ module SuggestGrid
|
|
186
186
|
}
|
187
187
|
|
188
188
|
# Create the HttpRequest object for the call
|
189
|
-
_request = @http_client.put _query_url, headers: _headers, parameters:
|
189
|
+
_request = @http_client.put _query_url, headers: _headers, parameters: settings.to_json, username: Configuration.basic_auth_user_name, password: Configuration.basic_auth_password
|
190
190
|
|
191
191
|
# Call the on_before_request callback
|
192
192
|
@http_call_back.on_before_request(_request) if @http_call_back
|
@@ -202,13 +202,13 @@ module SuggestGrid
|
|
202
202
|
|
203
203
|
# Endpoint error handling using HTTP status codes.
|
204
204
|
if _response.status_code == 402
|
205
|
-
raise
|
205
|
+
raise LimitExceededErrorResponseException.new '402 - Type limit reached.', _context
|
206
206
|
elsif _response.status_code == 409
|
207
|
-
raise
|
207
|
+
raise ErrorResponseException.new '409 - Type already exists.', _context
|
208
208
|
elsif _response.status_code == 422
|
209
|
-
raise
|
209
|
+
raise ErrorResponseException.new '422 - Rating type is not `implicit` or `explicit`.', _context
|
210
210
|
elsif _response.status_code == 429
|
211
|
-
raise
|
211
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
212
212
|
elsif _response.status_code == 500
|
213
213
|
raise APIException.new '500 - Unexpected internal error.', _context
|
214
214
|
end
|
@@ -262,9 +262,9 @@ module SuggestGrid
|
|
262
262
|
|
263
263
|
# Endpoint error handling using HTTP status codes.
|
264
264
|
if _response.status_code == 404
|
265
|
-
raise
|
265
|
+
raise ErrorResponseException.new '404 - Type does not exists.', _context
|
266
266
|
elsif _response.status_code == 429
|
267
|
-
raise
|
267
|
+
raise ErrorResponseException.new '429 - Too many requests.', _context
|
268
268
|
elsif _response.status_code == 500
|
269
269
|
raise APIException.new '500 - Unexpected internal error.', _context
|
270
270
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
|
2
|
+
|
3
|
+
module SuggestGrid
|
4
|
+
class BulkSchemaErrorResponseException < APIException
|
5
|
+
# Message of the response.
|
6
|
+
# @return [String]
|
7
|
+
attr_accessor :message
|
8
|
+
|
9
|
+
# Message of the response.
|
10
|
+
# @return [List of SchemaErrorResponse]
|
11
|
+
attr_accessor :errors
|
12
|
+
|
13
|
+
# The constructor.
|
14
|
+
# @param [String] The reason for raising an exception
|
15
|
+
# @param [HttpContext] The HttpContext of the API call.
|
16
|
+
def initialize(reason, context)
|
17
|
+
super(reason, context)
|
18
|
+
begin
|
19
|
+
hash = APIHelper.json_deserialize(@context.response.raw_body)
|
20
|
+
unbox(hash)
|
21
|
+
rescue TypeError
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Populates this object by extracting properties from a hash.
|
26
|
+
# @param [Hash] The deserialized response sent by the server in the response body.
|
27
|
+
def unbox(hash)
|
28
|
+
@message = hash["message"]
|
29
|
+
# Parameter is an array, so we need to iterate through it
|
30
|
+
@errors = nil
|
31
|
+
if hash["errors"] != nil
|
32
|
+
@errors = Array.new
|
33
|
+
hash["errors"].each{|structure| @errors << (SchemaErrorResponse.from_hash(structure) if structure)}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|