Class: SuggestGrid::GetRecommendedItemsBody
- Defined in:
- lib/suggestgrid/models/get_recommended_items_body.rb
Instance Attribute Summary collapse
-
#except ⇒ List of String
These item ids that will not be included in the response.
-
#fields ⇒ List of String
The metadata fields to be included in returned item objects.
-
#filter ⇒ Array<String, Boolean>
Contraints on the returned users or items.
-
#from ⇒ Integer
The number of most recommended items to be skipped from the response.
-
#similar_item_id ⇒ String
Similar item that the response should be similar to.
-
#similar_item_ids ⇒ List of String
Similar items that the response should be similar to.
-
#size ⇒ Integer
The number of items requested.
-
#type ⇒ String
The type of the query.
-
#types ⇒ List of String
The types of the query.
-
#user_id ⇒ String
The user id of the query.
-
#user_ids ⇒ List of String
The user ids of the query.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(type = nil, types = nil, user_id = nil, user_ids = nil, from = nil, size = nil, similar_item_id = nil, similar_item_ids = nil, fields = nil, filter = nil, except = nil) ⇒ GetRecommendedItemsBody
constructor
A new instance of GetRecommendedItemsBody.
Methods inherited from BaseModel
Constructor Details
#initialize(type = nil, types = nil, user_id = nil, user_ids = nil, from = nil, size = nil, similar_item_id = nil, similar_item_ids = nil, fields = nil, filter = nil, except = nil) ⇒ GetRecommendedItemsBody
Returns a new instance of GetRecommendedItemsBody.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 70 def initialize(type = nil, types = nil, user_id = nil, user_ids = nil, from = nil, size = nil, similar_item_id = nil, similar_item_ids = nil, fields = nil, filter = nil, except = nil) @type = type @types = types @user_id = user_id @user_ids = user_ids @from = from @size = size @similar_item_id = similar_item_id @similar_item_ids = similar_item_ids @fields = fields @filter = filter @except = except end |
Instance Attribute Details
#except ⇒ List of String
These item ids that will not be included in the response.
49 50 51 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 49 def except @except end |
#fields ⇒ List of String
The metadata fields to be included in returned item objects.
40 41 42 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 40 def fields @fields end |
#filter ⇒ Array<String, Boolean>
Contraints on the returned users or items. Filter structure is defined in [the filter parameter documentation](www.suggestgrid.com/docs/advanced-features#filters-parameter).
45 46 47 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 45 def filter @filter end |
#from ⇒ Integer
The number of most recommended items to be skipped from the response. Defaults to 0.
23 24 25 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 23 def from @from end |
#similar_item_id ⇒ String
Similar item that the response should be similar to.
31 32 33 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 31 def similar_item_id @similar_item_id end |
#similar_item_ids ⇒ List of String
Similar items that the response should be similar to. At most one of similar item and similar items parameters can be provided.
36 37 38 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 36 def similar_item_ids @similar_item_ids end |
#size ⇒ Integer
The number of items requested. Defaults to 10. Must be between 1 and 10,000 inclusive.
27 28 29 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 27 def size @size end |
#type ⇒ String
The type of the query. Recommendations will be calculated based on actions of this type.
7 8 9 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 7 def type @type end |
#types ⇒ List of String
The types of the query. Exactly one of type or types parameters must be provided.
11 12 13 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 11 def types @types end |
#user_id ⇒ String
The user id of the query.
15 16 17 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 15 def user_id @user_id end |
#user_ids ⇒ List of String
The user ids of the query. Exactly one of user id or user ids parameters must be provided.
19 20 21 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 19 def user_ids @user_ids end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 95 def self.from_hash(hash) return nil unless hash # Extract variables from the hash type = hash['type'] types = hash['types'] user_id = hash['user_id'] user_ids = hash['user_ids'] from = hash['from'] size = hash['size'] similar_item_id = hash['similar_item_id'] similar_item_ids = hash['similar_item_ids'] fields = hash['fields'] filter = hash['filter'] except = hash['except'] # Create object from extracted values GetRecommendedItemsBody.new(type, types, user_id, user_ids, from, size, similar_item_id, similar_item_ids, fields, filter, except) end |
.names ⇒ Object
A mapping from model property names to API property names
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/suggestgrid/models/get_recommended_items_body.rb', line 52 def self.names if @_hash.nil? @_hash = {} @_hash["type"] = "type" @_hash["types"] = "types" @_hash["user_id"] = "user_id" @_hash["user_ids"] = "user_ids" @_hash["from"] = "from" @_hash["size"] = "size" @_hash["similar_item_id"] = "similar_item_id" @_hash["similar_item_ids"] = "similar_item_ids" @_hash["fields"] = "fields" @_hash["filter"] = "filter" @_hash["except"] = "except" end @_hash end |