Module: Bundler::Alive::Client::GithubApi
- Defined in:
- lib/bundler/alive/client/github_api.rb
Overview
API Client for GitHub GraphQL API
Constant Summary collapse
- ACCESS_TOKEN_ENV_NAME =
Environment variable name of GitHub Access Token
"BUNDLER_ALIVE_GITHUB_TOKEN"
Class Method Summary collapse
Instance Method Summary collapse
-
#create_client ⇒ GraphQL::Client
Creates a GraphQL client.
-
#query(urls:) ⇒ StatusResult
Query repository statuses.
Class Method Details
.extended(base) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/bundler/alive/client/github_api.rb', line 25 def self.extended(base) base.instance_eval do @rate_limit_exceeded = false @retries_on_too_many_requests = 0 @name_with_archived = {} end end |
Instance Method Details
#create_client ⇒ GraphQL::Client
Creates a GraphQL client
38 39 40 41 42 43 |
# File 'lib/bundler/alive/client/github_api.rb', line 38 def create_client require_relative "github_graphql" extend GithubGraphql GithubGraphql::CLIENT end |
#query(urls:) ⇒ StatusResult
Query repository statuses
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/bundler/alive/client/github_api.rb', line 52 def query(urls:) collection = StatusCollection.new @name_with_archived = get_name_with_statuses(urls) urls.each do |url| gem_name = url.gem_name alive = alive?(gem_name) status = Status.new(name: gem_name, repository_url: url, alive: alive, checked_at: Time.now) collection = collection.add(gem_name, status) end StatusResult.new(collection: collection, error_messages: @error_messages, rate_limit_exceeded: @rate_limit_exceeded) end |