Class: RecombeeApiClient::ListItems
- Inherits:
-
ApiRequest
- Object
- ApiRequest
- RecombeeApiClient::ListItems
- Defined in:
- lib/recombee_api_client/api/list_items.rb
Overview
Gets a list of IDs of items currently present in the catalog.
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
-
#included_properties ⇒ Object
readonly
Returns the value of attribute included_properties.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#return_properties ⇒ Object
readonly
Returns the value of attribute return_properties.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#body_parameters ⇒ Object
Values of body parameters as a Hash.
-
#initialize(optional = {}) ⇒ ListItems
constructor
-
*Optional arguments (given as hash optional)* -
filter
-> Boolean-returning [ReQL](docs.recombee.com/reql) expression, which allows you to filter items to be listed.
-
-
#method ⇒ Object
HTTP method.
-
#path ⇒ Object
Relative path to the endpoint.
-
#query_parameters ⇒ Object
Values of query parameters as a Hash.
Methods included from HashNormalizer
#camelize, #normalize_optional
Constructor Details
#initialize(optional = {}) ⇒ ListItems
-
*Optional arguments (given as hash optional)*
-
filter
-> Boolean-returning [ReQL](docs.recombee.com/reql) expression, which allows you to filter items to be listed. Only the items for which the expression is true will be returned. -
count
-> The number of items to be listed. -
offset
-> Specifies the number of items to skip (ordered by ‘itemId`). -
returnProperties
-> With ‘returnProperties=true`, property values of the listed items are returned along with their IDs in a JSON dictionary.
-
Example response: “‘json
[
{
"itemId": "tv-178",
"description": "4K TV with 3D feature",
"categories": ["Electronics", "Televisions"],
"price": 342,
"url": "myshop.com/tv-178"
},
{
"itemId": "mixer-42",
"description": "Stainless Steel Mixer",
"categories": ["Home & Kitchen"],
"price": 39,
"url": "myshop.com/mixer-42"
}
]
“‘
- +includedProperties+ -> Allows specifying which properties should be returned when `returnProperties=true` is set. The properties are given as a comma-separated list.
Example response for ‘includedProperties=description,price`: “`json
[
{
"itemId": "tv-178",
"description": "4K TV with 3D feature",
"price": 342
},
{
"itemId": "mixer-42",
"description": "Stainless Steel Mixer",
"price": 39
}
]
“‘
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/recombee_api_client/api/list_items.rb', line 63 def initialize(optional = {}) optional = normalize_optional(optional) @filter = optional['filter'] @count = optional['count'] @offset = optional['offset'] @return_properties = optional['returnProperties'] @included_properties = optional['includedProperties'] @optional = optional @timeout = 100000 @ensure_https = false @optional.each do |par, _| fail UnknownOptionalParameter.new(par) unless ["filter","count","offset","returnProperties","includedProperties"].include? par end end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
12 13 14 |
# File 'lib/recombee_api_client/api/list_items.rb', line 12 def count @count end |
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
14 15 16 |
# File 'lib/recombee_api_client/api/list_items.rb', line 14 def ensure_https @ensure_https end |
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
12 13 14 |
# File 'lib/recombee_api_client/api/list_items.rb', line 12 def filter @filter end |
#included_properties ⇒ Object (readonly)
Returns the value of attribute included_properties.
12 13 14 |
# File 'lib/recombee_api_client/api/list_items.rb', line 12 def included_properties @included_properties end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
12 13 14 |
# File 'lib/recombee_api_client/api/list_items.rb', line 12 def offset @offset end |
#return_properties ⇒ Object (readonly)
Returns the value of attribute return_properties.
12 13 14 |
# File 'lib/recombee_api_client/api/list_items.rb', line 12 def return_properties @return_properties end |
#timeout ⇒ Object
Returns the value of attribute timeout.
13 14 15 |
# File 'lib/recombee_api_client/api/list_items.rb', line 13 def timeout @timeout end |
Instance Method Details
#body_parameters ⇒ Object
Values of body parameters as a Hash
84 85 86 87 |
# File 'lib/recombee_api_client/api/list_items.rb', line 84 def body_parameters p = Hash.new p end |
#method ⇒ Object
HTTP method
79 80 81 |
# File 'lib/recombee_api_client/api/list_items.rb', line 79 def method :get end |
#path ⇒ Object
Relative path to the endpoint
102 103 104 |
# File 'lib/recombee_api_client/api/list_items.rb', line 102 def path "/{databaseId}/items/list/" end |
#query_parameters ⇒ Object
Values of query parameters as a Hash. name of parameter => value of the parameter
91 92 93 94 95 96 97 98 99 |
# File 'lib/recombee_api_client/api/list_items.rb', line 91 def query_parameters params = {} params['filter'] = @optional['filter'] if @optional['filter'] params['count'] = @optional['count'] if @optional['count'] params['offset'] = @optional['offset'] if @optional['offset'] params['returnProperties'] = @optional['returnProperties'] if @optional['returnProperties'] params['includedProperties'] = @optional['includedProperties'] if @optional['includedProperties'] params end |