class Typesense::Synonyms

Constants

RESOURCE_PATH

Public Class Methods

new(collection_name, api_call) click to toggle source
# File lib/typesense/synonyms.rb, line 7
def initialize(collection_name, api_call)
  @collection_name = collection_name
  @api_call        = api_call
  @synonyms = {}
end

Public Instance Methods

[](synonym_id) click to toggle source
# File lib/typesense/synonyms.rb, line 21
def [](synonym_id)
  @synonyms[synonym_id] ||= Synonym.new(@collection_name, synonym_id, @api_call)
end
retrieve() click to toggle source
# File lib/typesense/synonyms.rb, line 17
def retrieve
  @api_call.get(endpoint_path)
end
upsert(synonym_id, params) click to toggle source
# File lib/typesense/synonyms.rb, line 13
def upsert(synonym_id, params)
  @api_call.put(endpoint_path(synonym_id), params)
end

Private Instance Methods

endpoint_path(operation = nil) click to toggle source
# File lib/typesense/synonyms.rb, line 27
def endpoint_path(operation = nil)
  "#{Collections::RESOURCE_PATH}/#{@collection_name}#{Synonyms::RESOURCE_PATH}#{operation.nil? ? '' : "/#{operation}"}"
end