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
The Most Powerful Software Platform for EHSQ and ESG Management Icon
The Most Powerful Software Platform for EHSQ and ESG Management

Addresses the needs of small businesses and large global organizations with thousands of users in multiple locations.

Choose from a complete set of software solutions across EHSQ that address all aspects of top performing Environmental, Health and Safety, and Quality management programs.
Learn More
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