Class: RecombeeApiClient::AddManualReqlSegment
- Inherits:
-
ApiRequest
- Object
- ApiRequest
- RecombeeApiClient::AddManualReqlSegment
- Defined in:
- lib/recombee_api_client/api/add_manual_reql_segment.rb
Overview
Adds a new Segment into a Manual ReQL Segmentation.
The new Segment is defined by a [ReQL](docs.recombee.com/reql) filter that returns ‘true` for an item in case that this item belongs to the segment.
Instance Attribute Summary collapse
-
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
-
#segment_id ⇒ Object
readonly
Returns the value of attribute segment_id.
-
#segmentation_id ⇒ Object
readonly
Returns the value of attribute segmentation_id.
-
#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, segment_id, filter, optional = {}) ⇒ AddManualReqlSegment
constructor
-
*Required arguments* -
segmentation_id
-> ID of the Segmentation to which the new Segment should be added -segment_id
-> ID of the newly created Segment -filter
-> ReQL filter that returns ‘true` for items that belong to this Segment.
-
-
#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, segment_id, filter, optional = {}) ⇒ AddManualReqlSegment
-
*Required arguments*
-
segmentation_id
-> ID of the Segmentation to which the new Segment should be added -
segment_id
-> ID of the newly created Segment -
filter
-> ReQL filter that returns ‘true` for items that belong to this Segment. Otherwise returns `false`.
-
-
*Optional arguments (given as hash optional)*
-
title
-> Human-readable name of the Segment that is shown in the Recombee Admin UI.
-
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/recombee_api_client/api/add_manual_reql_segment.rb', line 30 def initialize(segmentation_id, segment_id, filter, optional = {}) @segmentation_id = segmentation_id @segment_id = segment_id @filter = filter optional = normalize_optional(optional) @title = optional['title'] @optional = optional @timeout = 10000 @ensure_https = false @optional.each do |par, _| fail UnknownOptionalParameter.new(par) unless ["title"].include? par end end |
Instance Attribute Details
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
17 18 19 |
# File 'lib/recombee_api_client/api/add_manual_reql_segment.rb', line 17 def ensure_https @ensure_https end |
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
15 16 17 |
# File 'lib/recombee_api_client/api/add_manual_reql_segment.rb', line 15 def filter @filter end |
#segment_id ⇒ Object (readonly)
Returns the value of attribute segment_id.
15 16 17 |
# File 'lib/recombee_api_client/api/add_manual_reql_segment.rb', line 15 def segment_id @segment_id end |
#segmentation_id ⇒ Object (readonly)
Returns the value of attribute segmentation_id.
15 16 17 |
# File 'lib/recombee_api_client/api/add_manual_reql_segment.rb', line 15 def segmentation_id @segmentation_id end |
#timeout ⇒ Object
Returns the value of attribute timeout.
16 17 18 |
# File 'lib/recombee_api_client/api/add_manual_reql_segment.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/add_manual_reql_segment.rb', line 15 def title @title end |
Instance Method Details
#body_parameters ⇒ Object
Values of body parameters as a Hash
50 51 52 53 54 55 |
# File 'lib/recombee_api_client/api/add_manual_reql_segment.rb', line 50 def body_parameters p = Hash.new p['filter'] = @filter p['title'] = @optional['title'] if @optional.include? 'title' p end |
#method ⇒ Object
HTTP method
45 46 47 |
# File 'lib/recombee_api_client/api/add_manual_reql_segment.rb', line 45 def method :put end |
#path ⇒ Object
Relative path to the endpoint
65 66 67 |
# File 'lib/recombee_api_client/api/add_manual_reql_segment.rb', line 65 def path "/{databaseId}/segmentations/manual-reql/#{@segmentation_id}/segments/#{@segment_id}" end |
#query_parameters ⇒ Object
Values of query parameters as a Hash. name of parameter => value of the parameter
59 60 61 62 |
# File 'lib/recombee_api_client/api/add_manual_reql_segment.rb', line 59 def query_parameters params = {} params end |