class GithubGraphQlClient

Constants

GITHUB_GRAPHQL_URL

Attributes

github_token[R]

Public Class Methods

new(params) click to toggle source
# File lib/github_graph_ql_client.rb, line 6
def initialize(params)
  @github_token = params.fetch(:github_token)
end

Private Instance Methods

run_query(params) click to toggle source
# File lib/github_graph_ql_client.rb, line 12
def run_query(params)
  body = params.fetch(:body)
  token = params.fetch(:token)

  json = {query: body}.to_json
  headers = {"Authorization" => "bearer #{token}"}

  uri = URI.parse(GITHUB_GRAPHQL_URL)
  resp = Net::HTTP.post(uri, json, headers)

  resp.body
end