Module: Octokit

Extended by:
Configurable
Defined in:
lib/octokit.rb,
lib/octokit/gist.rb,
lib/octokit/error.rb,
lib/octokit/client.rb,
lib/octokit/version.rb,
lib/octokit/default.rb,
lib/octokit/arguments.rb,
lib/octokit/client/say.rb,
lib/octokit/rate_limit.rb,
lib/octokit/repository.rb,
lib/octokit/client/meta.rb,
lib/octokit/client/refs.rb,
lib/octokit/configurable.rb,
lib/octokit/client/users.rb,
lib/octokit/client/gists.rb,
lib/octokit/client/stats.rb,
lib/octokit/client/feeds.rb,
lib/octokit/client/pages.rb,
lib/octokit/client/hooks.rb,
lib/octokit/client/search.rb,
lib/octokit/client/labels.rb,
lib/octokit/client/issues.rb,
lib/octokit/client/events.rb,
lib/octokit/client/emojis.rb,
lib/octokit/authentication.rb,
lib/octokit/client/objects.rb,
lib/octokit/client/commits.rb,
lib/octokit/repo_arguments.rb,
lib/octokit/client/releases.rb,
lib/octokit/client/markdown.rb,
lib/octokit/client/contents.rb,
lib/octokit/client/statuses.rb,
lib/octokit/client/gitignore.rb,
lib/octokit/client/downloads.rb,
lib/octokit/client/rate_limit.rb,
lib/octokit/client/milestones.rb,
lib/octokit/client/deployments.rb,
lib/octokit/client/repositories.rb,
lib/octokit/client/legacy_search.rb,
lib/octokit/response/raise_error.rb,
lib/octokit/client/notifications.rb,
lib/octokit/response/feed_parser.rb,
lib/octokit/client/pull_requests.rb,
lib/octokit/client/organizations.rb,
lib/octokit/client/authorizations.rb,
lib/octokit/client/pub_sub_hubbub.rb,
lib/octokit/client/service_status.rb,
lib/octokit/client/commit_comments.rb

Overview

Ruby toolkit for the GitHub API

Defined Under Namespace

Modules: Authentication, Configurable, Default, Response Classes: ApplicationCredentialsRequired, Arguments, BadGateway, BadRequest, Client, ClientError, Conflict, Error, Forbidden, Gist, InternalServerError, MissingContentType, NotAcceptable, NotFound, NotImplemented, OneTimePasswordRequired, RateLimit, RepoArguments, Repository, ServerError, ServiceUnavailable, TooManyLoginAttempts, TooManyRequests, Unauthorized, UnprocessableEntity, UnsupportedMediaType

Constant Summary

VERSION =

Current version

Returns:

  • (String)
"3.1.0".freeze

Instance Attribute Summary (collapse)

Attributes included from Configurable

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

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from Configurable

configure, keys, netrc?, reset!

Instance Attribute Details

- (Fixnum) limit=(value) (writeonly)

Returns Max tries per rate limit period

Returns:

  • (Fixnum)

    Max tries per rate limit period



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/octokit/rate_limit.rb', line 15

class RateLimit < Struct.new(:limit, :remaining, :resets_at, :resets_in)

  # Get rate limit info from HTTP response
  #
  # @param response [#headers] HTTP response
  # @return [RateLimit]
  def self.from_response(response)
    info = new
    if response && !response.headers.nil?
      info.limit = (response.headers['X-RateLimit-Limit'] || 1).to_i
      info.remaining = (response.headers['X-RateLimit-Remaining'] || 1).to_i
      info.resets_at = Time.at((response.headers['X-RateLimit-Reset'] || Time.now).to_i)
      info.resets_in = (info.resets_at - Time.now).to_i
    end

    info
  end
end

- (Fixnum) remaining=(value) (writeonly)

Returns Remaining tries per rate limit period

Returns:

  • (Fixnum)

    Remaining tries per rate limit period



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/octokit/rate_limit.rb', line 15

class RateLimit < Struct.new(:limit, :remaining, :resets_at, :resets_in)

  # Get rate limit info from HTTP response
  #
  # @param response [#headers] HTTP response
  # @return [RateLimit]
  def self.from_response(response)
    info = new
    if response && !response.headers.nil?
      info.limit = (response.headers['X-RateLimit-Limit'] || 1).to_i
      info.remaining = (response.headers['X-RateLimit-Remaining'] || 1).to_i
      info.resets_at = Time.at((response.headers['X-RateLimit-Reset'] || Time.now).to_i)
      info.resets_in = (info.resets_at - Time.now).to_i
    end

    info
  end
end

- (Time) resets_at=(value) (writeonly)

Returns Indicates when rate limit resets

Returns:

  • (Time)

    Indicates when rate limit resets



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/octokit/rate_limit.rb', line 15

class RateLimit < Struct.new(:limit, :remaining, :resets_at, :resets_in)

  # Get rate limit info from HTTP response
  #
  # @param response [#headers] HTTP response
  # @return [RateLimit]
  def self.from_response(response)
    info = new
    if response && !response.headers.nil?
      info.limit = (response.headers['X-RateLimit-Limit'] || 1).to_i
      info.remaining = (response.headers['X-RateLimit-Remaining'] || 1).to_i
      info.resets_at = Time.at((response.headers['X-RateLimit-Reset'] || Time.now).to_i)
      info.resets_in = (info.resets_at - Time.now).to_i
    end

    info
  end
end

- (Fixnum) resets_in=(value) (writeonly)

Returns Number of seconds when rate limit resets

Returns:

  • (Fixnum)

    Number of seconds when rate limit resets



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/octokit/rate_limit.rb', line 15

class RateLimit < Struct.new(:limit, :remaining, :resets_at, :resets_in)

  # Get rate limit info from HTTP response
  #
  # @param response [#headers] HTTP response
  # @return [RateLimit]
  def self.from_response(response)
    info = new
    if response && !response.headers.nil?
      info.limit = (response.headers['X-RateLimit-Limit'] || 1).to_i
      info.remaining = (response.headers['X-RateLimit-Remaining'] || 1).to_i
      info.resets_at = Time.at((response.headers['X-RateLimit-Reset'] || Time.now).to_i)
      info.resets_in = (info.resets_at - Time.now).to_i
    end

    info
  end
end

Class Method Details

+ (Octokit::Client) client

API client based on configured options Configurable

Returns:



13
14
15
16
# File 'lib/octokit.rb', line 13

def client
  @client = Octokit::Client.new(options) unless defined?(@client) && @client.same_options?(options)
  @client
end

Instance Method Details

- (Boolean) respond_to?(method_name, include_private = false)

Returns:

  • (Boolean)


21
# File 'lib/octokit.rb', line 21

def respond_to?(method_name, include_private=false); client.respond_to?(method_name, include_private) || super; end

- (Boolean) respond_to_missing?(method_name, include_private = false)

Returns:

  • (Boolean)


19
# File 'lib/octokit.rb', line 19

def respond_to_missing?(method_name, include_private=false); client.respond_to?(method_name, include_private); end