module NetworkProfile::GithubGraphql
Public Instance Methods
doc()
click to toggle source
# File lib/network_profile/extractors/github_graphql.rb, line 21 def doc raise NotImplementedError end
json()
click to toggle source
# File lib/network_profile/extractors/github_graphql.rb, line 17 def json @json ||= query!(query) end
query!(query)
click to toggle source
# File lib/network_profile/extractors/github_graphql.rb, line 4 def query!(query) r = Typhoeus.post("https://api.github.com/graphql", body: { query: query }.to_json, headers: { "Authorization": "bearer #{NetworkProfile.github_api_key}" }) if r.success? JSON.parse(r.body).with_indifferent_access else raise ArgumentError, "Fetching query failed: #{r.code}" end end