Class: RecombeeApiClient::AddSearchSynonym
- Inherits:
-
ApiRequest
- Object
- ApiRequest
- RecombeeApiClient::AddSearchSynonym
- Defined in:
- lib/recombee_api_client/api/add_search_synonym.rb
Overview
Adds a new synonym for the [Search items](docs.recombee.com/api.html#search-items).
When the ‘term` is used in the search query, the `synonym` is also used for the full-text search. Unless `oneWay=true`, it works also in the opposite way (`synonym` -> `term`).
An example of a synonym can be ‘science fiction` for the term `sci-fi`.
Instance Attribute Summary collapse
-
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
-
#one_way ⇒ Object
readonly
Returns the value of attribute one_way.
-
#synonym ⇒ Object
readonly
Returns the value of attribute synonym.
-
#term ⇒ Object
readonly
Returns the value of attribute term.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#body_parameters ⇒ Object
Values of body parameters as a Hash.
-
#initialize(term, synonym, optional = {}) ⇒ AddSearchSynonym
constructor
-
*Required arguments* -
term-> A word to which the ‘synonym` is specified.
-
-
#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(term, synonym, optional = {}) ⇒ AddSearchSynonym
-
*Required arguments*
-
term-> A word to which the ‘synonym` is specified. -
synonym-> A word that should be considered equal to the ‘term` by the full-text search engine.
-
-
*Optional arguments (given as hash optional)*
-
oneWay-> If set to ‘true`, only `term` -> `synonym` is considered. If set to `false`, also `synonym` -> `term` works.
-
Default: ‘false`.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 33 def initialize(term, synonym, optional = {}) @term = term @synonym = synonym optional = normalize_optional(optional) @one_way = optional['oneWay'] @optional = optional @timeout = 10000 @ensure_https = false @optional.each do |par, _| fail UnknownOptionalParameter.new(par) unless ["oneWay"].include? par end end |
Instance Attribute Details
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
20 21 22 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 20 def ensure_https @ensure_https end |
#one_way ⇒ Object (readonly)
Returns the value of attribute one_way.
18 19 20 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 18 def one_way @one_way end |
#synonym ⇒ Object (readonly)
Returns the value of attribute synonym.
18 19 20 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 18 def synonym @synonym end |
#term ⇒ Object (readonly)
Returns the value of attribute term.
18 19 20 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 18 def term @term end |
#timeout ⇒ Object
Returns the value of attribute timeout.
19 20 21 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 19 def timeout @timeout end |
Instance Method Details
#body_parameters ⇒ Object
Values of body parameters as a Hash
52 53 54 55 56 57 58 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 52 def body_parameters p = Hash.new p['term'] = @term p['synonym'] = @synonym p['oneWay'] = @optional['oneWay'] if @optional.include? 'oneWay' p end |
#method ⇒ Object
HTTP method
47 48 49 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 47 def method :post end |
#path ⇒ Object
Relative path to the endpoint
68 69 70 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 68 def path "/{databaseId}/synonyms/items/" end |
#query_parameters ⇒ Object
Values of query parameters as a Hash. name of parameter => value of the parameter
62 63 64 65 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 62 def query_parameters params = {} params end |