Module: FragmentGraphQl
- Extended by:
- T::Sig
- Defined in:
- lib/fragment_client.rb
Overview
A support module for the client
Constant Summary collapse
- VERSION =
FragmentSDK::VERSION
- CustomHTTP =
Class.new(GraphQL::Client::HTTP) do extend T::Sig sig { params(context: T.untyped).returns(T::Hash[T.untyped, T.untyped]) } def headers(context) { 'Authorization' => format('Bearer %s', context[:access_token]), 'X-Fragment-Client' => format('ruby-client@%s', FragmentGraphQl::VERSION) } end end
- HTTP =
T.let(CustomHTTP.new('https://api.fragment.dev/graphql'), GraphQL::Client::HTTP)
- FragmentSchema =
T.let(GraphQL::Client.load_schema("#{__dir__}/fragment.schema.json"), T.untyped)
- Client =
T.let(GraphQL::Client.new(schema: FragmentSchema, execute: HTTP), GraphQL::Client)
- FragmentQueries =
T.let(Client.parse( File.read("#{__dir__}/queries.graphql") ), T.untyped)