Class: RecombeeApiClient::Batch
- Inherits:
-
ApiRequest
- Object
- ApiRequest
- RecombeeApiClient::Batch
- Defined in:
- lib/recombee_api_client/api/batch.rb
Overview
Batch processing allows you to submit arbitrary sequence of requests
Instance Attribute Summary collapse
-
#body_parameters ⇒ Object
readonly
Values of body parameters as a Hash.
-
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
-
#requests ⇒ Object
readonly
Returns the value of attribute requests.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize(requests, optional = {}) ⇒ Batch
constructor
-
*Required arguments* -
requests
-> Array of API requests.
-
-
#method ⇒ Object
HTTP method.
-
#path ⇒ Object
Relative path to the endpoint.
-
#query_parameters ⇒ Object
Values of query path parameters as a Hash.
Methods included from HashNormalizer
#camelize, #normalize_optional
Constructor Details
#initialize(requests, optional = {}) ⇒ Batch
-
*Required arguments*
-
requests
-> Array of API requests.
-
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/recombee_api_client/api/batch.rb', line 17 def initialize(requests, optional = {}) @requests = requests optional = normalize_optional(optional) @optional = optional @body_parameters = requests_to_batch_hash @timeout = requests.map{|r| r.timeout}.reduce(:+) @ensure_https = true @optional.each do |par, _| fail UnknownOptionalParameter.new(par) unless ["distinctRecomms"].include? par end end |
Instance Attribute Details
#body_parameters ⇒ Object (readonly)
Values of body parameters as a Hash
36 37 38 |
# File 'lib/recombee_api_client/api/batch.rb', line 36 def body_parameters @body_parameters end |
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
12 13 14 |
# File 'lib/recombee_api_client/api/batch.rb', line 12 def ensure_https @ensure_https end |
#requests ⇒ Object (readonly)
Returns the value of attribute requests.
10 11 12 |
# File 'lib/recombee_api_client/api/batch.rb', line 10 def requests @requests end |
#timeout ⇒ Object
Returns the value of attribute timeout.
11 12 13 |
# File 'lib/recombee_api_client/api/batch.rb', line 11 def timeout @timeout end |
Instance Method Details
#method ⇒ Object
HTTP method
31 32 33 |
# File 'lib/recombee_api_client/api/batch.rb', line 31 def method :post end |
#path ⇒ Object
Relative path to the endpoint
46 47 48 49 |
# File 'lib/recombee_api_client/api/batch.rb', line 46 def path p = '/{databaseId}/batch/' p end |
#query_parameters ⇒ Object
Values of query path parameters as a Hash. name of parameter => value of the parameter
40 41 42 43 |
# File 'lib/recombee_api_client/api/batch.rb', line 40 def query_parameters params = {} params end |