Class: RecombeeApiClient::UpdateManualReqlSegment

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

Overview

Update definition of the Segment.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashNormalizer

#camelize, #normalize_hash_to_camel_case

Constructor Details

#initialize(segmentation_id, segment_id, filter, optional = {}) ⇒ UpdateManualReqlSegment

  • Required arguments

    • segmentation_id -> ID of the Segmentation to which the updated Segment belongs
    • segment_id -> ID of the Segment that will be updated
    • 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.


27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/recombee_api_client/api/update_manual_reql_segment.rb', line 27

def initialize(segmentation_id, segment_id, filter, optional = {})
  @segmentation_id = segmentation_id
  @segment_id = segment_id
  @filter = filter
  optional = normalize_hash_to_camel_case(optional)
  @title = optional['title']
  @optional = optional
  @timeout = 10_000
  @ensure_https = false
  @optional.each do |par, _|
    raise UnknownOptionalParameter.new(par) unless ['title'].include? par
  end
end

Instance Attribute Details

#ensure_httpsObject

Returns the value of attribute ensure_https.



14
15
16
# File 'lib/recombee_api_client/api/update_manual_reql_segment.rb', line 14

def ensure_https
  @ensure_https
end

#filterObject (readonly)

Returns the value of attribute filter.



13
14
15
# File 'lib/recombee_api_client/api/update_manual_reql_segment.rb', line 13

def filter
  @filter
end

#segment_idObject (readonly)

Returns the value of attribute segment_id.



13
14
15
# File 'lib/recombee_api_client/api/update_manual_reql_segment.rb', line 13

def segment_id
  @segment_id
end

#segmentation_idObject (readonly)

Returns the value of attribute segmentation_id.



13
14
15
# File 'lib/recombee_api_client/api/update_manual_reql_segment.rb', line 13

def segmentation_id
  @segmentation_id
end

#timeoutObject

Returns the value of attribute timeout.



14
15
16
# File 'lib/recombee_api_client/api/update_manual_reql_segment.rb', line 14

def timeout
  @timeout
end

#titleObject (readonly)

Returns the value of attribute title.



13
14
15
# File 'lib/recombee_api_client/api/update_manual_reql_segment.rb', line 13

def title
  @title
end

Instance Method Details

#body_parametersObject

Values of body parameters as a Hash



47
48
49
50
51
52
53
# File 'lib/recombee_api_client/api/update_manual_reql_segment.rb', line 47

def body_parameters
  p = {}
  p['filter'] = @filter
  p['title'] = @optional['title'] if @optional.include? 'title'

  p
end

#methodObject

HTTP method



42
43
44
# File 'lib/recombee_api_client/api/update_manual_reql_segment.rb', line 42

def method
  :post
end

#pathObject

Relative path to the endpoint



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

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

#query_parametersObject

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



57
58
59
# File 'lib/recombee_api_client/api/update_manual_reql_segment.rb', line 57

def query_parameters
  {}
end