suggestgrid 0.1.17.pre.SNAPSHOT → 0.1.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/suggest_grid/api_helper.rb +2 -2
  3. data/lib/suggest_grid/configuration.rb +2 -1
  4. data/lib/suggest_grid/controllers/action_controller.rb +77 -99
  5. data/lib/suggest_grid/controllers/base_controller.rb +27 -2
  6. data/lib/suggest_grid/controllers/metadata_controller.rb +259 -209
  7. data/lib/suggest_grid/controllers/recommendation_controller.rb +32 -44
  8. data/lib/suggest_grid/controllers/similarity_controller.rb +32 -44
  9. data/lib/suggest_grid/controllers/type_controller.rb +74 -104
  10. data/lib/suggest_grid/exceptions/api_exception.rb +1 -1
  11. data/lib/suggest_grid/exceptions/delete_error_response_exception.rb +52 -0
  12. data/lib/suggest_grid/exceptions/detailed_error_response_exception.rb +3 -3
  13. data/lib/suggest_grid/exceptions/error_response_exception.rb +3 -3
  14. data/lib/suggest_grid/exceptions/limit_exceeded_error_response_exception.rb +3 -3
  15. data/lib/suggest_grid/http/auth/basic_auth.rb +17 -0
  16. data/lib/suggest_grid/http/faraday_client.rb +43 -0
  17. data/lib/suggest_grid/http/http_call_back.rb +2 -2
  18. data/lib/suggest_grid/http/http_client.rb +13 -43
  19. data/lib/suggest_grid/http/http_request.rb +24 -8
  20. data/lib/suggest_grid/models/actions_response.rb +58 -0
  21. data/lib/suggest_grid/models/{schema_error_response.rb → bulk_post_error.rb} +4 -4
  22. data/lib/suggest_grid/models/bulk_post_response.rb +49 -0
  23. data/lib/suggest_grid/models/get_recommended_items_body.rb +14 -5
  24. data/lib/suggest_grid/models/get_recommended_users_body.rb +11 -2
  25. data/lib/suggest_grid/models/get_similar_items_body.rb +14 -5
  26. data/lib/suggest_grid/models/get_similar_users_body.rb +11 -2
  27. data/lib/suggest_grid/models/items_response.rb +10 -1
  28. data/lib/suggest_grid/models/users_response.rb +10 -1
  29. data/lib/suggest_grid.rb +53 -53
  30. data/spec/swagger.yaml +185 -87
  31. metadata +41 -15
  32. data/lib/suggest_grid/exceptions/bulk_schema_error_response_exception.rb +0 -37
  33. data/lib/suggest_grid/http/unirest_client.rb +0 -41
  34. data/lib/suggest_grid/models/count_response.rb +0 -35
  35. data/lib/suggest_grid/models/delete_error_response.rb +0 -80
  36. data/lib/suggest_grid/models/metadata_information_response.rb +0 -35
@@ -30,10 +30,10 @@ module SuggestGrid
30
30
  begin
31
31
  hash = APIHelper.json_deserialize(@context.response.raw_body)
32
32
  unbox(hash)
33
- rescue TypeError
34
- end
33
+ rescue TypeError
34
+ end
35
35
  end
36
-
36
+
37
37
  # Populates this object by extracting properties from a hash.
38
38
  # @param [Hash] The deserialized response sent by the server in the response body.
39
39
  def unbox(hash)
@@ -0,0 +1,17 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ require "base64"
4
+
5
+ module SuggestGrid
6
+ class BasicAuth
7
+ # Add basic authentication to the request.
8
+ # @param [HttpRequest] The HttpRequest object to which authentication will be added.
9
+ def self.apply(http_request)
10
+ username = Configuration.basic_auth_user_name
11
+ password = Configuration.basic_auth_password
12
+ value = Base64.encode64("#{username}:#{password}")
13
+ header_value = "Basic #{value}"
14
+ http_request.headers["Authorization"] = header_value
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,43 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+ require 'faraday/http_cache'
3
+
4
+ module SuggestGrid
5
+ class FaradayClient < HttpClient
6
+ # The constructor.
7
+ def initialize(timeout: nil, cache: false)
8
+ @connection = Faraday.new do |faraday|
9
+ faraday.use Faraday::HttpCache, serializer: Marshal if cache
10
+ faraday.request :multipart
11
+ faraday.request :url_encoded
12
+ faraday.ssl[:ca_file] = Certifi.where
13
+ faraday.adapter Faraday.default_adapter
14
+ faraday.options[:open_timeout] = timeout if timeout
15
+ end
16
+ end
17
+
18
+ # Method overridden from HttpClient.
19
+ def execute_as_string(http_request)
20
+ response = @connection.send(http_request.http_method.downcase, http_request.query_url) do |request|
21
+ request.headers = http_request.headers
22
+ request.body = http_request.parameters
23
+ end
24
+
25
+ return convert_response(response)
26
+ end
27
+
28
+ # Method overridden from HttpClient.
29
+ def execute_as_binary(http_request)
30
+ response = @connection.send(http_request.http_method.downcase, http_request.query_url) do |request|
31
+ request.headers = http_request.headers
32
+ request.body = http_request.parameters
33
+ end
34
+
35
+ return convert_response(response)
36
+ end
37
+
38
+ # Method overridden from HttpClient.
39
+ def convert_response(response)
40
+ return HttpResponse.new(response.status, response.headers, response.body)
41
+ end
42
+ end
43
+ end
@@ -9,8 +9,8 @@ module SuggestGrid
9
9
  end
10
10
 
11
11
  # A controller will call this method after making an HTTP Request.
12
- # @param [HttpResponse] The HttpResponse object received from the HttpClient.
13
- def on_after_response(http_response)
12
+ # @param [HttpContext] The HttpContext of the API call.
13
+ def on_after_response(http_context)
14
14
  raise NotImplementedError, "This method needs to be implemented in a child class."
15
15
  end
16
16
  end
@@ -23,90 +23,60 @@ module SuggestGrid
23
23
  # Get a GET HttpRequest object.
24
24
  # @param [String] The URL to send the request to.
25
25
  # @param [Hash, Optional] The headers for the HTTP Request.
26
- # @param [String, Optional] Username for Basic Auth requests.
27
- # @param [String, Optional] Password for Basic Auth requests.
28
26
  def get(query_url,
29
- headers: nil,
30
- username: nil,
31
- password: nil)
27
+ headers: {})
32
28
  return HttpRequest.new(HttpMethodEnum::GET,
33
29
  query_url,
34
- headers: headers,
35
- username: username,
36
- password: password)
30
+ headers: headers)
37
31
  end
38
32
 
39
33
  # Get a POST HttpRequest object.
40
34
  # @param [String] The URL to send the request to.
41
35
  # @param [Hash, Optional] The headers for the HTTP Request.
42
36
  # @param [Hash, Optional] The parameters for the HTTP Request.
43
- # @param [String, Optional] Username for Basic Auth requests.
44
- # @param [String, Optional] Password for Basic Auth requests.
45
37
  def post(query_url,
46
- headers: nil,
47
- parameters: nil,
48
- username: nil,
49
- password: nil)
38
+ headers: {},
39
+ parameters: {})
50
40
  return HttpRequest.new(HttpMethodEnum::POST,
51
41
  query_url,
52
42
  headers: headers,
53
- parameters: parameters,
54
- username: username,
55
- password: password)
43
+ parameters: parameters)
56
44
  end
57
45
 
58
46
  # Get a PUT HttpRequest object.
59
47
  # @param [String] The URL to send the request to.
60
48
  # @param [Hash, Optional] The headers for the HTTP Request.
61
49
  # @param [Hash, Optional] The parameters for the HTTP Request.
62
- # @param [String, Optional] Username for Basic Auth requests.
63
- # @param [String, Optional] Password for Basic Auth requests.
64
50
  def put(query_url,
65
- headers: nil,
66
- parameters: nil,
67
- username: nil,
68
- password: nil)
51
+ headers: {},
52
+ parameters: {})
69
53
  return HttpRequest.new(HttpMethodEnum::PUT,
70
54
  query_url,
71
55
  headers: headers,
72
- parameters: parameters,
73
- username: username,
74
- password: password)
56
+ parameters: parameters)
75
57
  end
76
58
 
77
59
  # Get a PATCH HttpRequest object.
78
60
  # @param [String] The URL to send the request to.
79
61
  # @param [Hash, Optional] The headers for the HTTP Request.
80
62
  # @param [Hash, Optional] The parameters for the HTTP Request.
81
- # @param [String, Optional] Username for Basic Auth requests.
82
- # @param [String, Optional] Password for Basic Auth requests.
83
63
  def patch(query_url,
84
- headers: nil,
85
- parameters: nil,
86
- username: nil,
87
- password: nil)
64
+ headers: {},
65
+ parameters: {})
88
66
  return HttpRequest.new(HttpMethodEnum::PATCH,
89
67
  query_url,
90
68
  headers: headers,
91
- parameters: parameters,
92
- username: username,
93
- password: password)
69
+ parameters: parameters)
94
70
  end
95
71
 
96
72
  # Get a DELETE HttpRequest object.
97
73
  # @param [String] The URL to send the request to.
98
74
  # @param [Hash, Optional] The headers for the HTTP Request.
99
- # @param [String, Optional] Username for Basic Auth requests.
100
- # @param [String, Optional] Password for Basic Auth requests.
101
75
  def delete(query_url,
102
- headers: nil,
103
- username: nil,
104
- password: nil)
76
+ headers: {})
105
77
  return HttpRequest.new(HttpMethodEnum::DELETE,
106
78
  query_url,
107
- headers: headers,
108
- username: username,
109
- password: password)
79
+ headers: headers)
110
80
  end
111
81
  end
112
82
  end
@@ -9,20 +9,36 @@ module SuggestGrid
9
9
  # @param [String] The URL to send the request to.
10
10
  # @param [Hash, Optional] The headers for the HTTP Request.
11
11
  # @param [Hash, Optional] The parameters for the HTTP Request.
12
- # @param [String, Optional] Username for Basic Auth requests.
13
- # @param [String, Optional] Password for Basic Auth requests.
14
12
  def initialize(http_method,
15
13
  query_url,
16
- headers: nil,
17
- parameters: nil,
18
- username: nil,
19
- password: nil)
14
+ headers: {},
15
+ parameters: {})
20
16
  @http_method = http_method
21
17
  @query_url = query_url
22
18
  @headers = headers
23
19
  @parameters = parameters
24
- @username = username
25
- @password = password
20
+ end
21
+
22
+ # Add a header to the HttpRequest.
23
+ # @param [String] The name of the header.
24
+ # @param [String] The value of the header.
25
+ def add_header(name, value)
26
+ @headers[name] = value
27
+ end
28
+
29
+ # Add a parameter to the HttpRequest.
30
+ # @param [String] The name of the parameter.
31
+ # @param [String] The value of the parameter.
32
+ def add_parameter(name, value)
33
+ @parameters[name] = value
34
+ end
35
+
36
+ # Add a query parameter to the HttpRequest.
37
+ # @param [String] The name of the query parameter.
38
+ # @param [String] The value of the query parameter.
39
+ def add_query_parameter(name, value)
40
+ @query_url = APIHelper.append_url_with_query_parameters(@query_url, {name => value})
41
+ @query_url = APIHelper.clean_url(@query_url)
26
42
  end
27
43
  end
28
44
  end
@@ -0,0 +1,58 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class ActionsResponse < BaseModel
5
+ # The number of actions in the response.
6
+ # @return [Long]
7
+ attr_accessor :count
8
+
9
+ # The total number of actions.
10
+ # @return [Long]
11
+ attr_accessor :total_count
12
+
13
+ # The total number of actions.
14
+ # @return [List of Action]
15
+ attr_accessor :actions
16
+
17
+ # A mapping from model property names to API property names
18
+ def self.names
19
+ if @hash.nil?
20
+ @hash = {}
21
+ @hash["count"] = "count"
22
+ @hash["total_count"] = "total_count"
23
+ @hash["actions"] = "actions"
24
+ end
25
+ @hash
26
+ end
27
+
28
+ def initialize(count = nil,
29
+ total_count = nil,
30
+ actions = nil)
31
+ @count = count
32
+ @total_count = total_count
33
+ @actions = actions
34
+ end
35
+
36
+ # Creates an instance of the object from a hash
37
+ def self.from_hash(hash)
38
+ if hash == nil
39
+ nil
40
+ else
41
+ # Extract variables from the hash
42
+ count = hash["count"]
43
+ total_count = hash["total_count"]
44
+ # Parameter is an array, so we need to iterate through it
45
+ actions = nil
46
+ if hash["actions"] != nil
47
+ actions = Array.new
48
+ hash["actions"].each{|structure| actions << (Action.from_hash(structure) if structure)}
49
+ end
50
+
51
+ # Create object from extracted values
52
+ ActionsResponse.new(count,
53
+ total_count,
54
+ actions)
55
+ end
56
+ end
57
+ end
58
+ end
@@ -1,7 +1,7 @@
1
1
  # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
2
 
3
3
  module SuggestGrid
4
- class SchemaErrorResponse < BaseModel
4
+ class BulkPostError < BaseModel
5
5
  # Message of the response.
6
6
  # @return [String]
7
7
  attr_accessor :message
@@ -44,9 +44,9 @@ module SuggestGrid
44
44
  error = hash["error"]
45
45
 
46
46
  # Create object from extracted values
47
- SchemaErrorResponse.new(message,
48
- value,
49
- error)
47
+ BulkPostError.new(message,
48
+ value,
49
+ error)
50
50
  end
51
51
  end
52
52
  end
@@ -0,0 +1,49 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class BulkPostResponse < BaseModel
5
+ # Message of the response.
6
+ # @return [String]
7
+ attr_accessor :message
8
+
9
+ # Message of the response.
10
+ # @return [List of BulkPostError]
11
+ attr_accessor :errors
12
+
13
+ # A mapping from model property names to API property names
14
+ def self.names
15
+ if @hash.nil?
16
+ @hash = {}
17
+ @hash["message"] = "message"
18
+ @hash["errors"] = "errors"
19
+ end
20
+ @hash
21
+ end
22
+
23
+ def initialize(message = nil,
24
+ errors = nil)
25
+ @message = message
26
+ @errors = errors
27
+ end
28
+
29
+ # Creates an instance of the object from a hash
30
+ def self.from_hash(hash)
31
+ if hash == nil
32
+ nil
33
+ else
34
+ # Extract variables from the hash
35
+ message = hash["message"]
36
+ # Parameter is an array, so we need to iterate through it
37
+ errors = nil
38
+ if hash["errors"] != nil
39
+ errors = Array.new
40
+ hash["errors"].each{|structure| errors << (BulkPostError.from_hash(structure) if structure)}
41
+ end
42
+
43
+ # Create object from extracted values
44
+ BulkPostResponse.new(message,
45
+ errors)
46
+ end
47
+ end
48
+ end
49
+ end
@@ -18,7 +18,11 @@ module SuggestGrid
18
18
  # @return [List of String]
19
19
  attr_accessor :user_ids
20
20
 
21
- # The number of users asked to return in the response.
21
+ # The number of most recommended items to be skipped.
22
+ # @return [Integer]
23
+ attr_accessor :from
24
+
25
+ # The number of items asked to return in the response.
22
26
  # @return [Integer]
23
27
  attr_accessor :size
24
28
 
@@ -31,16 +35,16 @@ module SuggestGrid
31
35
  # @return [String]
32
36
  attr_accessor :similar_item_ids
33
37
 
34
- # The metadata fields that are to be included in returned users.
38
+ # The metadata fields that are to be included in returned items.
35
39
  # @return [List of String]
36
40
  attr_accessor :fields
37
41
 
38
- # Contraints on the returned users or items.
39
- # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/concepts#filters-parameter).
42
+ # Contraints on the returned users or items.
43
+ # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/advanced-features#filters-parameter).
40
44
  # @return [Object]
41
45
  attr_accessor :filter
42
46
 
43
- # These user ids that will not be included in the response.
47
+ # These item ids that will not be included in the response.
44
48
  # @return [List of String]
45
49
  attr_accessor :except
46
50
 
@@ -52,6 +56,7 @@ module SuggestGrid
52
56
  @hash["types"] = "types"
53
57
  @hash["user_id"] = "user_id"
54
58
  @hash["user_ids"] = "user_ids"
59
+ @hash["from"] = "from"
55
60
  @hash["size"] = "size"
56
61
  @hash["similar_item_id"] = "similar_item_id"
57
62
  @hash["similar_item_ids"] = "similar_item_ids"
@@ -66,6 +71,7 @@ module SuggestGrid
66
71
  types = nil,
67
72
  user_id = nil,
68
73
  user_ids = nil,
74
+ from = nil,
69
75
  size = nil,
70
76
  similar_item_id = nil,
71
77
  similar_item_ids = nil,
@@ -76,6 +82,7 @@ module SuggestGrid
76
82
  @types = types
77
83
  @user_id = user_id
78
84
  @user_ids = user_ids
85
+ @from = from
79
86
  @size = size
80
87
  @similar_item_id = similar_item_id
81
88
  @similar_item_ids = similar_item_ids
@@ -94,6 +101,7 @@ module SuggestGrid
94
101
  types = hash["types"]
95
102
  user_id = hash["user_id"]
96
103
  user_ids = hash["user_ids"]
104
+ from = hash["from"]
97
105
  size = hash["size"]
98
106
  similar_item_id = hash["similar_item_id"]
99
107
  similar_item_ids = hash["similar_item_ids"]
@@ -106,6 +114,7 @@ module SuggestGrid
106
114
  types,
107
115
  user_id,
108
116
  user_ids,
117
+ from,
109
118
  size,
110
119
  similar_item_id,
111
120
  similar_item_ids,
@@ -18,6 +18,10 @@ module SuggestGrid
18
18
  # @return [List of String]
19
19
  attr_accessor :item_ids
20
20
 
21
+ # The number of most recommended items to be skipped.
22
+ # @return [Integer]
23
+ attr_accessor :from
24
+
21
25
  # The number of users asked to return in the response.
22
26
  # @return [Integer]
23
27
  attr_accessor :size
@@ -35,8 +39,8 @@ module SuggestGrid
35
39
  # @return [List of String]
36
40
  attr_accessor :fields
37
41
 
38
- # Contraints on the returned users or items.
39
- # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/concepts#filters-parameter).
42
+ # Contraints on the returned users or items.
43
+ # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/advanced-features#filters-parameter).
40
44
  # @return [Object]
41
45
  attr_accessor :filter
42
46
 
@@ -52,6 +56,7 @@ module SuggestGrid
52
56
  @hash["types"] = "types"
53
57
  @hash["item_id"] = "item_id"
54
58
  @hash["item_ids"] = "item_ids"
59
+ @hash["from"] = "from"
55
60
  @hash["size"] = "size"
56
61
  @hash["similar_user_id"] = "similar_user_id"
57
62
  @hash["similar_user_ids"] = "similar_user_ids"
@@ -66,6 +71,7 @@ module SuggestGrid
66
71
  types = nil,
67
72
  item_id = nil,
68
73
  item_ids = nil,
74
+ from = nil,
69
75
  size = nil,
70
76
  similar_user_id = nil,
71
77
  similar_user_ids = nil,
@@ -76,6 +82,7 @@ module SuggestGrid
76
82
  @types = types
77
83
  @item_id = item_id
78
84
  @item_ids = item_ids
85
+ @from = from
79
86
  @size = size
80
87
  @similar_user_id = similar_user_id
81
88
  @similar_user_ids = similar_user_ids
@@ -94,6 +101,7 @@ module SuggestGrid
94
101
  types = hash["types"]
95
102
  item_id = hash["item_id"]
96
103
  item_ids = hash["item_ids"]
104
+ from = hash["from"]
97
105
  size = hash["size"]
98
106
  similar_user_id = hash["similar_user_id"]
99
107
  similar_user_ids = hash["similar_user_ids"]
@@ -106,6 +114,7 @@ module SuggestGrid
106
114
  types,
107
115
  item_id,
108
116
  item_ids,
117
+ from,
109
118
  size,
110
119
  similar_user_id,
111
120
  similar_user_ids,
@@ -18,20 +18,24 @@ module SuggestGrid
18
18
  # @return [List of String]
19
19
  attr_accessor :item_ids
20
20
 
21
- # The number of users asked to return in the response.
21
+ # The number of most similar items to be skipped.
22
+ # @return [Integer]
23
+ attr_accessor :from
24
+
25
+ # The number of items asked to return in the response.
22
26
  # @return [Integer]
23
27
  attr_accessor :size
24
28
 
25
- # The metadata fields that are to be included in returned users.
29
+ # The metadata fields that are to be included in returned items.
26
30
  # @return [List of String]
27
31
  attr_accessor :fields
28
32
 
29
- # Contraints on the returned users or items.
30
- # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/concepts#filters-parameter).
33
+ # Contraints on the returned users or items.
34
+ # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/advanced-features#filters-parameter).
31
35
  # @return [Object]
32
36
  attr_accessor :filter
33
37
 
34
- # These user ids that will not be included in the response.
38
+ # These item ids that will not be included in the response.
35
39
  # @return [List of String]
36
40
  attr_accessor :except
37
41
 
@@ -43,6 +47,7 @@ module SuggestGrid
43
47
  @hash["types"] = "types"
44
48
  @hash["item_id"] = "item_id"
45
49
  @hash["item_ids"] = "item_ids"
50
+ @hash["from"] = "from"
46
51
  @hash["size"] = "size"
47
52
  @hash["fields"] = "fields"
48
53
  @hash["filter"] = "filter"
@@ -55,6 +60,7 @@ module SuggestGrid
55
60
  types = nil,
56
61
  item_id = nil,
57
62
  item_ids = nil,
63
+ from = nil,
58
64
  size = nil,
59
65
  fields = nil,
60
66
  filter = nil,
@@ -63,6 +69,7 @@ module SuggestGrid
63
69
  @types = types
64
70
  @item_id = item_id
65
71
  @item_ids = item_ids
72
+ @from = from
66
73
  @size = size
67
74
  @fields = fields
68
75
  @filter = filter
@@ -79,6 +86,7 @@ module SuggestGrid
79
86
  types = hash["types"]
80
87
  item_id = hash["item_id"]
81
88
  item_ids = hash["item_ids"]
89
+ from = hash["from"]
82
90
  size = hash["size"]
83
91
  fields = hash["fields"]
84
92
  filter = hash["filter"]
@@ -89,6 +97,7 @@ module SuggestGrid
89
97
  types,
90
98
  item_id,
91
99
  item_ids,
100
+ from,
92
101
  size,
93
102
  fields,
94
103
  filter,
@@ -18,6 +18,10 @@ module SuggestGrid
18
18
  # @return [List of String]
19
19
  attr_accessor :user_ids
20
20
 
21
+ # The number of most similar users to be skipped.
22
+ # @return [Integer]
23
+ attr_accessor :from
24
+
21
25
  # The number of users asked to return in the response.
22
26
  # @return [Integer]
23
27
  attr_accessor :size
@@ -26,8 +30,8 @@ module SuggestGrid
26
30
  # @return [List of String]
27
31
  attr_accessor :fields
28
32
 
29
- # Contraints on the returned users or items.
30
- # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/concepts#filters-parameter).
33
+ # Contraints on the returned users or items.
34
+ # Filter structure is defined in [the filter parameter documentation](http://www.suggestgrid.com/docs/advanced-features#filters-parameter).
31
35
  # @return [Object]
32
36
  attr_accessor :filter
33
37
 
@@ -43,6 +47,7 @@ module SuggestGrid
43
47
  @hash["types"] = "types"
44
48
  @hash["user_id"] = "user_id"
45
49
  @hash["user_ids"] = "user_ids"
50
+ @hash["from"] = "from"
46
51
  @hash["size"] = "size"
47
52
  @hash["fields"] = "fields"
48
53
  @hash["filter"] = "filter"
@@ -55,6 +60,7 @@ module SuggestGrid
55
60
  types = nil,
56
61
  user_id = nil,
57
62
  user_ids = nil,
63
+ from = nil,
58
64
  size = nil,
59
65
  fields = nil,
60
66
  filter = nil,
@@ -63,6 +69,7 @@ module SuggestGrid
63
69
  @types = types
64
70
  @user_id = user_id
65
71
  @user_ids = user_ids
72
+ @from = from
66
73
  @size = size
67
74
  @fields = fields
68
75
  @filter = filter
@@ -79,6 +86,7 @@ module SuggestGrid
79
86
  types = hash["types"]
80
87
  user_id = hash["user_id"]
81
88
  user_ids = hash["user_ids"]
89
+ from = hash["from"]
82
90
  size = hash["size"]
83
91
  fields = hash["fields"]
84
92
  filter = hash["filter"]
@@ -89,6 +97,7 @@ module SuggestGrid
89
97
  types,
90
98
  user_id,
91
99
  user_ids,
100
+ from,
92
101
  size,
93
102
  fields,
94
103
  filter,
@@ -6,7 +6,11 @@ module SuggestGrid
6
6
  # @return [Long]
7
7
  attr_accessor :count
8
8
 
9
- # The number of items in the response.
9
+ # The total number of items available.
10
+ # @return [Long]
11
+ attr_accessor :total_count
12
+
13
+ # The total number of items available.
10
14
  # @return [List of Metadata]
11
15
  attr_accessor :items
12
16
 
@@ -15,14 +19,17 @@ module SuggestGrid
15
19
  if @hash.nil?
16
20
  @hash = {}
17
21
  @hash["count"] = "count"
22
+ @hash["total_count"] = "total_count"
18
23
  @hash["items"] = "items"
19
24
  end
20
25
  @hash
21
26
  end
22
27
 
23
28
  def initialize(count = nil,
29
+ total_count = nil,
24
30
  items = nil)
25
31
  @count = count
32
+ @total_count = total_count
26
33
  @items = items
27
34
  end
28
35
 
@@ -33,6 +40,7 @@ module SuggestGrid
33
40
  else
34
41
  # Extract variables from the hash
35
42
  count = hash["count"]
43
+ total_count = hash["total_count"]
36
44
  # Parameter is an array, so we need to iterate through it
37
45
  items = nil
38
46
  if hash["items"] != nil
@@ -42,6 +50,7 @@ module SuggestGrid
42
50
 
43
51
  # Create object from extracted values
44
52
  ItemsResponse.new(count,
53
+ total_count,
45
54
  items)
46
55
  end
47
56
  end