Skip to content

Instantly share code, notes, and snippets.

@gauravtiwari
Created October 2, 2016 10:21
Show Gist options
  • Save gauravtiwari/5227dc0c49e5d3ae02a96051470acb2f to your computer and use it in GitHub Desktop.
Save gauravtiwari/5227dc0c49e5d3ae02a96051470acb2f to your computer and use it in GitHub Desktop.
Initialise graphql client
module API
HTTPAdapter = GraphQL::Client::HTTP.new(ENV['API_URL'])
#
# Pass block to send auth token
# def headers(context)
# {
# "Authorization" => "Bearer #{ENV['ACCESS_TOKEN']}"
# }
# end
#
GraphQL::Client.dump_schema(HTTPAdapter, './api/schema.json')
Client = GraphQL::Client.new(
schema: GraphQL::Client.load_schema('./api/schema.json'),
execute: HTTPAdapter
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment