Sha256: c8e34716d33414327f056d0327f83e6dfb559cf0e9930e6b1c19159a3a0ce90e
Contents?: true
Size: 751 Bytes
Versions: 1
Compression:
Stored size: 751 Bytes
Contents
require "github/graphql/client/version" require "graphql/client" require "graphql/client/http" module GitHub module GraphQL URL = 'https://api.github.com/graphql'.freeze class Client def initialize(token: ) http = ::GraphQL::Client::HTTP.new(GitHub::GraphQL::URL) do define_method :headers, ->(context) { context.merge({"Authorization" => "bearer #{token}"}) } end schema = ::GraphQL::Client.load_schema(http) @client = ::GraphQL::Client.new(schema: schema, execute: http) @client.allow_dynamic_queries = true end def query(query_string) query = @client.parse(query_string) result = @client.query(query) result.data end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
github-graphql-client-0.1.0 | lib/github/graphql/client.rb |