graphql-client to your Gemfile and then run
Sample configuration for a GraphQL Client to query from the SWAPI GraphQL Wrapper.
Always remember to replace
API_SECRET with the correct value that you copied from apito console.
Go to this page if you do not know where to find your api secrets for your project
If you haven't already, familiarize yourself with the GraphQL query syntax. Queries are declared with the same syntax inside of a
<<-'GRAPHQL' heredoc. There isn't any special query builder Ruby DSL.
This client library encourages all GraphQL queries to be declared statically and assigned to a Ruby constant.
Queries can reference variables that are passed in at query execution time.
Fragments are declared similarly.
To include a fragment in a query, reference the fragment by constant.
This works for namespaced constants.
:: is invalid in regular GraphQL syntax, but
#parse makes an initial pass on the query string and resolves all the fragment spreads with
Pass the reference of a parsed query definition to
GraphQL::Client#query. Data is returned back in a wrapped
GraphQL::Client::Schema::ObjectType struct that provides Ruby-ish accessors.
GraphQL::Client#query also accepts variables and context parameters that can be leveraged by the underlying network executor.
For a detailed guide, be sure to check out the official github page here