Sha256: 167035f27e151173cd85fbdaeca2cac6548c0d8210bc709211138d844176994e

Contents?: true

Size: 517 Bytes

Versions: 3

Compression:

Stored size: 517 Bytes

Contents

# frozen_string_literal: true

module Typesense
  class Collections
    RESOURCE_PATH = '/collections'

    def initialize(configuration)
      @configuration = configuration
      @collections   = {}
    end

    def create(schema)
      ApiCall.new(@configuration).post(RESOURCE_PATH, schema)
    end

    def retrieve
      ApiCall.new(@configuration).get(RESOURCE_PATH)
    end

    def [](collection_name)
      @collections[collection_name] ||= Collection.new(@configuration, collection_name)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
typesense-0.2.0 lib/typesense/collections.rb
typesense-0.1.1 lib/typesense/collections.rb
typesense-0.1.0 lib/typesense/collections.rb