Class: Weaviate::GraphQL
- Defined in:
- lib/weaviate/graphql.rb,
sig/weaviate.rbs
Constant Summary collapse
- PATH =
"graphql"
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#execute(query) ⇒ json
Execute a GraphQL query and return the "data" portion of the response.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Weaviate::Base
Instance Method Details
#execute(query) ⇒ json
Execute a GraphQL query and return the "data" portion of the response.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/weaviate/graphql.rb', line 8 def execute(query) response = client.connection.post(PATH) do |req| req.body = {query: query} end errors = response.body["errors"] raise Weaviate::GraphQLError.new(errors) if errors && !errors.empty? response.body["data"] end |