Class: Pinecone::Index
- Inherits:
-
Object
- Object
- Pinecone::Index
- Includes:
- HTTParty
- Defined in:
- lib/pinecone/index.rb
Instance Method Summary collapse
- #configure(index_name, body) ⇒ Object
- #create(body) ⇒ Object
- #delete(index_name) ⇒ Object
- #describe(index_name) ⇒ Object
-
#initialize ⇒ Index
constructor
A new instance of Index.
- #list ⇒ Object
- #options ⇒ Object
Constructor Details
#initialize ⇒ Index
Returns a new instance of Index.
6 7 8 9 10 11 12 13 |
# File 'lib/pinecone/index.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
#configure(index_name, body) ⇒ Object
32 33 34 35 |
# File 'lib/pinecone/index.rb', line 32 def configure(index_name, body) payload = .merge(body: body.to_json) self.class.patch("/indexes/#{index_name}", payload) end |
#create(body) ⇒ Object
23 24 25 26 |
# File 'lib/pinecone/index.rb', line 23 def create(body) payload = .merge(body: body.to_json) self.class.post("/indexes", payload) end |
#delete(index_name) ⇒ Object
28 29 30 |
# File 'lib/pinecone/index.rb', line 28 def delete(index_name) self.class.delete("/indexes/#{index_name}", ) end |
#describe(index_name) ⇒ Object
19 20 21 |
# File 'lib/pinecone/index.rb', line 19 def describe(index_name) self.class.get("/indexes/#{index_name}", ) end |
#list ⇒ Object
15 16 17 |
# File 'lib/pinecone/index.rb', line 15 def list self.class.get("/indexes", ) end |
#options ⇒ Object
37 38 39 40 41 |
# File 'lib/pinecone/index.rb', line 37 def { headers: @headers } end |