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#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 thesynonymis 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_hash_to_camel_case
Constructor Details
#initialize(term, synonym, optional = {}) ⇒ AddSearchSynonym
-
*Required arguments*
-
term-> A word to which thesynonymis specified. -
synonym-> A word that should be considered equal to thetermby the full-text search engine.
-
-
*Optional arguments (given as hash optional)*
-
oneWay-> If set totrue, onlyterm->synonymis considered. If set tofalse, alsosynonym->termworks.
-
Default: false.
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 32 def initialize(term, synonym, optional = {}) @term = term @synonym = synonym optional = normalize_hash_to_camel_case(optional) @one_way = optional['oneWay'] @optional = optional @timeout = 10_000 @ensure_https = false @optional.each do |par, _| raise UnknownOptionalParameter.new(par) unless ['oneWay'].include? par end end |
Instance Attribute Details
#ensure_https ⇒ Object
Returns the value of attribute ensure_https.
19 20 21 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 19 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
51 52 53 54 55 56 57 58 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 51 def body_parameters p = {} p['term'] = @term p['synonym'] = @synonym p['oneWay'] = @optional['oneWay'] if @optional.include? 'oneWay' p end |
#method ⇒ Object
HTTP method
46 47 48 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 46 def method :post end |
#path ⇒ Object
Relative path to the endpoint
67 68 69 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 67 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 |
# File 'lib/recombee_api_client/api/add_search_synonym.rb', line 62 def query_parameters {} end |