Class: Pinecone::Collection
- Inherits:
-
Object
- Object
- Pinecone::Collection
- Includes:
- HTTParty
- Defined in:
- lib/pinecone/collection.rb
Instance Method Summary collapse
- #create(body) ⇒ Object
- #delete(collection_name) ⇒ Object
- #describe(collection_name) ⇒ Object
-
#initialize ⇒ Collection
constructor
A new instance of Collection.
- #list ⇒ Object
- #options ⇒ Object
Constructor Details
#initialize ⇒ Collection
Returns a new instance of Collection.
8 9 10 11 12 13 14 15 16 |
# File 'lib/pinecone/collection.rb', line 8 def initialize self.class.base_uri "https://api.pinecone.io" @headers = { "Content-Type" => "application/json", "Accept" => "application/json", "Api-Key" => Pinecone.configuration.api_key } end |
Instance Method Details
#create(body) ⇒ Object
26 27 28 29 |
# File 'lib/pinecone/collection.rb', line 26 def create(body) payload = .merge(body: body.to_json) self.class.post("/collections", payload) end |
#delete(collection_name) ⇒ Object
31 32 33 |
# File 'lib/pinecone/collection.rb', line 31 def delete(collection_name) self.class.delete("/collections/#{collection_name}", ) end |
#describe(collection_name) ⇒ Object
22 23 24 |
# File 'lib/pinecone/collection.rb', line 22 def describe(collection_name) self.class.get("/collections/#{collection_name}", ) end |
#list ⇒ Object
18 19 20 |
# File 'lib/pinecone/collection.rb', line 18 def list self.class.get("/collections", ) end |
#options ⇒ Object
35 36 37 38 39 |
# File 'lib/pinecone/collection.rb', line 35 def { headers: @headers } end |