Class: RecombeeApiClient::CreateManualReqlSegmentation

Inherits:
ApiRequest
  • Object
show all
Defined in:
lib/recombee_api_client/api/create_manual_reql_segmentation.rb

Overview

Segment the items using multiple [ReQL](docs.recombee.com/reql) filters.

Use the Add Manual ReQL Items Segment endpoint to create the individual segments.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashNormalizer

#camelize, #normalize_optional

Constructor Details

#initialize(segmentation_id, source_type, optional = {}) ⇒ CreateManualReqlSegmentation

  • *Required arguments*

    • segmentation_id -> ID of the newly created Segmentation

    • source_type -> What type of data should be segmented. Currently only ‘items` are supported.

  • *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.



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/recombee_api_client/api/create_manual_reql_segmentation.rb', line 31

def initialize(segmentation_id, source_type, optional = {})
  @segmentation_id = segmentation_id
  @source_type = source_type
  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

#descriptionObject (readonly)

Returns the value of attribute description.



15
16
17
# File 'lib/recombee_api_client/api/create_manual_reql_segmentation.rb', line 15

def description
  @description
end

#ensure_httpsObject

Returns the value of attribute ensure_https.



17
18
19
# File 'lib/recombee_api_client/api/create_manual_reql_segmentation.rb', line 17

def ensure_https
  @ensure_https
end

#segmentation_idObject (readonly)

Returns the value of attribute segmentation_id.



15
16
17
# File 'lib/recombee_api_client/api/create_manual_reql_segmentation.rb', line 15

def segmentation_id
  @segmentation_id
end

#source_typeObject (readonly)

Returns the value of attribute source_type.



15
16
17
# File 'lib/recombee_api_client/api/create_manual_reql_segmentation.rb', line 15

def source_type
  @source_type
end

#timeoutObject

Returns the value of attribute timeout.



16
17
18
# File 'lib/recombee_api_client/api/create_manual_reql_segmentation.rb', line 16

def timeout
  @timeout
end

#titleObject (readonly)

Returns the value of attribute title.



15
16
17
# File 'lib/recombee_api_client/api/create_manual_reql_segmentation.rb', line 15

def title
  @title
end

Instance Method Details

#body_parametersObject

Values of body parameters as a Hash



51
52
53
54
55
56
57
# File 'lib/recombee_api_client/api/create_manual_reql_segmentation.rb', line 51

def body_parameters
  p = Hash.new
  p['sourceType'] = @source_type
  p['title'] = @optional['title'] if @optional.include? 'title'
  p['description'] = @optional['description'] if @optional.include? 'description'
  p
end

#methodObject

HTTP method



46
47
48
# File 'lib/recombee_api_client/api/create_manual_reql_segmentation.rb', line 46

def method
  :put
end

#pathObject

Relative path to the endpoint



67
68
69
# File 'lib/recombee_api_client/api/create_manual_reql_segmentation.rb', line 67

def path
  "/{databaseId}/segmentations/manual-reql/#{@segmentation_id}"
end

#query_parametersObject

Values of query parameters as a Hash. name of parameter => value of the parameter



61
62
63
64
# File 'lib/recombee_api_client/api/create_manual_reql_segmentation.rb', line 61

def query_parameters
  params = {}
  params
end