suggestgrid 0.1.15.pre.SNAPSHOT

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +104 -0
  4. data/lib/suggest_grid/api_helper.rb +151 -0
  5. data/lib/suggest_grid/configuration.rb +21 -0
  6. data/lib/suggest_grid/controllers/action_controller.rb +257 -0
  7. data/lib/suggest_grid/controllers/base_controller.rb +20 -0
  8. data/lib/suggest_grid/controllers/metadata_controller.rb +527 -0
  9. data/lib/suggest_grid/controllers/recommendation_controller.rb +119 -0
  10. data/lib/suggest_grid/controllers/similarity_controller.rb +119 -0
  11. data/lib/suggest_grid/controllers/type_controller.rb +280 -0
  12. data/lib/suggest_grid/exceptions/api_exception.rb +16 -0
  13. data/lib/suggest_grid/http/http_call_back.rb +17 -0
  14. data/lib/suggest_grid/http/http_client.rb +112 -0
  15. data/lib/suggest_grid/http/http_context.rb +15 -0
  16. data/lib/suggest_grid/http/http_method_enum.rb +7 -0
  17. data/lib/suggest_grid/http/http_request.rb +28 -0
  18. data/lib/suggest_grid/http/http_response.rb +19 -0
  19. data/lib/suggest_grid/http/unirest_client.rb +41 -0
  20. data/lib/suggest_grid/models/action.rb +66 -0
  21. data/lib/suggest_grid/models/bulk_schema_error_response.rb +53 -0
  22. data/lib/suggest_grid/models/count_response.rb +39 -0
  23. data/lib/suggest_grid/models/error_response.rb +48 -0
  24. data/lib/suggest_grid/models/get_recommended_items_body.rb +111 -0
  25. data/lib/suggest_grid/models/get_recommended_users_body.rb +111 -0
  26. data/lib/suggest_grid/models/get_similar_items_body.rb +102 -0
  27. data/lib/suggest_grid/models/get_similar_users_body.rb +102 -0
  28. data/lib/suggest_grid/models/get_type_response.rb +39 -0
  29. data/lib/suggest_grid/models/get_types_response.rb +48 -0
  30. data/lib/suggest_grid/models/items_response.rb +53 -0
  31. data/lib/suggest_grid/models/message_response.rb +39 -0
  32. data/lib/suggest_grid/models/metadata.rb +39 -0
  33. data/lib/suggest_grid/models/metadata_information_response.rb +39 -0
  34. data/lib/suggest_grid/models/schema_error_response.rb +57 -0
  35. data/lib/suggest_grid/models/type_request_body.rb +40 -0
  36. data/lib/suggest_grid/models/users_response.rb +53 -0
  37. data/lib/suggest_grid/suggest_grid_client.rb +47 -0
  38. data/lib/suggest_grid.rb +48 -0
  39. data/spec/swagger.yaml +1169 -0
  40. metadata +123 -0
@@ -0,0 +1,66 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class Action
5
+ # The type that the action belongs to.
6
+ # @return [String]
7
+ attr_accessor :type
8
+
9
+ # The user id of the performer of the action.
10
+ # @return [String]
11
+ attr_accessor :user_id
12
+
13
+ # The item id of the item the action is performed on.
14
+ # @return [String]
15
+ attr_accessor :item_id
16
+
17
+ # The optional rating, if the type is explicit.
18
+ # @return [Float]
19
+ attr_accessor :rating
20
+
21
+ def initialize(type = nil,
22
+ user_id = nil,
23
+ item_id = nil,
24
+ rating = nil)
25
+ @type = type
26
+ @user_id = user_id
27
+ @item_id = item_id
28
+ @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
+ end
37
+
38
+ # Creates an instance of the object from a hash
39
+ def self.from_hash(hash)
40
+ if hash == nil
41
+ nil
42
+ else
43
+ # Extract variables from the hash
44
+ type = hash["type"]
45
+ user_id = hash["user_id"]
46
+ item_id = hash["item_id"]
47
+ rating = hash["rating"]
48
+ # Create object from extracted values
49
+ Action.new(type,
50
+ user_id,
51
+ item_id,
52
+ rating)
53
+ end
54
+ 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
+ end
66
+ end
@@ -0,0 +1,53 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class BulkSchemaErrorResponse
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
+ def initialize(message = nil,
14
+ errors = nil)
15
+ @message = message
16
+ @errors = errors
17
+
18
+ end
19
+
20
+ # Creates JSON of the curent object
21
+ def to_json(options = {})
22
+ hash = key_map
23
+ hash.to_json(options)
24
+ end
25
+
26
+ # Creates an instance of the object from a hash
27
+ def self.from_hash(hash)
28
+ if hash == nil
29
+ nil
30
+ else
31
+ # Extract variables from the hash
32
+ message = hash["message"]
33
+ # Parameter is an array, so we need to iterate through it
34
+ errors = nil
35
+ if hash["errors"] != nil
36
+ errors = Array.new
37
+ hash["errors"].each{|structure| errors << (SchemaErrorResponse.from_hash(structure) if structure)}
38
+ end
39
+ # Create object from extracted values
40
+ BulkSchemaErrorResponse.new(message,
41
+ errors)
42
+ end
43
+ end
44
+
45
+ # Defines the key map for json serialization
46
+ def key_map
47
+ hash = {}
48
+ hash['message'] = message
49
+ hash['errors'] = errors ? errors.map(&:key_map) : nil
50
+ hash
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,39 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class CountResponse
5
+ # TODO: Write general description for this method
6
+ # @return [Integer]
7
+ attr_accessor :count
8
+
9
+ def initialize(count = nil)
10
+ @count = count
11
+
12
+ end
13
+
14
+ # Creates JSON of the curent object
15
+ def to_json(options = {})
16
+ hash = key_map
17
+ hash.to_json(options)
18
+ end
19
+
20
+ # Creates an instance of the object from a hash
21
+ def self.from_hash(hash)
22
+ if hash == nil
23
+ nil
24
+ else
25
+ # Extract variables from the hash
26
+ count = hash["count"]
27
+ # Create object from extracted values
28
+ CountResponse.new(count)
29
+ end
30
+ 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
+ end
39
+ end
@@ -0,0 +1,48 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class ErrorResponse
5
+ # Message of the response.
6
+ # @return [String]
7
+ attr_accessor :message
8
+
9
+ # Status code of the response. It is not 2XX.
10
+ # @return [Integer]
11
+ attr_accessor :status
12
+
13
+ def initialize(message = nil,
14
+ status = nil)
15
+ @message = message
16
+ @status = status
17
+
18
+ end
19
+
20
+ # Creates JSON of the curent object
21
+ def to_json(options = {})
22
+ hash = key_map
23
+ hash.to_json(options)
24
+ end
25
+
26
+ # Creates an instance of the object from a hash
27
+ def self.from_hash(hash)
28
+ if hash == nil
29
+ nil
30
+ else
31
+ # Extract variables from the hash
32
+ message = hash["message"]
33
+ status = hash["status"]
34
+ # Create object from extracted values
35
+ ErrorResponse.new(message,
36
+ status)
37
+ end
38
+ end
39
+
40
+ # Defines the key map for json serialization
41
+ def key_map
42
+ hash = {}
43
+ hash['message'] = message
44
+ hash['status'] = status
45
+ hash
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,111 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class GetRecommendedItemsBody
5
+ # TODO: Write general description for this method
6
+ # @return [String]
7
+ attr_accessor :type
8
+
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :types
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :user_id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [List of String]
19
+ attr_accessor :user_ids
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Integer]
23
+ attr_accessor :size
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :similar_item_id
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [List of String]
31
+ attr_accessor :fields
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [Object]
35
+ attr_accessor :filter
36
+
37
+ # These ids will not be included in the response.
38
+ # @return [List of String]
39
+ attr_accessor :except
40
+
41
+ def initialize(type = nil,
42
+ types = nil,
43
+ user_id = nil,
44
+ user_ids = nil,
45
+ size = nil,
46
+ similar_item_id = nil,
47
+ fields = nil,
48
+ filter = nil,
49
+ except = nil)
50
+ @type = type
51
+ @types = types
52
+ @user_id = user_id
53
+ @user_ids = user_ids
54
+ @size = size
55
+ @similar_item_id = similar_item_id
56
+ @fields = fields
57
+ @filter = filter
58
+ @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
+ end
67
+
68
+ # Creates an instance of the object from a hash
69
+ def self.from_hash(hash)
70
+ if hash == nil
71
+ nil
72
+ else
73
+ # Extract variables from the hash
74
+ type = hash["type"]
75
+ types = hash["types"]
76
+ user_id = hash["user_id"]
77
+ user_ids = hash["user_ids"]
78
+ size = hash["size"]
79
+ similar_item_id = hash["similar_item_id"]
80
+ fields = hash["fields"]
81
+ filter = hash["filter"]
82
+ except = hash["except"]
83
+ # Create object from extracted values
84
+ GetRecommendedItemsBody.new(type,
85
+ types,
86
+ user_id,
87
+ user_ids,
88
+ size,
89
+ similar_item_id,
90
+ fields,
91
+ filter,
92
+ except)
93
+ end
94
+ 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
+ end
111
+ end
@@ -0,0 +1,111 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class GetRecommendedUsersBody
5
+ # TODO: Write general description for this method
6
+ # @return [String]
7
+ attr_accessor :type
8
+
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :types
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :item_id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [List of String]
19
+ attr_accessor :item_ids
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Integer]
23
+ attr_accessor :size
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :similar_user_id
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [List of String]
31
+ attr_accessor :fields
32
+
33
+ # TODO: Write general description for this method
34
+ # @return [Object]
35
+ attr_accessor :filter
36
+
37
+ # These ids will not be included in the response.
38
+ # @return [List of String]
39
+ attr_accessor :except
40
+
41
+ def initialize(type = nil,
42
+ types = nil,
43
+ item_id = nil,
44
+ item_ids = nil,
45
+ size = nil,
46
+ similar_user_id = nil,
47
+ fields = nil,
48
+ filter = nil,
49
+ except = nil)
50
+ @type = type
51
+ @types = types
52
+ @item_id = item_id
53
+ @item_ids = item_ids
54
+ @size = size
55
+ @similar_user_id = similar_user_id
56
+ @fields = fields
57
+ @filter = filter
58
+ @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
+ end
67
+
68
+ # Creates an instance of the object from a hash
69
+ def self.from_hash(hash)
70
+ if hash == nil
71
+ nil
72
+ else
73
+ # Extract variables from the hash
74
+ type = hash["type"]
75
+ types = hash["types"]
76
+ item_id = hash["item_id"]
77
+ item_ids = hash["item_ids"]
78
+ size = hash["size"]
79
+ similar_user_id = hash["similar_user_id"]
80
+ fields = hash["fields"]
81
+ filter = hash["filter"]
82
+ except = hash["except"]
83
+ # Create object from extracted values
84
+ GetRecommendedUsersBody.new(type,
85
+ types,
86
+ item_id,
87
+ item_ids,
88
+ size,
89
+ similar_user_id,
90
+ fields,
91
+ filter,
92
+ except)
93
+ end
94
+ 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['item_id'] = item_id
102
+ hash['item_ids'] = item_ids
103
+ hash['size'] = size
104
+ hash['similar_user_id'] = similar_user_id
105
+ hash['fields'] = fields
106
+ hash['filter'] = filter
107
+ hash['except'] = except
108
+ hash
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,102 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class GetSimilarItemsBody
5
+ # TODO: Write general description for this method
6
+ # @return [String]
7
+ attr_accessor :type
8
+
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :types
12
+
13
+ # Get similar items to given item id. Either item id or item ids must be provided.
14
+ # @return [String]
15
+ attr_accessor :item_id
16
+
17
+ # Get similar items to given item ids. Either item id or item ids must be provided.
18
+ # @return [List of String]
19
+ attr_accessor :item_ids
20
+
21
+ # Get similar items to given item ids. Either item id or item ids must be provided.
22
+ # @return [Integer]
23
+ attr_accessor :size
24
+
25
+ # Get similar items to given item ids. Either item id or item ids must be provided.
26
+ # @return [List of String]
27
+ attr_accessor :fields
28
+
29
+ # Get similar items to given item ids. Either item id or item ids must be provided.
30
+ # @return [Object]
31
+ attr_accessor :filter
32
+
33
+ # These ids will not be included in the response.
34
+ # @return [List of String]
35
+ attr_accessor :except
36
+
37
+ def initialize(type = nil,
38
+ types = nil,
39
+ item_id = nil,
40
+ item_ids = nil,
41
+ size = nil,
42
+ fields = nil,
43
+ filter = nil,
44
+ except = nil)
45
+ @type = type
46
+ @types = types
47
+ @item_id = item_id
48
+ @item_ids = item_ids
49
+ @size = size
50
+ @fields = fields
51
+ @filter = filter
52
+ @except = except
53
+
54
+ end
55
+
56
+ # Creates JSON of the curent object
57
+ def to_json(options = {})
58
+ hash = key_map
59
+ hash.to_json(options)
60
+ end
61
+
62
+ # Creates an instance of the object from a hash
63
+ def self.from_hash(hash)
64
+ if hash == nil
65
+ nil
66
+ else
67
+ # Extract variables from the hash
68
+ type = hash["type"]
69
+ types = hash["types"]
70
+ item_id = hash["item_id"]
71
+ item_ids = hash["item_ids"]
72
+ size = hash["size"]
73
+ fields = hash["fields"]
74
+ filter = hash["filter"]
75
+ except = hash["except"]
76
+ # Create object from extracted values
77
+ GetSimilarItemsBody.new(type,
78
+ types,
79
+ item_id,
80
+ item_ids,
81
+ size,
82
+ fields,
83
+ filter,
84
+ except)
85
+ end
86
+ end
87
+
88
+ # Defines the key map for json serialization
89
+ def key_map
90
+ hash = {}
91
+ hash['type'] = type
92
+ hash['types'] = types
93
+ hash['item_id'] = item_id
94
+ hash['item_ids'] = item_ids
95
+ hash['size'] = size
96
+ hash['fields'] = fields
97
+ hash['filter'] = filter
98
+ hash['except'] = except
99
+ hash
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,102 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class GetSimilarUsersBody
5
+ # TODO: Write general description for this method
6
+ # @return [String]
7
+ attr_accessor :type
8
+
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :types
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :user_id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [List of String]
19
+ attr_accessor :user_ids
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [Integer]
23
+ attr_accessor :size
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [List of String]
27
+ attr_accessor :fields
28
+
29
+ # TODO: Write general description for this method
30
+ # @return [Object]
31
+ attr_accessor :filter
32
+
33
+ # These ids will not be included in the response.
34
+ # @return [List of String]
35
+ attr_accessor :except
36
+
37
+ def initialize(type = nil,
38
+ types = nil,
39
+ user_id = nil,
40
+ user_ids = nil,
41
+ size = nil,
42
+ fields = nil,
43
+ filter = nil,
44
+ except = nil)
45
+ @type = type
46
+ @types = types
47
+ @user_id = user_id
48
+ @user_ids = user_ids
49
+ @size = size
50
+ @fields = fields
51
+ @filter = filter
52
+ @except = except
53
+
54
+ end
55
+
56
+ # Creates JSON of the curent object
57
+ def to_json(options = {})
58
+ hash = key_map
59
+ hash.to_json(options)
60
+ end
61
+
62
+ # Creates an instance of the object from a hash
63
+ def self.from_hash(hash)
64
+ if hash == nil
65
+ nil
66
+ else
67
+ # Extract variables from the hash
68
+ type = hash["type"]
69
+ types = hash["types"]
70
+ user_id = hash["user_id"]
71
+ user_ids = hash["user_ids"]
72
+ size = hash["size"]
73
+ fields = hash["fields"]
74
+ filter = hash["filter"]
75
+ except = hash["except"]
76
+ # Create object from extracted values
77
+ GetSimilarUsersBody.new(type,
78
+ types,
79
+ user_id,
80
+ user_ids,
81
+ size,
82
+ fields,
83
+ filter,
84
+ except)
85
+ end
86
+ end
87
+
88
+ # Defines the key map for json serialization
89
+ def key_map
90
+ hash = {}
91
+ hash['type'] = type
92
+ hash['types'] = types
93
+ hash['user_id'] = user_id
94
+ hash['user_ids'] = user_ids
95
+ hash['size'] = size
96
+ hash['fields'] = fields
97
+ hash['filter'] = filter
98
+ hash['except'] = except
99
+ hash
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,39 @@
1
+ # This file was automatically generated for SuggestGrid by APIMATIC v2.0 ( https://apimatic.io ).
2
+
3
+ module SuggestGrid
4
+ class GetTypeResponse
5
+ # Either 'implicit' or 'explicit'
6
+ # @return [String]
7
+ attr_accessor :rating
8
+
9
+ def initialize(rating = nil)
10
+ @rating = rating
11
+
12
+ end
13
+
14
+ # Creates JSON of the curent object
15
+ def to_json(options = {})
16
+ hash = key_map
17
+ hash.to_json(options)
18
+ end
19
+
20
+ # Creates an instance of the object from a hash
21
+ def self.from_hash(hash)
22
+ if hash == nil
23
+ nil
24
+ else
25
+ # Extract variables from the hash
26
+ rating = hash["rating"]
27
+ # Create object from extracted values
28
+ GetTypeResponse.new(rating)
29
+ end
30
+ end
31
+
32
+ # Defines the key map for json serialization
33
+ def key_map
34
+ hash = {}
35
+ hash['rating'] = rating
36
+ hash
37
+ end
38
+ end
39
+ end