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.
8 9 10 11 12 13 14 15 |
# File 'lib/pinecone/index.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
#configure(index_name, body) ⇒ Object
34 35 36 37 |
# File 'lib/pinecone/index.rb', line 34 def configure(index_name, body) payload = .merge(body: body.to_json) self.class.patch("/indexes/#{index_name}", payload) end |
#create(body) ⇒ Object
25 26 27 28 |
# File 'lib/pinecone/index.rb', line 25 def create(body) payload = .merge(body: body.to_json) self.class.post("/indexes", payload) end |
#delete(index_name) ⇒ Object
30 31 32 |
# File 'lib/pinecone/index.rb', line 30 def delete(index_name) self.class.delete("/indexes/#{index_name}", ) end |
#describe(index_name) ⇒ Object
21 22 23 |
# File 'lib/pinecone/index.rb', line 21 def describe(index_name) self.class.get("/indexes/#{index_name}", ) end |
#list ⇒ Object
17 18 19 |
# File 'lib/pinecone/index.rb', line 17 def list self.class.get("/indexes", ) end |
#options ⇒ Object
39 40 41 42 43 |
# File 'lib/pinecone/index.rb', line 39 def { headers: @headers } end |