suggestgrid 0.1.15.pre.SNAPSHOT → 0.1.17.pre.SNAPSHOT

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/suggest_grid/api_helper.rb +2 -2
  4. data/lib/suggest_grid/configuration.rb +1 -1
  5. data/lib/suggest_grid/controllers/action_controller.rb +24 -18
  6. data/lib/suggest_grid/controllers/metadata_controller.rb +36 -32
  7. data/lib/suggest_grid/controllers/recommendation_controller.rb +12 -12
  8. data/lib/suggest_grid/controllers/similarity_controller.rb +12 -12
  9. data/lib/suggest_grid/controllers/type_controller.rb +12 -12
  10. data/lib/suggest_grid/exceptions/bulk_schema_error_response_exception.rb +37 -0
  11. data/lib/suggest_grid/exceptions/detailed_error_response_exception.rb +42 -0
  12. data/lib/suggest_grid/exceptions/error_response_exception.rb +37 -0
  13. data/lib/suggest_grid/exceptions/limit_exceeded_error_response_exception.rb +47 -0
  14. data/lib/suggest_grid/models/action.rb +15 -19
  15. data/lib/suggest_grid/models/base_model.rb +32 -0
  16. data/lib/suggest_grid/models/count_response.rb +12 -16
  17. data/lib/suggest_grid/models/delete_error_response.rb +80 -0
  18. data/lib/suggest_grid/models/delete_success_response.rb +62 -0
  19. data/lib/suggest_grid/models/get_recommended_items_body.rb +39 -32
  20. data/lib/suggest_grid/models/get_recommended_users_body.rb +39 -32
  21. data/lib/suggest_grid/models/get_similar_items_body.rb +27 -30
  22. data/lib/suggest_grid/models/get_similar_users_body.rb +27 -30
  23. data/lib/suggest_grid/models/get_type_response.rb +12 -16
  24. data/lib/suggest_grid/models/get_types_response.rb +12 -16
  25. data/lib/suggest_grid/models/items_response.rb +12 -16
  26. data/lib/suggest_grid/models/message_response.rb +11 -15
  27. data/lib/suggest_grid/models/metadata.rb +34 -39
  28. data/lib/suggest_grid/models/metadata_information_response.rb +11 -15
  29. data/lib/suggest_grid/models/schema_error_response.rb +13 -17
  30. data/lib/suggest_grid/models/type_request_body.rb +12 -15
  31. data/lib/suggest_grid/models/users_response.rb +12 -16
  32. data/lib/suggest_grid.rb +7 -2
  33. data/spec/swagger.yaml +235 -121
  34. metadata +10 -5
  35. data/lib/suggest_grid/models/bulk_schema_error_response.rb +0 -53
  36. data/lib/suggest_grid/models/error_response.rb +0 -48
@@ -0,0 +1,42 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class DetailedErrorResponseException < APIException
5
+ # Message of the response.
6
+ # @return [String]
7
+ attr_accessor :error_text
8
+
9
+ # Description of the response.
10
+ # @return [String]
11
+ attr_accessor :error_description
12
+
13
+ # URI of the response for more details.
14
+ # @return [String]
15
+ attr_accessor :error_uri
16
+
17
+ # Specific details of the response.
18
+ # @return [String]
19
+ attr_accessor :error_details
20
+
21
+ # The constructor.
22
+ # @param [String] The reason for raising an exception
23
+ # @param [HttpContext] The HttpContext of the API call.
24
+ def initialize(reason, context)
25
+ super(reason, context)
26
+ begin
27
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
28
+ unbox(hash)
29
+ rescue TypeError
30
+ end
31
+ end
32
+
33
+ # Populates this object by extracting properties from a hash.
34
+ # @param [Hash] The deserialized response sent by the server in the response body.
35
+ def unbox(hash)
36
+ @error_text = hash["error_text"]
37
+ @error_description = hash["error_description"]
38
+ @error_uri = hash["error_uri"]
39
+ @error_details = hash["error_details"]
40
+ end
41
+ end
42
+ 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 ErrorResponseException < APIException
5
+ # Message of the response.
6
+ # @return [String]
7
+ attr_accessor :error_text
8
+
9
+ # Description of the response.
10
+ # @return [String]
11
+ attr_accessor :error_description
12
+
13
+ # URI of the response for more details.
14
+ # @return [String]
15
+ attr_accessor :error_uri
16
+
17
+ # The constructor.
18
+ # @param [String] The reason for raising an exception
19
+ # @param [HttpContext] The HttpContext of the API call.
20
+ def initialize(reason, context)
21
+ super(reason, context)
22
+ begin
23
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
24
+ unbox(hash)
25
+ rescue TypeError
26
+ end
27
+ end
28
+
29
+ # Populates this object by extracting properties from a hash.
30
+ # @param [Hash] The deserialized response sent by the server in the response body.
31
+ def unbox(hash)
32
+ @error_text = hash["error_text"]
33
+ @error_description = hash["error_description"]
34
+ @error_uri = hash["error_uri"]
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,47 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class LimitExceededErrorResponseException < APIException
5
+ # Message of the response.
6
+ # @return [String]
7
+ attr_accessor :error_text
8
+
9
+ # Description of the response.
10
+ # @return [String]
11
+ attr_accessor :error_description
12
+
13
+ # URI of the response for more details.
14
+ # @return [String]
15
+ attr_accessor :error_uri
16
+
17
+ # The quantity used by the account.
18
+ # @return [Integer]
19
+ attr_accessor :used
20
+
21
+ # The limit quantity of the account.
22
+ # @return [Integer]
23
+ attr_accessor :limit
24
+
25
+ # The constructor.
26
+ # @param [String] The reason for raising an exception
27
+ # @param [HttpContext] The HttpContext of the API call.
28
+ def initialize(reason, context)
29
+ super(reason, context)
30
+ begin
31
+ hash = APIHelper.json_deserialize(@context.response.raw_body)
32
+ unbox(hash)
33
+ rescue TypeError
34
+ end
35
+ end
36
+
37
+ # Populates this object by extracting properties from a hash.
38
+ # @param [Hash] The deserialized response sent by the server in the response body.
39
+ def unbox(hash)
40
+ @error_text = hash["error_text"]
41
+ @error_description = hash["error_description"]
42
+ @error_uri = hash["error_uri"]
43
+ @used = hash["used"]
44
+ @limit = hash["limit"]
45
+ end
46
+ end
47
+ 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 Action
4
+ class Action < BaseModel
5
5
  # The type that the action belongs to.
6
6
  # @return [String]
7
7
  attr_accessor :type
@@ -14,10 +14,22 @@ module SuggestGrid
14
14
  # @return [String]
15
15
  attr_accessor :item_id
16
16
 
17
- # The optional rating, if the type is explicit.
17
+ # The optional rating given by the user, if the type is explicit.
18
18
  # @return [Float]
19
19
  attr_accessor :rating
20
20
 
21
+ # A mapping from model property names to API property names
22
+ def self.names
23
+ if @hash.nil?
24
+ @hash = {}
25
+ @hash["type"] = "type"
26
+ @hash["user_id"] = "user_id"
27
+ @hash["item_id"] = "item_id"
28
+ @hash["rating"] = "rating"
29
+ end
30
+ @hash
31
+ end
32
+
21
33
  def initialize(type = nil,
22
34
  user_id = nil,
23
35
  item_id = nil,
@@ -26,13 +38,6 @@ module SuggestGrid
26
38
  @user_id = user_id
27
39
  @item_id = item_id
28
40
  @rating = rating
29
-
30
- end
31
-
32
- # Creates JSON of the curent object
33
- def to_json(options = {})
34
- hash = key_map
35
- hash.to_json(options)
36
41
  end
37
42
 
38
43
  # Creates an instance of the object from a hash
@@ -45,6 +50,7 @@ module SuggestGrid
45
50
  user_id = hash["user_id"]
46
51
  item_id = hash["item_id"]
47
52
  rating = hash["rating"]
53
+
48
54
  # Create object from extracted values
49
55
  Action.new(type,
50
56
  user_id,
@@ -52,15 +58,5 @@ module SuggestGrid
52
58
  rating)
53
59
  end
54
60
  end
55
-
56
- # Defines the key map for json serialization
57
- def key_map
58
- hash = {}
59
- hash['type'] = type
60
- hash['user_id'] = user_id
61
- hash['item_id'] = item_id
62
- hash['rating'] = rating
63
- hash
64
- end
65
61
  end
66
62
  end
@@ -0,0 +1,32 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class BaseModel
5
+ # Returns a Hash representation of the current object
6
+ def to_hash
7
+ hash = {}
8
+ self.instance_variables.each do |name|
9
+ value = self.instance_variable_get(name)
10
+ name = name[1..-1]
11
+ key = self.class.names.key?(name) ? self.class.names[name] : name
12
+ if value.instance_of? Array
13
+ hash[key] = value.map{|v| v.kind_of?(BaseModel) ? v.to_hash : v}
14
+ elsif value.instance_of? Hash
15
+ hash[key] = {}
16
+ value.each do |k, v|
17
+ hash[key][k] = v.kind_of?(BaseModel) ? v.to_hash : v
18
+ end
19
+ else
20
+ hash[key] = value.kind_of?(BaseModel) ? value.to_hash : value
21
+ end
22
+ end
23
+ hash
24
+ end
25
+
26
+ # Returns a JSON representation of the curent object
27
+ def to_json(options = {})
28
+ hash = to_hash
29
+ hash.to_json(options)
30
+ end
31
+ end
32
+ end
@@ -1,20 +1,22 @@
1
1
  # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
2
 
3
3
  module SuggestGrid
4
- class CountResponse
5
- # TODO: Write general description for this method
4
+ class CountResponse < BaseModel
5
+ # The count that is asked in the query.
6
6
  # @return [Integer]
7
7
  attr_accessor :count
8
8
 
9
- def initialize(count = nil)
10
- @count = count
11
-
9
+ # A mapping from model property names to API property names
10
+ def self.names
11
+ if @hash.nil?
12
+ @hash = {}
13
+ @hash["count"] = "count"
14
+ end
15
+ @hash
12
16
  end
13
17
 
14
- # Creates JSON of the curent object
15
- def to_json(options = {})
16
- hash = key_map
17
- hash.to_json(options)
18
+ def initialize(count = nil)
19
+ @count = count
18
20
  end
19
21
 
20
22
  # Creates an instance of the object from a hash
@@ -24,16 +26,10 @@ module SuggestGrid
24
26
  else
25
27
  # Extract variables from the hash
26
28
  count = hash["count"]
29
+
27
30
  # Create object from extracted values
28
31
  CountResponse.new(count)
29
32
  end
30
33
  end
31
-
32
- # Defines the key map for json serialization
33
- def key_map
34
- hash = {}
35
- hash['count'] = count
36
- hash
37
- end
38
34
  end
39
35
  end
@@ -0,0 +1,80 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class DeleteErrorResponse < BaseModel
5
+ # Message of the response.
6
+ # @return [String]
7
+ attr_accessor :error_text
8
+
9
+ # Description of the response.
10
+ # @return [String]
11
+ attr_accessor :error_description
12
+
13
+ # URI of the response for more details.
14
+ # @return [String]
15
+ attr_accessor :error_uri
16
+
17
+ # The number of records found for the delete query.
18
+ # @return [Integer]
19
+ attr_accessor :found
20
+
21
+ # The number of records deleted for the delete query.
22
+ # @return [Integer]
23
+ attr_accessor :deleted
24
+
25
+ # The number of records found but not deleted for the delete query.
26
+ # @return [Integer]
27
+ attr_accessor :failed
28
+
29
+ # A mapping from model property names to API property names
30
+ def self.names
31
+ if @hash.nil?
32
+ @hash = {}
33
+ @hash["error_text"] = "error_text"
34
+ @hash["error_description"] = "error_description"
35
+ @hash["error_uri"] = "error_uri"
36
+ @hash["found"] = "found"
37
+ @hash["deleted"] = "deleted"
38
+ @hash["failed"] = "failed"
39
+ end
40
+ @hash
41
+ end
42
+
43
+ def initialize(error_text = nil,
44
+ error_description = nil,
45
+ error_uri = nil,
46
+ found = nil,
47
+ deleted = nil,
48
+ failed = nil)
49
+ @error_text = error_text
50
+ @error_description = error_description
51
+ @error_uri = error_uri
52
+ @found = found
53
+ @deleted = deleted
54
+ @failed = failed
55
+ end
56
+
57
+ # Creates an instance of the object from a hash
58
+ def self.from_hash(hash)
59
+ if hash == nil
60
+ nil
61
+ else
62
+ # Extract variables from the hash
63
+ error_text = hash["error_text"]
64
+ error_description = hash["error_description"]
65
+ error_uri = hash["error_uri"]
66
+ found = hash["found"]
67
+ deleted = hash["deleted"]
68
+ failed = hash["failed"]
69
+
70
+ # Create object from extracted values
71
+ DeleteErrorResponse.new(error_text,
72
+ error_description,
73
+ error_uri,
74
+ found,
75
+ deleted,
76
+ failed)
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,62 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class DeleteSuccessResponse < BaseModel
5
+ # Message of the response.
6
+ # @return [String]
7
+ attr_accessor :message
8
+
9
+ # The number of records found for the delete query.
10
+ # @return [Integer]
11
+ attr_accessor :found
12
+
13
+ # The number of records deleted for the delete query.
14
+ # @return [Integer]
15
+ attr_accessor :deleted
16
+
17
+ # The number of records found but not deleted for the delete query.
18
+ # @return [Integer]
19
+ attr_accessor :failed
20
+
21
+ # A mapping from model property names to API property names
22
+ def self.names
23
+ if @hash.nil?
24
+ @hash = {}
25
+ @hash["message"] = "message"
26
+ @hash["found"] = "found"
27
+ @hash["deleted"] = "deleted"
28
+ @hash["failed"] = "failed"
29
+ end
30
+ @hash
31
+ end
32
+
33
+ def initialize(message = nil,
34
+ found = nil,
35
+ deleted = nil,
36
+ failed = nil)
37
+ @message = message
38
+ @found = found
39
+ @deleted = deleted
40
+ @failed = failed
41
+ end
42
+
43
+ # Creates an instance of the object from a hash
44
+ def self.from_hash(hash)
45
+ if hash == nil
46
+ nil
47
+ else
48
+ # Extract variables from the hash
49
+ message = hash["message"]
50
+ found = hash["found"]
51
+ deleted = hash["deleted"]
52
+ failed = hash["failed"]
53
+
54
+ # Create object from extracted values
55
+ DeleteSuccessResponse.new(message,
56
+ found,
57
+ deleted,
58
+ failed)
59
+ end
60
+ end
61
+ end
62
+ end
@@ -1,49 +1,74 @@
1
1
  # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
2
 
3
3
  module SuggestGrid
4
- class GetRecommendedItemsBody
5
- # TODO: Write general description for this method
4
+ class GetRecommendedItemsBody < BaseModel
5
+ # The type of the query.
6
6
  # @return [String]
7
7
  attr_accessor :type
8
8
 
9
- # TODO: Write general description for this method
9
+ # The types of the query. Exactly one of type or types parameters must be provided.
10
10
  # @return [String]
11
11
  attr_accessor :types
12
12
 
13
- # TODO: Write general description for this method
13
+ # The user id of the query.
14
14
  # @return [String]
15
15
  attr_accessor :user_id
16
16
 
17
- # TODO: Write general description for this method
17
+ # The user ids of the query. Exactly one of user id or user ids parameters must be provided.
18
18
  # @return [List of String]
19
19
  attr_accessor :user_ids
20
20
 
21
- # TODO: Write general description for this method
21
+ # The number of users asked to return in the response.
22
22
  # @return [Integer]
23
23
  attr_accessor :size
24
24
 
25
- # TODO: Write general description for this method
25
+ # Similar item that the response should be similar to.
26
26
  # @return [String]
27
27
  attr_accessor :similar_item_id
28
28
 
29
- # TODO: Write general description for this method
29
+ # Similar items that the response should be similar to.
30
+ # At most one of similar item and similar items parameters can be provided.
31
+ # @return [String]
32
+ attr_accessor :similar_item_ids
33
+
34
+ # The metadata fields that are to be included in returned users.
30
35
  # @return [List of String]
31
36
  attr_accessor :fields
32
37
 
33
- # TODO: Write general description for this method
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).
34
40
  # @return [Object]
35
41
  attr_accessor :filter
36
42
 
37
- # These ids will not be included in the response.
43
+ # These user ids that will not be included in the response.
38
44
  # @return [List of String]
39
45
  attr_accessor :except
40
46
 
47
+ # A mapping from model property names to API property names
48
+ def self.names
49
+ if @hash.nil?
50
+ @hash = {}
51
+ @hash["type"] = "type"
52
+ @hash["types"] = "types"
53
+ @hash["user_id"] = "user_id"
54
+ @hash["user_ids"] = "user_ids"
55
+ @hash["size"] = "size"
56
+ @hash["similar_item_id"] = "similar_item_id"
57
+ @hash["similar_item_ids"] = "similar_item_ids"
58
+ @hash["fields"] = "fields"
59
+ @hash["filter"] = "filter"
60
+ @hash["except"] = "except"
61
+ end
62
+ @hash
63
+ end
64
+
41
65
  def initialize(type = nil,
42
66
  types = nil,
43
67
  user_id = nil,
44
68
  user_ids = nil,
45
69
  size = nil,
46
70
  similar_item_id = nil,
71
+ similar_item_ids = nil,
47
72
  fields = nil,
48
73
  filter = nil,
49
74
  except = nil)
@@ -53,16 +78,10 @@ module SuggestGrid
53
78
  @user_ids = user_ids
54
79
  @size = size
55
80
  @similar_item_id = similar_item_id
81
+ @similar_item_ids = similar_item_ids
56
82
  @fields = fields
57
83
  @filter = filter
58
84
  @except = except
59
-
60
- end
61
-
62
- # Creates JSON of the curent object
63
- def to_json(options = {})
64
- hash = key_map
65
- hash.to_json(options)
66
85
  end
67
86
 
68
87
  # Creates an instance of the object from a hash
@@ -77,9 +96,11 @@ module SuggestGrid
77
96
  user_ids = hash["user_ids"]
78
97
  size = hash["size"]
79
98
  similar_item_id = hash["similar_item_id"]
99
+ similar_item_ids = hash["similar_item_ids"]
80
100
  fields = hash["fields"]
81
101
  filter = hash["filter"]
82
102
  except = hash["except"]
103
+
83
104
  # Create object from extracted values
84
105
  GetRecommendedItemsBody.new(type,
85
106
  types,
@@ -87,25 +108,11 @@ module SuggestGrid
87
108
  user_ids,
88
109
  size,
89
110
  similar_item_id,
111
+ similar_item_ids,
90
112
  fields,
91
113
  filter,
92
114
  except)
93
115
  end
94
116
  end
95
-
96
- # Defines the key map for json serialization
97
- def key_map
98
- hash = {}
99
- hash['type'] = type
100
- hash['types'] = types
101
- hash['user_id'] = user_id
102
- hash['user_ids'] = user_ids
103
- hash['size'] = size
104
- hash['similar_item_id'] = similar_item_id
105
- hash['fields'] = fields
106
- hash['filter'] = filter
107
- hash['except'] = except
108
- hash
109
- end
110
117
  end
111
118
  end