Class: Roseflow::Pinecone::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/roseflow/pinecone/structs.rb,
lib/roseflow/pinecone/collection.rb

Defined Under Namespace

Classes: Description

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Collection

Returns a new instance of Collection.



9
10
11
# File 'lib/roseflow/pinecone/collection.rb', line 9

def initialize(connection)
  @connection = connection
end

Instance Method Details

#create(name = "", source_index = "") ⇒ Object



27
28
29
30
31
32
# File 'lib/roseflow/pinecone/collection.rb', line 27

def create(name = "", source_index = "")
  CollectionResponse.new(
    method: :create,
    response: connection.post("/collections", { name: name, source: source_index })
  )
end

#delete(name) ⇒ Object



34
35
36
37
38
39
# File 'lib/roseflow/pinecone/collection.rb', line 34

def delete(name)
  CollectionResponse.new(
    method: :delete,
    response: connection.delete("/collections/#{name}")
  )
end

#describe(name) ⇒ Object



20
21
22
23
24
25
# File 'lib/roseflow/pinecone/collection.rb', line 20

def describe(name)
  CollectionResponse.new(
    method: :describe,
    response: connection.get("/collections/#{name}")
  )
end

#listObject



13
14
15
16
17
18
# File 'lib/roseflow/pinecone/collection.rb', line 13

def list
  CollectionResponse.new(
    method: :list,
    response: connection.get("/collections")
  )
end