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
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
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