Module: Octokit

Extended by:
Configurable
Defined in:
lib/octokit.rb,
lib/octokit/gist.rb,
lib/octokit/user.rb,
lib/octokit/error.rb,
lib/octokit/client.rb,
lib/octokit/default.rb,
lib/octokit/version.rb,
lib/octokit/warnable.rb,
lib/octokit/client/say.rb,
lib/octokit/connection.rb,
lib/octokit/rate_limit.rb,
lib/octokit/repository.rb,
lib/octokit/client/apps.rb,
lib/octokit/client/meta.rb,
lib/octokit/client/refs.rb,
lib/octokit/client/feeds.rb,
lib/octokit/client/gists.rb,
lib/octokit/client/hooks.rb,
lib/octokit/client/pages.rb,
lib/octokit/client/stats.rb,
lib/octokit/client/users.rb,
lib/octokit/configurable.rb,
lib/octokit/organization.rb,
lib/octokit/client/checks.rb,
lib/octokit/client/emojis.rb,
lib/octokit/client/events.rb,
lib/octokit/client/issues.rb,
lib/octokit/client/labels.rb,
lib/octokit/client/search.rb,
lib/octokit/client/tokens.rb,
lib/octokit/authentication.rb,
lib/octokit/client/commits.rb,
lib/octokit/client/objects.rb,
lib/octokit/client/reviews.rb,
lib/octokit/client/traffic.rb,
lib/octokit/client/contents.rb,
lib/octokit/client/licenses.rb,
lib/octokit/client/markdown.rb,
lib/octokit/client/projects.rb,
lib/octokit/client/releases.rb,
lib/octokit/client/statuses.rb,
lib/octokit/client/downloads.rb,
lib/octokit/client/gitignore.rb,
lib/octokit/client/reactions.rb,
lib/octokit/client/milestones.rb,
lib/octokit/client/rate_limit.rb,
lib/octokit/client/deployments.rb,
lib/octokit/client/marketplace.rb,
lib/octokit/client/commit_pulls.rb,
lib/octokit/client/environments.rb,
lib/octokit/client/repositories.rb,
lib/octokit/client/code_scanning.rb,
lib/octokit/client/legacy_search.rb,
lib/octokit/client/notifications.rb,
lib/octokit/client/organizations.rb,
lib/octokit/client/pull_requests.rb,
lib/octokit/client/source_import.rb,
lib/octokit/client/pub_sub_hubbub.rb,
lib/octokit/client/service_status.rb,
lib/octokit/client/actions_secrets.rb,
lib/octokit/client/commit_branches.rb,
lib/octokit/client/commit_comments.rb,
lib/octokit/enterprise_admin_client.rb,
lib/octokit/client/actions_artifacts.rb,
lib/octokit/client/actions_workflows.rb,
lib/octokit/client/community_profile.rb,
lib/octokit/client/codespaces_secrets.rb,
lib/octokit/client/dependabot_secrets.rb,
lib/octokit/client/oauth_applications.rb,
lib/octokit/middleware/follow_redirects.rb,
lib/octokit/client/actions_workflow_jobs.rb,
lib/octokit/client/actions_workflow_runs.rb,
lib/octokit/enterprise_admin_client/orgs.rb,
lib/octokit/client/repository_invitations.rb,
lib/octokit/enterprise_admin_client/users.rb,
lib/octokit/enterprise_admin_client/license.rb,
lib/octokit/enterprise_admin_client/admin_stats.rb,
lib/octokit/enterprise_management_console_client.rb,
lib/octokit/enterprise_admin_client/search_indexing.rb,
lib/octokit/enterprise_management_console_client/management_console.rb

Overview

Adapted from lostisland/faraday_middleware. Trimmed down to just the logic that we need for octokit.rb.

https://github.com/lostisland/faraday_middleware/blob/138766e/lib/faraday_middleware/response/follow_redirects.rb

Defined Under Namespace

Modules: Authentication, Configurable, Connection, Default, Middleware, Warnable Classes: AbuseDetected, AccountSuspended, ApplicationCredentialsRequired, BadGateway, BadRequest, BillingIssue, BranchNotProtected, Client, ClientError, CommitIsNotPartOfPullRequest, Conflict, EnterpriseAdminClient, EnterpriseManagementConsoleClient, Error, Forbidden, Gist, InstallationSuspended, InternalServerError, InvalidRepository, MethodNotAllowed, MissingContentType, NotAcceptable, NotFound, NotImplemented, OneTimePasswordRequired, Organization, PathDiffTooLarge, RateLimit, Repository, RepositoryUnavailable, SAMLProtected, ServerError, ServiceUnavailable, TooLargeContent, TooManyLoginAttempts, TooManyRequests, Unauthorized, UnavailableForLegalReasons, UnprocessableEntity, UnsupportedMediaType, UnverifiedEmail, User

Constant Summary collapse

RATE_LIMITED_ERRORS =
[Octokit::TooManyRequests, Octokit::AbuseDetected].freeze
MAJOR =

Current major release.

Returns:

  • (Integer)
8
MINOR =

Current minor release.

Returns:

  • (Integer)
1
PATCH =

Current patch level.

Returns:

  • (Integer)
0
VERSION =

Full release version.

Returns:

  • (String)
[MAJOR, MINOR, PATCH].join('.').freeze

Instance Attribute Summary

Attributes included from Configurable

#access_token, #api_endpoint, #auto_paginate, #bearer_token, #client_id, #client_secret, #connection_options, #default_media_type, #login, #management_console_endpoint, #management_console_password, #middleware, #netrc, #netrc_file, #password, #per_page, #proxy, #ssl_verify_mode, #user_agent, #web_endpoint

Class Method Summary collapse

Methods included from Configurable

configure, keys, netrc?, reset!, same_options?

Class Method Details

.clientOctokit::Client

API client based on configured options Configurable

Returns:



16
17
18
19
20
# File 'lib/octokit.rb', line 16

def client
  return @client if defined?(@client) && @client.same_options?(options)

  @client = Octokit::Client.new(options)
end

.enterprise_admin_clientOctokit::EnterpriseAdminClient

EnterpriseAdminClient client based on configured options Configurable

Returns:



25
26
27
28
29
30
31
# File 'lib/octokit.rb', line 25

def enterprise_admin_client
  if defined?(@enterprise_admin_client) && @enterprise_admin_client.same_options?(options)
    return @enterprise_admin_client
  end

  @enterprise_admin_client = Octokit::EnterpriseAdminClient.new(options)
end

.enterprise_management_console_clientOctokit::EnterpriseManagementConsoleClient

EnterpriseManagementConsoleClient client based on configured options Configurable

Returns:



36
37
38
39
40
41
42
# File 'lib/octokit.rb', line 36

def enterprise_management_console_client
  if defined?(@enterprise_management_console_client) && @enterprise_management_console_client.same_options?(options)
    return @enterprise_management_console_client
  end

  @enterprise_management_console_client = Octokit::EnterpriseManagementConsoleClient.new(options)
end