-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding endpoints and tests for collections
- Loading branch information
Showing
13 changed files
with
527 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PINECONE_API_KEY=your-api-key | ||
PINECONE_ENVIRONMENT=us-east1-gcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module Pinecone | ||
class Collection | ||
include HTTParty | ||
|
||
def initialize | ||
self.class.base_uri "https://controller.#{Pinecone.configuration.environment}.pinecone.io" | ||
|
||
@headers = { | ||
"Content-Type" => "application/json", | ||
"Accept" => "application/json", | ||
"Api-Key" => Pinecone.configuration.api_key, | ||
} | ||
end | ||
|
||
def list | ||
self.class.get('/collections', options) | ||
end | ||
|
||
def describe(collection_name) | ||
self.class.get("/collections/#{collection_name}", options) | ||
end | ||
|
||
def create(body) | ||
payload = options.merge(body: body.to_json) | ||
self.class.post('/collections', payload) | ||
end | ||
|
||
def delete(collection_name) | ||
self.class.delete("/collections/#{collection_name}", options) | ||
end | ||
|
||
def options | ||
{ | ||
headers: @headers, | ||
} | ||
end | ||
end | ||
end |
37 changes: 37 additions & 0 deletions
37
...ction/_create/successful_response/returns_a_response_with_collection_creation_details.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
...cassettes/Pinecone_Collection/_create/unsuccessful_response/returns_an_error_response.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
73 changes: 73 additions & 0 deletions
73
...ction/_delete/successful_response/returns_a_response_with_collection_deletion_details.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.