suggestgrid 0.1.32.rc2 → 0.2.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/{suggest_grid → suggestgrid}/api_helper.rb +80 -56
  4. data/lib/{suggest_grid → suggestgrid}/configuration.rb +1 -2
  5. data/lib/{suggest_grid → suggestgrid}/controllers/action_controller.rb +17 -17
  6. data/lib/{suggest_grid → suggestgrid}/controllers/base_controller.rb +5 -5
  7. data/lib/{suggest_grid → suggestgrid}/controllers/metadata_controller.rb +22 -22
  8. data/lib/{suggest_grid → suggestgrid}/controllers/recommendation_controller.rb +8 -8
  9. data/lib/{suggest_grid → suggestgrid}/controllers/similarity_controller.rb +8 -8
  10. data/lib/{suggest_grid → suggestgrid}/controllers/type_controller.rb +10 -10
  11. data/lib/{suggest_grid/exceptions/delete_error_response_exception.rb → suggestgrid/exceptions/delete_error_response_error_exception.rb} +9 -9
  12. data/lib/{suggest_grid/exceptions/detailed_error_response_exception.rb → suggestgrid/exceptions/detailed_error_response_error_exception.rb} +7 -7
  13. data/lib/{suggest_grid/exceptions/error_response_exception.rb → suggestgrid/exceptions/error_response_error_exception.rb} +6 -6
  14. data/lib/{suggest_grid/exceptions/limit_exceeded_error_response_exception.rb → suggestgrid/exceptions/limit_exceeded_error_response_error_exception.rb} +8 -8
  15. data/lib/{suggest_grid → suggestgrid}/http/faraday_client.rb +5 -7
  16. data/lib/{suggest_grid → suggestgrid}/http/http_call_back.rb +4 -4
  17. data/lib/{suggest_grid → suggestgrid}/http/http_client.rb +3 -3
  18. data/lib/{suggest_grid → suggestgrid}/http/http_context.rb +1 -1
  19. data/lib/{suggest_grid → suggestgrid}/http/http_method_enum.rb +1 -1
  20. data/lib/{suggest_grid → suggestgrid}/http/http_request.rb +4 -4
  21. data/lib/{suggest_grid → suggestgrid}/http/http_response.rb +2 -2
  22. data/lib/{suggest_grid → suggestgrid}/models/action.rb +22 -32
  23. data/lib/suggestgrid/models/actions_response.rb +56 -0
  24. data/lib/{suggest_grid → suggestgrid}/models/base_model.rb +0 -17
  25. data/lib/suggestgrid/models/bulk_post_error.rb +51 -0
  26. data/lib/suggestgrid/models/bulk_post_response.rb +47 -0
  27. data/lib/suggestgrid/models/delete_success_response.rb +60 -0
  28. data/lib/{suggest_grid → suggestgrid}/models/get_recommended_items_body.rb +42 -52
  29. data/lib/{suggest_grid → suggestgrid}/models/get_recommended_users_body.rb +42 -52
  30. data/lib/{suggest_grid → suggestgrid}/models/get_similar_items_body.rb +34 -44
  31. data/lib/{suggest_grid → suggestgrid}/models/get_similar_users_body.rb +34 -44
  32. data/lib/suggestgrid/models/get_type_response.rb +33 -0
  33. data/lib/suggestgrid/models/get_types_response.rb +33 -0
  34. data/lib/suggestgrid/models/items_response.rb +56 -0
  35. data/lib/suggestgrid/models/message_response.rb +33 -0
  36. data/lib/suggestgrid/models/metadata.rb +49 -0
  37. data/lib/suggestgrid/models/type_request_body.rb +33 -0
  38. data/lib/suggestgrid/models/users_response.rb +56 -0
  39. data/lib/suggestgrid.rb +55 -0
  40. data/spec/swagger.yaml +3 -8
  41. metadata +45 -45
  42. data/lib/suggest_grid/models/actions_response.rb +0 -66
  43. data/lib/suggest_grid/models/bulk_post_error.rb +0 -61
  44. data/lib/suggest_grid/models/bulk_post_response.rb +0 -57
  45. data/lib/suggest_grid/models/delete_success_response.rb +0 -70
  46. data/lib/suggest_grid/models/get_type_response.rb +0 -43
  47. data/lib/suggest_grid/models/get_types_response.rb +0 -43
  48. data/lib/suggest_grid/models/items_response.rb +0 -66
  49. data/lib/suggest_grid/models/message_response.rb +0 -43
  50. data/lib/suggest_grid/models/metadata.rb +0 -43
  51. data/lib/suggest_grid/models/type_request_body.rb +0 -43
  52. data/lib/suggest_grid/models/users_response.rb +0 -66
  53. data/lib/suggest_grid.rb +0 -55
  54. /data/lib/{suggest_grid → suggestgrid}/exceptions/api_exception.rb +0 -0
  55. /data/lib/{suggest_grid → suggestgrid}/http/auth/basic_auth.rb +0 -0
  56. /data/lib/{suggest_grid/suggest_grid_client.rb → suggestgrid/suggestgrid_client.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c44e135f11a1d8b703795f6ef5b96a8ac66bc46
4
- data.tar.gz: 893412dfc774a9a3ebc8c3e85f049465fd43dd23
3
+ metadata.gz: 5f074ae322cbcd701396c3a0e4a05c53572da339
4
+ data.tar.gz: 51746755e87df0ed9e82b7f799e7e4dee97bce94
5
5
  SHA512:
6
- metadata.gz: d782cc9f8f0aea024abd23214663f02922f60f4d7f807d62c9e68092dfa11627fb38dea92a980187e29e56ca305077a43b4a2d7f5059ddcb510931ab9bd96ca5
7
- data.tar.gz: 6adb43f7520811a983a61df4a826151fb5afd95e96d6d3ca7b1675d7e4ea1dbc1ba2ee367f920afc43d7f895b27229e5e0f3753b409fe06295e2c42a493595cc
6
+ metadata.gz: f0822fbd5faf03b365ad1fb13b42aea7a648533ef98e236721114971f4296b42109f39c88376ce4be2e92cfb0d6f75fcedad96bd15e3cc2d696bdbf6fdcc53c4
7
+ data.tar.gz: 79e3a462e3f2bb968e4efc0e72bc8135d7d3ef4c1c52a24d6c09dd7c4986d9544c7d17c256dcf2c94a19b9af106de330e58bd5912fb3ab8444db784ad1d1ea18
data/README.md CHANGED
@@ -33,7 +33,7 @@ Once you [sign up for SuggestGrid](https://dashboard.suggestgrid.com/users/sign_
33
33
  You can authenticate your application using `SUGGESTGRID_URL` environment variable like the example below:
34
34
 
35
35
  ```ruby
36
- require 'suggest_grid'
36
+ require 'suggestgrid'
37
37
 
38
38
  SuggestGridClient = SuggestGrid::SuggestGridClient.new ENV['SUGGESTGRID_URL']
39
39
  ```
@@ -2,6 +2,25 @@
2
2
 
3
3
  module SuggestGrid
4
4
  class APIHelper
5
+ # Serializes an array parameter (creates key value pairs)
6
+ # @param [String] The name of the parameter
7
+ # @param [Array] The value of the parameter
8
+ # @param [String] The format of the serialization
9
+ def self.serialize_array(key, array, formatting: 'indexed')
10
+ tuples = []
11
+
12
+ if formatting == 'unindexed'
13
+ tuples += array.map { |element| ["#{key}[]", element] }
14
+ elsif formatting == 'indexed'
15
+ tuples += array.map.with_index { |element, index| ["#{key}[#{index}]", element] }
16
+ elsif formatting == 'plain'
17
+ tuples += array.map { |element| [key, element] }
18
+ else
19
+ raise ArgumentError, 'Invalid format provided.'
20
+ end
21
+ tuples
22
+ end
23
+
5
24
  # Replaces template parameters in the given url
6
25
  # @param [String] The query string builder to replace the template parameters
7
26
  # @param [Hash] The parameters to replace in the url
@@ -10,50 +29,59 @@ module SuggestGrid
10
29
  raise ArgumentError, 'Given value for parameter \"query_builder\" is invalid.' unless query_builder.instance_of? String
11
30
 
12
31
  # return if there are no parameters to replace
13
- if parameters.nil?
14
- query_builder
15
- else
16
- # iterate and append parameters
17
- parameters.each do |key, value|
18
- replace_value = ''
32
+ return query_builder if parameters.nil?
19
33
 
20
- if value.nil?
21
- replace_value = ''
22
- elsif value.instance_of? Array
23
- value.map!{|element| CGI.escape(element.to_s)}
24
- replace_value = value.join('/')
25
- else
26
- replace_value = CGI.escape(value.to_s)
27
- end
34
+ # iterate and append parameters
35
+ parameters.each do |key, value|
36
+ replace_value = ''
28
37
 
29
- # find the template parameter and replace it with its value
30
- query_builder = query_builder.gsub('{' + key.to_s + '}', replace_value)
38
+ if value.nil?
39
+ replace_value = ''
40
+ elsif value.instance_of? Array
41
+ value.map! { |element| CGI.escape(element.to_s) }
42
+ replace_value = value.join('/')
43
+ else
44
+ replace_value = CGI.escape(value.to_s)
31
45
  end
46
+
47
+ # find the template parameter and replace it with its value
48
+ query_builder = query_builder.gsub('{' + key.to_s + '}', replace_value)
32
49
  end
33
- return query_builder
50
+ query_builder
34
51
  end
35
52
 
36
53
  # Appends the given set of parameters to the given query string
37
- # @param [String] The query string builder to replace the template parameters
54
+ # @param [String] The query string builder to add the query parameters to
38
55
  # @param [Hash] The parameters to append
39
- def self.append_url_with_query_parameters(query_builder, parameters)
56
+ # @param [String] The format of array parameter serialization
57
+ def self.append_url_with_query_parameters(query_builder, parameters, array_serialization: 'indexed')
40
58
  # perform parameter validation
41
59
  raise ArgumentError, 'Given value for parameter \"query_builder\" is invalid.' unless query_builder.instance_of? String
42
60
 
43
61
  # return if there are no parameters to replace
44
- if parameters.nil?
45
- return query_builder
46
- else
47
- # remove any nil values
48
- parameters = parameters.reject { |_key, value| value.nil? }
49
-
50
- # does the query string already has parameters
51
- has_params = query_builder.include? '?'
52
- separator = has_params ? '&' : '?'
53
-
54
- # append query with separator and parameters and return
55
- return query_builder << separator << URI.encode_www_form(parameters)
62
+ return query_builder if parameters.nil?
63
+
64
+ parameters.each do |key, value|
65
+ seperator = (query_builder.include? '?') ? '&' : '?'
66
+ if not value.nil?
67
+ if value.instance_of? Array
68
+ value.compact!
69
+ if array_serialization == 'csv'
70
+ query_builder += "#{seperator}#{key}=#{value.map { |element| CGI.escape(element.to_s) }.join(',')}"
71
+ elsif array_serialization == 'psv'
72
+ query_builder += "#{seperator}#{key}=#{value.map { |element| CGI.escape(element.to_s) }.join('|')}"
73
+ elsif array_serialization == 'tsv'
74
+ query_builder += "#{seperator}#{key}=#{value.map { |element| CGI.escape(element.to_s) }.join('\t')}"
75
+ else
76
+ query_builder += "#{seperator}#{APIHelper.serialize_array(key, value, formatting: array_serialization).
77
+ map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')}"
78
+ end
79
+ else
80
+ query_builder += "#{seperator}#{key}=#{CGI.escape(value.to_s)}"
81
+ end
82
+ end
56
83
  end
84
+ query_builder
57
85
  end
58
86
 
59
87
  # Validates and processes the given Url
@@ -69,46 +97,44 @@ module SuggestGrid
69
97
 
70
98
  # get the http protocol match
71
99
  protocol = matches[1]
72
-
100
+
73
101
  # check if parameters exist
74
102
  index = url.index('?')
75
103
 
76
104
  # remove redundant forward slashes
77
- query = url[protocol.length...(index != nil ? index : url.length)]
105
+ query = url[protocol.length...(!index.nil? ? index : url.length)]
78
106
  query.gsub!(%r{\/\/+}, '/')
79
107
 
80
108
  # get the parameters
81
- parameters = index != nil ? url[url.index('?')...url.length] : ""
109
+ parameters = !index.nil? ? url[url.index('?')...url.length] : ''
82
110
 
83
111
  # return processed url
84
- return protocol + query + parameters
85
- end
112
+ protocol + query + parameters
113
+ end
86
114
 
87
115
  # Parses JSON string.
88
116
  # @param [String] A JSON string.
89
117
  def self.json_deserialize(json)
90
- begin
91
- return JSON.parse(json)
92
- rescue
93
- raise TypeError, "Server responded with invalid JSON."
94
- end
118
+ return JSON.parse(json)
119
+ rescue
120
+ raise TypeError, 'Server responded with invalid JSON.'
95
121
  end
96
122
 
97
123
  # Removes elements with empty values from a hash.
98
124
  # @param [Hash] The hash to clean.
99
125
  def self.clean_hash(hash)
100
- hash.delete_if { |key, value| value.to_s.strip.empty? }
126
+ hash.delete_if { |_key, value| value.to_s.strip.empty? }
101
127
  end
102
128
 
103
129
  # Form encodes a hash of parameters.
104
130
  # @param [Hash] The hash of parameters to encode.
105
131
  # @return [Hash] A hash with the same parameters form encoded.
106
132
  def self.form_encode_parameters(form_parameters)
107
- encoded = Hash.new
133
+ encoded = {}
108
134
  form_parameters.each do |key, value|
109
- encoded.merge!(APIHelper.form_encode value, key)
110
- end
111
- return encoded
135
+ encoded.merge!(APIHelper.form_encode(value, key))
136
+ end
137
+ encoded
112
138
  end
113
139
 
114
140
  # Form encodes an object.
@@ -116,28 +142,26 @@ module SuggestGrid
116
142
  # @param [String] The name of the object.
117
143
  # @return [Hash] A form encoded representation of the object in the form of a hash.
118
144
  def self.form_encode(obj, instance_name)
119
- retval = Hash.new
145
+ retval = {}
120
146
 
121
147
  # If this is a structure, resolve it's field names.
122
- if obj.kind_of? BaseModel
123
- obj = obj.to_hash
124
- end
125
-
148
+ obj = obj.to_hash if obj.is_a? BaseModel
149
+
126
150
  # Create a form encoded hash for this object.
127
- if obj == nil
128
- nil
151
+ if obj.nil?
152
+ nil
129
153
  elsif obj.instance_of? Array
130
154
  obj.each_with_index do |value, index|
131
- retval.merge!(APIHelper.form_encode(value, instance_name + "[" + index.to_s + "]"))
155
+ retval.merge!(APIHelper.form_encode(value, instance_name + '[' + index.to_s + ']'))
132
156
  end
133
157
  elsif obj.instance_of? Hash
134
158
  obj.each do |key, value|
135
- retval.merge!(APIHelper.form_encode(value, instance_name + "[" + key + "]"))
159
+ retval.merge!(APIHelper.form_encode(value, instance_name + '[' + key + ']'))
136
160
  end
137
161
  else
138
162
  retval[instance_name] = obj
139
163
  end
140
- return retval
164
+ retval
141
165
  end
142
166
  end
143
167
  end
@@ -1,7 +1,6 @@
1
1
  # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
2
 
3
3
  module SuggestGrid
4
-
5
4
  class Configuration
6
5
  # The base Uri for API calls
7
6
  @base_uri = 'https://example.com/api'
@@ -14,10 +13,10 @@ module SuggestGrid
14
13
 
15
14
  # The attribute accessors for public properties
16
15
  class << self
16
+ attr_accessor :array_serialization
17
17
  attr_accessor :base_uri
18
18
  attr_accessor :basic_auth_user_name
19
19
  attr_accessor :basic_auth_password
20
20
  end
21
-
22
21
  end
23
22
  end
@@ -31,13 +31,13 @@ module SuggestGrid
31
31
 
32
32
  # validate response against endpoint and global error codes
33
33
  if _context.response.status_code == 400
34
- raise ErrorResponseException.new 'Required user id or item id parameters are missing from the request.', _context
34
+ raise ErrorResponseErrorException.new 'Required user id or item id parameters are missing from the request.', _context
35
35
  elsif _context.response.status_code == 402
36
- raise ErrorResponseException.new 'Action limit exceeded.', _context
36
+ raise ErrorResponseErrorException.new 'Action limit exceeded.', _context
37
37
  elsif _context.response.status_code == 404
38
- raise ErrorResponseException.new 'Action type does not exists.', _context
38
+ raise ErrorResponseErrorException.new 'Action type does not exists.', _context
39
39
  elsif !_context.response.status_code.between?(200, 208)
40
- raise ErrorResponseException.new 'Unexpected internal error.', _context
40
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
41
41
  end
42
42
  validate_response(_context)
43
43
 
@@ -73,15 +73,15 @@ module SuggestGrid
73
73
 
74
74
  # validate response against endpoint and global error codes
75
75
  if _context.response.status_code == 400
76
- raise ErrorResponseException.new 'Body is missing.', _context
76
+ raise ErrorResponseErrorException.new 'Body is missing.', _context
77
77
  elsif _context.response.status_code == 402
78
- raise ErrorResponseException.new 'Action limit exceeded.', _context
78
+ raise ErrorResponseErrorException.new 'Action limit exceeded.', _context
79
79
  elsif _context.response.status_code == 404
80
- raise ErrorResponseException.new 'Action type does not exists.', _context
80
+ raise ErrorResponseErrorException.new 'Action type does not exists.', _context
81
81
  elsif _context.response.status_code == 413
82
- raise ErrorResponseException.new 'Bulk request maximum line count exceeded.', _context
82
+ raise ErrorResponseErrorException.new 'Bulk request maximum line count exceeded.', _context
83
83
  elsif !_context.response.status_code.between?(200, 208)
84
- raise ErrorResponseException.new 'Unexpected internal error.', _context
84
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
85
85
  end
86
86
  validate_response(_context)
87
87
 
@@ -115,7 +115,7 @@ module SuggestGrid
115
115
  'older_than' => older_than,
116
116
  'size' => size,
117
117
  'from' => from
118
- }
118
+ }, array_serialization: Configuration.array_serialization
119
119
  _query_url = APIHelper.clean_url _query_builder
120
120
 
121
121
  # prepare headers
@@ -130,7 +130,7 @@ module SuggestGrid
130
130
 
131
131
  # validate response against endpoint and global error codes
132
132
  if _context.response.status_code == 0
133
- raise ErrorResponseException.new 'Unexpected internal error.', _context
133
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
134
134
  end
135
135
  validate_response(_context)
136
136
 
@@ -158,7 +158,7 @@ module SuggestGrid
158
158
  'user_id' => user_id,
159
159
  'item_id' => item_id,
160
160
  'older_than' => older_than
161
- }
161
+ }, array_serialization: Configuration.array_serialization
162
162
  _query_url = APIHelper.clean_url _query_builder
163
163
 
164
164
  # prepare headers
@@ -173,15 +173,15 @@ module SuggestGrid
173
173
 
174
174
  # validate response against endpoint and global error codes
175
175
  if _context.response.status_code == 400
176
- raise ErrorResponseException.new 'Required user id or item id parameters are missing.', _context
176
+ raise ErrorResponseErrorException.new 'Required user id or item id parameters are missing.', _context
177
177
  elsif _context.response.status_code == 404
178
- raise DeleteErrorResponseException.new 'Delete actions not found.', _context
178
+ raise DeleteErrorResponseErrorException.new 'Delete actions not found.', _context
179
179
  elsif _context.response.status_code == 422
180
- raise ErrorResponseException.new 'No query parameter (user id, item id, or older than) is given. qIn order to delete all actionsdelete the type.', _context
180
+ raise ErrorResponseErrorException.new 'No query parameter (user id, item id, or older than) is given. qIn order to delete all actionsdelete the type.', _context
181
181
  elsif _context.response.status_code == 505
182
- raise ErrorResponseException.new 'Request timed out.', _context
182
+ raise ErrorResponseErrorException.new 'Request timed out.', _context
183
183
  elsif !_context.response.status_code.between?(200, 208)
184
- raise ErrorResponseException.new 'Unexpected internal error.', _context
184
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
185
185
  end
186
186
  validate_response(_context)
187
187
 
@@ -7,7 +7,7 @@ module SuggestGrid
7
7
  @@http_client = FaradayClient.new
8
8
 
9
9
  @@global_headers = {
10
- 'user-agent' => 'SUGGESTGRID'
10
+ 'user-agent' => 'SUGGESTGRID'
11
11
  }
12
12
 
13
13
  def initialize(http_client: nil, http_call_back: nil)
@@ -16,8 +16,8 @@ module SuggestGrid
16
16
  end
17
17
 
18
18
  def validate_parameters(args)
19
- args.each do |name, value|
20
- if value == nil
19
+ args.each do |_name, value|
20
+ if value.nil?
21
21
  raise ArgumentError.new 'Required parameter #{name} cannot be nil.'
22
22
  end
23
23
  end
@@ -28,7 +28,7 @@ module SuggestGrid
28
28
 
29
29
  APIHelper.clean_hash(request.headers)
30
30
  request.headers = @@global_headers.clone.merge(request.headers)
31
-
31
+
32
32
  response = binary ? @http_client.execute_as_binary(request) : @http_client.execute_as_string(request)
33
33
  context = HttpContext.new(request, response)
34
34
 
@@ -43,4 +43,4 @@ module SuggestGrid
43
43
  end
44
44
  end
45
45
  end
46
- end
46
+ end
@@ -31,9 +31,9 @@ module SuggestGrid
31
31
 
32
32
  # validate response against endpoint and global error codes
33
33
  if _context.response.status_code == 400
34
- raise DetailedErrorResponseException.new 'Metadata is invalid.', _context
34
+ raise DetailedErrorResponseErrorException.new 'Metadata is invalid.', _context
35
35
  elsif !_context.response.status_code.between?(200, 208)
36
- raise ErrorResponseException.new 'Unexpected internal error.', _context
36
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
37
37
  end
38
38
  validate_response(_context)
39
39
 
@@ -69,11 +69,11 @@ module SuggestGrid
69
69
 
70
70
  # validate response against endpoint and global error codes
71
71
  if _context.response.status_code == 400
72
- raise ErrorResponseException.new 'Body is missing.', _context
72
+ raise ErrorResponseErrorException.new 'Body is missing.', _context
73
73
  elsif _context.response.status_code == 413
74
- raise ErrorResponseException.new 'Bulk request maximum line count exceeded.', _context
74
+ raise ErrorResponseErrorException.new 'Bulk request maximum line count exceeded.', _context
75
75
  elsif !_context.response.status_code.between?(200, 208)
76
- raise ErrorResponseException.new 'Unexpected internal error.', _context
76
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
77
77
  end
78
78
  validate_response(_context)
79
79
 
@@ -107,9 +107,9 @@ module SuggestGrid
107
107
 
108
108
  # validate response against endpoint and global error codes
109
109
  if _context.response.status_code == 404
110
- raise ErrorResponseException.new 'User does not exists.', _context
110
+ raise ErrorResponseErrorException.new 'User does not exists.', _context
111
111
  elsif !_context.response.status_code.between?(200, 208)
112
- raise ErrorResponseException.new 'Unexpected internal error.', _context
112
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
113
113
  end
114
114
  validate_response(_context)
115
115
 
@@ -131,7 +131,7 @@ module SuggestGrid
131
131
  _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
132
132
  'size' => size,
133
133
  'from' => from
134
- }
134
+ }, array_serialization: Configuration.array_serialization
135
135
  _query_url = APIHelper.clean_url _query_builder
136
136
 
137
137
  # prepare headers
@@ -146,7 +146,7 @@ module SuggestGrid
146
146
 
147
147
  # validate response against endpoint and global error codes
148
148
  if _context.response.status_code == 0
149
- raise ErrorResponseException.new 'Unexpected internal error.', _context
149
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
150
150
  end
151
151
  validate_response(_context)
152
152
 
@@ -180,7 +180,7 @@ module SuggestGrid
180
180
 
181
181
  # validate response against endpoint and global error codes
182
182
  if _context.response.status_code == 0
183
- raise ErrorResponseException.new 'Unexpected internal error.', _context
183
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
184
184
  end
185
185
  validate_response(_context)
186
186
 
@@ -210,7 +210,7 @@ module SuggestGrid
210
210
 
211
211
  # validate response against endpoint and global error codes
212
212
  if _context.response.status_code == 0
213
- raise ErrorResponseException.new 'Unexpected internal error.', _context
213
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
214
214
  end
215
215
  validate_response(_context)
216
216
 
@@ -242,9 +242,9 @@ module SuggestGrid
242
242
 
243
243
  # validate response against endpoint and global error codes
244
244
  if _context.response.status_code == 400
245
- raise DetailedErrorResponseException.new 'Metadata is invalid.', _context
245
+ raise DetailedErrorResponseErrorException.new 'Metadata is invalid.', _context
246
246
  elsif !_context.response.status_code.between?(200, 208)
247
- raise ErrorResponseException.new 'Unexpected internal error.', _context
247
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
248
248
  end
249
249
  validate_response(_context)
250
250
 
@@ -280,11 +280,11 @@ module SuggestGrid
280
280
 
281
281
  # validate response against endpoint and global error codes
282
282
  if _context.response.status_code == 400
283
- raise ErrorResponseException.new 'Body is missing.', _context
283
+ raise ErrorResponseErrorException.new 'Body is missing.', _context
284
284
  elsif _context.response.status_code == 413
285
- raise ErrorResponseException.new 'Bulk request maximum line count exceeded.', _context
285
+ raise ErrorResponseErrorException.new 'Bulk request maximum line count exceeded.', _context
286
286
  elsif !_context.response.status_code.between?(200, 208)
287
- raise ErrorResponseException.new 'Unexpected internal error.', _context
287
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
288
288
  end
289
289
  validate_response(_context)
290
290
 
@@ -318,9 +318,9 @@ module SuggestGrid
318
318
 
319
319
  # validate response against endpoint and global error codes
320
320
  if _context.response.status_code == 404
321
- raise ErrorResponseException.new 'Item does not exists.', _context
321
+ raise ErrorResponseErrorException.new 'Item does not exists.', _context
322
322
  elsif !_context.response.status_code.between?(200, 208)
323
- raise ErrorResponseException.new 'Unexpected internal error.', _context
323
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
324
324
  end
325
325
  validate_response(_context)
326
326
 
@@ -342,7 +342,7 @@ module SuggestGrid
342
342
  _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {
343
343
  'size' => size,
344
344
  'from' => from
345
- }
345
+ }, array_serialization: Configuration.array_serialization
346
346
  _query_url = APIHelper.clean_url _query_builder
347
347
 
348
348
  # prepare headers
@@ -357,7 +357,7 @@ module SuggestGrid
357
357
 
358
358
  # validate response against endpoint and global error codes
359
359
  if _context.response.status_code == 0
360
- raise ErrorResponseException.new 'Unexpected internal error.', _context
360
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
361
361
  end
362
362
  validate_response(_context)
363
363
 
@@ -391,7 +391,7 @@ module SuggestGrid
391
391
 
392
392
  # validate response against endpoint and global error codes
393
393
  if _context.response.status_code == 0
394
- raise ErrorResponseException.new 'Unexpected internal error.', _context
394
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
395
395
  end
396
396
  validate_response(_context)
397
397
 
@@ -421,7 +421,7 @@ module SuggestGrid
421
421
 
422
422
  # validate response against endpoint and global error codes
423
423
  if _context.response.status_code == 0
424
- raise ErrorResponseException.new 'Unexpected internal error.', _context
424
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
425
425
  end
426
426
  validate_response(_context)
427
427
 
@@ -31,13 +31,13 @@ module SuggestGrid
31
31
 
32
32
  # validate response against endpoint and global error codes
33
33
  if _context.response.status_code == 400
34
- raise ErrorResponseException.new 'Request body is invalid.', _context
34
+ raise ErrorResponseErrorException.new 'Request body is invalid.', _context
35
35
  elsif _context.response.status_code == 404
36
- raise ErrorResponseException.new 'At least one type in the request does not exist.', _context
36
+ raise ErrorResponseErrorException.new 'At least one type in the request does not exist.', _context
37
37
  elsif _context.response.status_code == 422
38
- raise ErrorResponseException.new 'Required parameters are missing.', _context
38
+ raise ErrorResponseErrorException.new 'Required parameters are missing.', _context
39
39
  elsif !_context.response.status_code.between?(200, 208)
40
- raise ErrorResponseException.new 'Unexpected internal error.', _context
40
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
41
41
  end
42
42
  validate_response(_context)
43
43
 
@@ -69,13 +69,13 @@ module SuggestGrid
69
69
 
70
70
  # validate response against endpoint and global error codes
71
71
  if _context.response.status_code == 400
72
- raise ErrorResponseException.new 'Request body is invalid.', _context
72
+ raise ErrorResponseErrorException.new 'Request body is invalid.', _context
73
73
  elsif _context.response.status_code == 404
74
- raise ErrorResponseException.new 'At least one type in the request does not exist.', _context
74
+ raise ErrorResponseErrorException.new 'At least one type in the request does not exist.', _context
75
75
  elsif _context.response.status_code == 422
76
- raise ErrorResponseException.new 'Required parameters are missing.', _context
76
+ raise ErrorResponseErrorException.new 'Required parameters are missing.', _context
77
77
  elsif !_context.response.status_code.between?(200, 208)
78
- raise ErrorResponseException.new 'Unexpected internal error.', _context
78
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
79
79
  end
80
80
  validate_response(_context)
81
81
 
@@ -31,13 +31,13 @@ module SuggestGrid
31
31
 
32
32
  # validate response against endpoint and global error codes
33
33
  if _context.response.status_code == 400
34
- raise ErrorResponseException.new 'Request body is invalid.', _context
34
+ raise ErrorResponseErrorException.new 'Request body is invalid.', _context
35
35
  elsif _context.response.status_code == 404
36
- raise ErrorResponseException.new 'At least one type in the request does not exist.', _context
36
+ raise ErrorResponseErrorException.new 'At least one type in the request does not exist.', _context
37
37
  elsif _context.response.status_code == 422
38
- raise ErrorResponseException.new 'Required parameters are missing.', _context
38
+ raise ErrorResponseErrorException.new 'Required parameters are missing.', _context
39
39
  elsif !_context.response.status_code.between?(200, 208)
40
- raise ErrorResponseException.new 'Unexpected internal error.', _context
40
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
41
41
  end
42
42
  validate_response(_context)
43
43
 
@@ -69,13 +69,13 @@ module SuggestGrid
69
69
 
70
70
  # validate response against endpoint and global error codes
71
71
  if _context.response.status_code == 400
72
- raise ErrorResponseException.new 'Request body is invalid.', _context
72
+ raise ErrorResponseErrorException.new 'Request body is invalid.', _context
73
73
  elsif _context.response.status_code == 404
74
- raise ErrorResponseException.new 'At least one type in the request does not exist.', _context
74
+ raise ErrorResponseErrorException.new 'At least one type in the request does not exist.', _context
75
75
  elsif _context.response.status_code == 422
76
- raise ErrorResponseException.new 'Required parameters are missing.', _context
76
+ raise ErrorResponseErrorException.new 'Required parameters are missing.', _context
77
77
  elsif !_context.response.status_code.between?(200, 208)
78
- raise ErrorResponseException.new 'Unexpected internal error.', _context
78
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
79
79
  end
80
80
  validate_response(_context)
81
81
 
@@ -36,13 +36,13 @@ module SuggestGrid
36
36
 
37
37
  # validate response against endpoint and global error codes
38
38
  if _context.response.status_code == 402
39
- raise LimitExceededErrorResponseException.new 'Type limit reached.', _context
39
+ raise LimitExceededErrorResponseErrorException.new 'Type limit reached.', _context
40
40
  elsif _context.response.status_code == 409
41
- raise ErrorResponseException.new 'Type already exists.', _context
41
+ raise ErrorResponseErrorException.new 'Type already exists.', _context
42
42
  elsif _context.response.status_code == 422
43
- raise ErrorResponseException.new 'Rating type is not `implicit` or `explicit`.', _context
43
+ raise ErrorResponseErrorException.new 'Rating type is not `implicit` or `explicit`.', _context
44
44
  elsif !_context.response.status_code.between?(200, 208)
45
- raise ErrorResponseException.new 'Unexpected internal error.', _context
45
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
46
46
  end
47
47
  validate_response(_context)
48
48
 
@@ -76,9 +76,9 @@ module SuggestGrid
76
76
 
77
77
  # validate response against endpoint and global error codes
78
78
  if _context.response.status_code == 404
79
- raise ErrorResponseException.new 'Type does not exists.', _context
79
+ raise ErrorResponseErrorException.new 'Type does not exists.', _context
80
80
  elsif !_context.response.status_code.between?(200, 208)
81
- raise ErrorResponseException.new 'Unexpected internal error.', _context
81
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
82
82
  end
83
83
  validate_response(_context)
84
84
 
@@ -112,9 +112,9 @@ module SuggestGrid
112
112
 
113
113
  # validate response against endpoint and global error codes
114
114
  if _context.response.status_code == 404
115
- raise ErrorResponseException.new 'Action type does not exists.', _context
115
+ raise ErrorResponseErrorException.new 'Action type does not exists.', _context
116
116
  elsif !_context.response.status_code.between?(200, 208)
117
- raise ErrorResponseException.new 'Unexpected internal error.', _context
117
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
118
118
  end
119
119
  validate_response(_context)
120
120
 
@@ -144,7 +144,7 @@ module SuggestGrid
144
144
 
145
145
  # validate response against endpoint and global error codes
146
146
  if _context.response.status_code == 0
147
- raise ErrorResponseException.new 'Unexpected internal error.', _context
147
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
148
148
  end
149
149
  validate_response(_context)
150
150
 
@@ -174,7 +174,7 @@ module SuggestGrid
174
174
 
175
175
  # validate response against endpoint and global error codes
176
176
  if _context.response.status_code == 0
177
- raise ErrorResponseException.new 'Unexpected internal error.', _context
177
+ raise ErrorResponseErrorException.new 'Unexpected internal error.', _context
178
178
  end
179
179
  validate_response(_context)
180
180