Sha256: 73dcf584444e31e6ecaa87590cc115958579c9dc2e488567c9e93b3fd9a32033

Contents?: true

Size: 679 Bytes

Versions: 5

Compression:

Stored size: 679 Bytes

Contents

# frozen_string_literal: true

module Typesense
  class Collection
    attr_reader :documents, :overrides, :synonyms

    def initialize(name, api_call)
      @name      = name
      @api_call  = api_call
      @documents = Documents.new(@name, @api_call)
      @overrides = Overrides.new(@name, @api_call)
      @synonyms = Synonyms.new(@name, @api_call)
    end

    def retrieve
      @api_call.get(endpoint_path)
    end

    def update(update_schema)
      @api_call.patch(endpoint_path, update_schema)
    end

    def delete
      @api_call.delete(endpoint_path)
    end

    private

    def endpoint_path
      "#{Collections::RESOURCE_PATH}/#{@name}"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
typesense-1.1.0 lib/typesense/collection.rb
typesense-1.0.0 lib/typesense/collection.rb
typesense-0.15.0 lib/typesense/collection.rb
typesense-0.14.1 lib/typesense/collection.rb
typesense-0.14.0 lib/typesense/collection.rb