Class: GithubApi::GraphQlClient
- Inherits:
-
Object
- Object
- GithubApi::GraphQlClient
- Includes:
- Issues
- Defined in:
- lib/tractive/github_api/graph_ql_client.rb,
lib/tractive/github_api/graph_ql_client/issues.rb
Defined Under Namespace
Modules: Issues
Constant Summary collapse
- HttpAdapter =
GraphQL::Client::HTTP.new("https://api.github.com/graphql") do attr_writer :token def headers(_context) { "Authorization" => "bearer #{@token}" } end end
Constants included from Issues
Class Method Summary collapse
Methods included from Issues
Class Method Details
.add_constants(token) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/tractive/github_api/graph_ql_client.rb', line 23 def self.add_constants(token) HttpAdapter.token = token GithubApi::GraphQlClient.const_set("Schema", GraphQL::Client.load_schema(HttpAdapter)) GithubApi::GraphQlClient.const_set("Client", GraphQL::Client.new(schema: Schema, execute: HttpAdapter)) GithubApi::GraphQlClient.const_set("DeleteIssueQuery", Client.parse(DELETE_ISSUE_QUERY)) rescue KeyError raise ::StandardError, "Github access token is incorrect or does not have sufficent permissions to access the Github API" end |