Class: RecombeeApiClient::CreatePropertyBasedSegmentation
- Inherits:
-
ApiRequest
- Object
- ApiRequest
- RecombeeApiClient::CreatePropertyBasedSegmentation
- Defined in:
- lib/recombee_api_client/api/create_property_based_segmentation.rb
Overview
Creates a Segmentation that splits the items into segments based on values of a particular item property.
A segment is created for each unique value of the property. In case of ‘set` properties, a segment is created for each value in the set. Item belongs to all these segments.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
-
#property_name ⇒ Object
readonly
Returns the value of attribute property_name.
-
#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, property_name, optional = {}) ⇒ CreatePropertyBasedSegmentation
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, property_name, optional = {}) ⇒ CreatePropertyBasedSegmentation
-
*Required arguments*
-
segmentation_id
-> ID of the newly created Segmentation -
source_type
-> What type of data should be segmented. Currently only ‘items` are supported. -
property_name
-> Name of the property on which the Segmentation should be based
-
-
*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.
-
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 34 def initialize(segmentation_id, source_type, property_name, optional = {}) @segmentation_id = segmentation_id @source_type = source_type @property_name = property_name 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.
16 17 18 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 16 def description @description end |
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
18 19 20 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 18 def ensure_https @ensure_https end |
#property_name ⇒ Object (readonly)
Returns the value of attribute property_name.
16 17 18 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 16 def property_name @property_name end |
#segmentation_id ⇒ Object (readonly)
Returns the value of attribute segmentation_id.
16 17 18 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 16 def segmentation_id @segmentation_id end |
#source_type ⇒ Object (readonly)
Returns the value of attribute source_type.
16 17 18 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 16 def source_type @source_type end |
#timeout ⇒ Object
Returns the value of attribute timeout.
17 18 19 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 17 def timeout @timeout end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
16 17 18 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 16 def title @title end |
Instance Method Details
#body_parameters ⇒ Object
Values of body parameters as a Hash
55 56 57 58 59 60 61 62 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 55 def body_parameters p = Hash.new p['sourceType'] = @source_type p['propertyName'] = @property_name p['title'] = @optional['title'] if @optional.include? 'title' p['description'] = @optional['description'] if @optional.include? 'description' p end |
#method ⇒ Object
HTTP method
50 51 52 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 50 def method :put end |
#path ⇒ Object
Relative path to the endpoint
72 73 74 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 72 def path "/{databaseId}/segmentations/property-based/#{@segmentation_id}" end |
#query_parameters ⇒ Object
Values of query parameters as a Hash. name of parameter => value of the parameter
66 67 68 69 |
# File 'lib/recombee_api_client/api/create_property_based_segmentation.rb', line 66 def query_parameters params = {} params end |