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.
6 7 8 9 10 11 12 13 14 |
# File 'lib/pinecone/collection.rb', line 6 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
24 25 26 27 |
# File 'lib/pinecone/collection.rb', line 24 def create(body) payload = .merge(body: body.to_json) self.class.post("/collections", payload) end |
#delete(collection_name) ⇒ Object
29 30 31 |
# File 'lib/pinecone/collection.rb', line 29 def delete(collection_name) self.class.delete("/collections/#{collection_name}", ) end |
#describe(collection_name) ⇒ Object
20 21 22 |
# File 'lib/pinecone/collection.rb', line 20 def describe(collection_name) self.class.get("/collections/#{collection_name}", ) end |
#list ⇒ Object
16 17 18 |
# File 'lib/pinecone/collection.rb', line 16 def list self.class.get("/collections", ) end |
#options ⇒ Object
33 34 35 36 37 |
# File 'lib/pinecone/collection.rb', line 33 def { headers: @headers } end |