Class: RecombeeApiClient::CreateAutoReqlSegmentation
- Inherits:
-
ApiRequest
- Object
- ApiRequest
- RecombeeApiClient::CreateAutoReqlSegmentation
- Defined in:
- lib/recombee_api_client/api/create_auto_reql_segmentation.rb
Overview
Segment the items using a [ReQL](docs.recombee.com/reql) expression.
For each item, the expression should return a set that contains IDs of segments to which the item belongs to.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
-
#segmentation_id ⇒ Object
readonly
Returns the value of attribute segmentation_id.
-
#source_type ⇒ Object
readonly
Returns the value of attribute source_type.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#body_parameters ⇒ Object
Values of body parameters as a Hash.
-
#initialize(segmentation_id, source_type, expression, optional = {}) ⇒ CreateAutoReqlSegmentation
constructor
-
*Required arguments* -
segmentation_id
-> ID of the newly created Segmentation -source_type
-> What type of data should be segmented.
-
-
#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(segmentation_id, source_type, expression, optional = {}) ⇒ CreateAutoReqlSegmentation
-
*Required arguments*
-
segmentation_id
-> ID of the newly created Segmentation -
source_type
-> What type of data should be segmented. Currently only ‘items` are supported. -
expression
-> ReQL expression that returns for each item a set with IDs of segments to which the item belongs
-
-
*Optional arguments (given as hash optional)*
-
title
-> Human-readable name that is shown in the Recombee Admin UI. -
description
-> Description that is shown in the Recombee Admin UI.
-
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 33 def initialize(segmentation_id, source_type, expression, optional = {}) @segmentation_id = segmentation_id @source_type = source_type @expression = expression optional = normalize_optional(optional) @title = optional['title'] @description = optional['description'] @optional = optional @timeout = 10000 @ensure_https = false @optional.each do |par, _| fail UnknownOptionalParameter.new(par) unless ["title","description"].include? par end end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
15 16 17 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 15 def description @description end |
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
17 18 19 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 17 def ensure_https @ensure_https end |
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
15 16 17 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 15 def expression @expression end |
#segmentation_id ⇒ Object (readonly)
Returns the value of attribute segmentation_id.
15 16 17 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 15 def segmentation_id @segmentation_id end |
#source_type ⇒ Object (readonly)
Returns the value of attribute source_type.
15 16 17 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 15 def source_type @source_type end |
#timeout ⇒ Object
Returns the value of attribute timeout.
16 17 18 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 16 def timeout @timeout end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
15 16 17 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 15 def title @title end |
Instance Method Details
#body_parameters ⇒ Object
Values of body parameters as a Hash
54 55 56 57 58 59 60 61 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 54 def body_parameters p = Hash.new p['sourceType'] = @source_type p['expression'] = @expression p['title'] = @optional['title'] if @optional.include? 'title' p['description'] = @optional['description'] if @optional.include? 'description' p end |
#method ⇒ Object
HTTP method
49 50 51 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 49 def method :put end |
#path ⇒ Object
Relative path to the endpoint
71 72 73 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 71 def path "/{databaseId}/segmentations/auto-reql/#{@segmentation_id}" end |
#query_parameters ⇒ Object
Values of query parameters as a Hash. name of parameter => value of the parameter
65 66 67 68 |
# File 'lib/recombee_api_client/api/create_auto_reql_segmentation.rb', line 65 def query_parameters params = {} params end |