Sha256: 53b43f28f8784837c8cbff3fd2f19b182950dc31fc8bc08e3971ac8347cfef19
Contents?: true
Size: 782 Bytes
Versions: 4
Compression:
Stored size: 782 Bytes
Contents
# frozen_string_literal: true module Typesense class Synonyms RESOURCE_PATH = '/synonyms' def initialize(collection_name, api_call) @collection_name = collection_name @api_call = api_call @synonyms = {} end def upsert(synonym_id, params) @api_call.put(endpoint_path(synonym_id), params) end def retrieve @api_call.get(endpoint_path) end def [](synonym_id) @synonyms[synonym_id] ||= Synonym.new(@collection_name, synonym_id, @api_call) end private def endpoint_path(operation = nil) "#{Collections::RESOURCE_PATH}/#{URI.encode_www_form_component(@collection_name)}#{Synonyms::RESOURCE_PATH}#{operation.nil? ? '' : "/#{URI.encode_www_form_component(operation)}"}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
typesense-3.0.0.rc1 | lib/typesense/synonyms.rb |
typesense-2.1.0 | lib/typesense/synonyms.rb |
typesense-2.1.0.rc2 | lib/typesense/synonyms.rb |
typesense-2.1.0.rc1 | lib/typesense/synonyms.rb |