Sha256: 5e1b953d550cc3356210d2a661062044050b45d08e46d6ae1f97d3922e338f9a

Contents?: true

Size: 711 Bytes

Versions: 7

Compression:

Stored size: 711 Bytes

Contents

# frozen_string_literal: true

module Typesense
  class Overrides
    RESOURCE_PATH = '/overrides'

    def initialize(collection_name, api_call)
      @collection_name = collection_name
      @api_call        = api_call
      @overrides       = {}
    end

    def create(params)
      @api_call.put(endpoint_path, params)
    end

    def retrieve
      @api_call.get(endpoint_path)
    end

    def [](override_id)
      @overrides[override_id] ||= Override.new(@collection_name, override_id, @api_call)
    end

    private

    def endpoint_path(operation = nil)
      "#{Collections::RESOURCE_PATH}/#{@collection_name}#{Overrides::RESOURCE_PATH}#{operation.nil? ? '' : '/' + operation}"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
typesense-0.5.5 lib/typesense/overrides.rb
typesense-0.5.4 lib/typesense/overrides.rb
typesense-0.5.3 lib/typesense/overrides.rb
typesense-0.5.2 lib/typesense/overrides.rb
typesense-0.5.1 lib/typesense/overrides.rb
typesense-0.5.0 lib/typesense/overrides.rb
typesense-0.4.0 lib/typesense/overrides.rb