GraphQL Client is a Ruby library for declaring, composing and executing GraphQL queries. Sample configuration for a GraphQL Client to query from the SWAPI GraphQL Wrapper. 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. If you're using Ruby on Rails ERB templates, theres a ERB extension that allows static queries to be defined in the template itself. In standard Ruby you can simply assign queries and fragments to constants and they'll be available throughout the app. However, the contents of an ERB template is compiled into a Ruby method, and methods can't assign constants. So a new ERB tag was extended to declare static sections that include a GraphQL query.

Features

  • 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
  • Add graphql-client to your Gemfile and then run bundle install
  • Ruby library for declaring, composing and executing GraphQL queries

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

MIT License

Follow graphql-client

graphql-client Web Site

Other Useful Business Software
Earn up to 16% annual interest with Nexo. Icon
Earn up to 16% annual interest with Nexo.

Let your crypto work for you

Put idle assets to work with competitive interest rates, borrow without selling, and trade with precision. All in one platform. Geographic restrictions, eligibility, and terms apply.
Get started with Nexo.
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of graphql-client!

Additional Project Details

Programming Language

Ruby

Related Categories

Ruby Libraries

Registered

2023-03-06