Sha256: d800972f21a7c1b966fa41fd909e0fb8a4ac75e970de1698af23e09a4466ea6c

Contents?: true

Size: 552 Bytes

Versions: 24

Compression:

Stored size: 552 Bytes

Contents

# frozen_string_literal: true

module Typesense
  class Aliases
    RESOURCE_PATH = '/aliases'

    def initialize(api_call)
      @api_call = api_call
      @aliases = {}
    end

    def upsert(alias_name, mapping)
      @api_call.put(endpoint_path(alias_name), mapping)
    end

    def retrieve
      @api_call.get(RESOURCE_PATH)
    end

    def [](alias_name)
      @aliases[alias_name] ||= Alias.new(alias_name, @api_call)
    end

    private

    def endpoint_path(alias_name)
      "#{Aliases::RESOURCE_PATH}/#{alias_name}"
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
typesense-1.1.0 lib/typesense/aliases.rb
typesense-1.0.0 lib/typesense/aliases.rb
typesense-0.15.0 lib/typesense/aliases.rb
typesense-0.14.1 lib/typesense/aliases.rb
typesense-0.14.0 lib/typesense/aliases.rb
typesense-0.13.0 lib/typesense/aliases.rb
typesense-0.12.0 lib/typesense/aliases.rb
typesense-0.11.1 lib/typesense/aliases.rb
typesense-0.11.0 lib/typesense/aliases.rb
typesense-0.10.0 lib/typesense/aliases.rb
typesense-0.9.0 lib/typesense/aliases.rb
typesense-0.8.0 lib/typesense/aliases.rb
typesense-0.8.0pre lib/typesense/aliases.rb
typesense-0.7.0 lib/typesense/aliases.rb
typesense-0.7.0.pre1 lib/typesense/aliases.rb
typesense-0.7.0.pre0 lib/typesense/aliases.rb
typesense-0.6.0 lib/typesense/aliases.rb
typesense-0.5.5 lib/typesense/aliases.rb
typesense-0.5.4 lib/typesense/aliases.rb
typesense-0.5.3 lib/typesense/aliases.rb