Module: Github

Defined in:
lib/github_api/error/client_error.rb,
lib/github_api.rb,
lib/github_api/api.rb,
lib/github_api/mash.rb,
lib/github_api/error.rb,
lib/github_api/client.rb,
lib/github_api/request.rb,
lib/github_api/version.rb,
lib/github_api/response.rb,
lib/github_api/constants.rb,
lib/github_api/mime_type.rb,
lib/github_api/utils/url.rb,
lib/github_api/api/config.rb,
lib/github_api/client/say.rb,
lib/github_api/connection.rb,
lib/github_api/middleware.rb,
lib/github_api/normalizer.rb,
lib/github_api/page_links.rb,
lib/github_api/pagination.rb,
lib/github_api/rate_limit.rb,
lib/github_api/api/actions.rb,
lib/github_api/api/factory.rb,
lib/github_api/client/meta.rb,
lib/github_api/client/orgs.rb,
lib/github_api/deprecation.rb,
lib/github_api/params_hash.rb,
lib/github_api/validations.rb,
lib/github_api/client/gists.rb,
lib/github_api/client/repos.rb,
lib/github_api/client/users.rb,
lib/github_api/null_encoder.rb,
lib/github_api/api/arguments.rb,
lib/github_api/authorization.rb,
lib/github_api/client/emojis.rb,
lib/github_api/client/issues.rb,
lib/github_api/client/scopes.rb,
lib/github_api/client/search.rb,
lib/github_api/configuration.rb,
lib/github_api/page_iterator.rb,
lib/github_api/paged_request.rb,
lib/github_api/request/verbs.rb,
lib/github_api/request/oauth2.rb,
lib/github_api/client/activity.rb,
lib/github_api/client/git_data.rb,
lib/github_api/client/markdown.rb,
lib/github_api/client/projects.rb,
lib/github_api/request/jsonize.rb,
lib/github_api/response/header.rb,
lib/github_api/response/xmlize.rb,
lib/github_api/client/gitignore.rb,
lib/github_api/parameter_filter.rb,
lib/github_api/response/jsonize.rb,
lib/github_api/response/mashify.rb,
lib/github_api/response_wrapper.rb,
lib/github_api/client/orgs/hooks.rb,
lib/github_api/client/orgs/teams.rb,
lib/github_api/client/repos/keys.rb,
lib/github_api/client/users/keys.rb,
lib/github_api/validations/token.rb,
lib/github_api/client/repos/forks.rb,
lib/github_api/client/repos/hooks.rb,
lib/github_api/client/repos/pages.rb,
lib/github_api/request/basic_auth.rb,
lib/github_api/validations/format.rb,
lib/github_api/api/config/property.rb,
lib/github_api/client/orgs/members.rb,
lib/github_api/client/users/emails.rb,
lib/github_api/error/service_error.rb,
lib/github_api/client/git_data/tags.rb,
lib/github_api/client/issues/events.rb,
lib/github_api/client/issues/labels.rb,
lib/github_api/client/orgs/projects.rb,
lib/github_api/client/pull_requests.rb,
lib/github_api/client/repos/commits.rb,
lib/github_api/client/repos/merging.rb,
lib/github_api/client/search/legacy.rb,
lib/github_api/response/atom_parser.rb,
lib/github_api/response/raise_error.rb,
lib/github_api/validations/presence.rb,
lib/github_api/validations/required.rb,
lib/github_api/client/activity/feeds.rb,
lib/github_api/client/authorizations.rb,
lib/github_api/client/gists/comments.rb,
lib/github_api/client/git_data/blobs.rb,
lib/github_api/client/git_data/trees.rb,
lib/github_api/client/projects/cards.rb,
lib/github_api/client/repos/branches.rb,
lib/github_api/client/repos/comments.rb,
lib/github_api/client/repos/contents.rb,
lib/github_api/client/repos/projects.rb,
lib/github_api/client/repos/releases.rb,
lib/github_api/client/repos/statuses.rb,
lib/github_api/client/activity/events.rb,
lib/github_api/client/issues/comments.rb,
lib/github_api/client/repos/downloads.rb,
lib/github_api/client/users/followers.rb,
lib/github_api/api/config/property_set.rb,
lib/github_api/client/git_data/commits.rb,
lib/github_api/client/issues/assignees.rb,
lib/github_api/client/orgs/memberships.rb,
lib/github_api/client/projects/columns.rb,
lib/github_api/client/repos/statistics.rb,
lib/github_api/client/activity/starring.rb,
lib/github_api/client/activity/watching.rb,
lib/github_api/client/issues/milestones.rb,
lib/github_api/client/repos/deployments.rb,
lib/github_api/client/repos/invitations.rb,
lib/github_api/client/authorizations/app.rb,
lib/github_api/response/follow_redirects.rb,
lib/github_api/client/git_data/references.rb,
lib/github_api/client/repos/collaborators.rb,
lib/github_api/client/repos/releases/tags.rb,
lib/github_api/client/repos/pub_sub_hubbub.rb,
lib/github_api/client/pull_requests/reviews.rb,
lib/github_api/client/repos/releases/assets.rb,
lib/github_api/client/activity/notifications.rb,
lib/github_api/client/pull_requests/comments.rb,
lib/github_api/client/repos/branches/protections.rb

Overview

First saw on octokit, then copied from lostisland/faraday_middleware and adapted for this library.

faraday_middleware/lib/faraday_middleware/response/follow_redirects.rb

Defined Under Namespace

Modules: Authorization, Connection, Constants, Error, MimeType, Normalizer, NullParamsEncoder, PagedRequest, Pagination, ParameterFilter, RateLimit, Utils, Validations Classes: API, Client, Configuration, Mash, Middleware, PageIterator, PageLinks, ParamsHash, RedirectLimitReached, Request, Response, ResponseWrapper

Constant Summary collapse

LIBNAME =
'github_api'
LIBDIR =
File.expand_path("../#{LIBNAME}", __FILE__)
VERSION =
"0.19.0"
DEPRECATION_PREFIX =
"[GithubAPI] Deprecation warning:"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.deprecation_trackerObject



11
12
13
# File 'lib/github_api/deprecation.rb', line 11

def deprecation_tracker
  @deprecation_tracker ||= []
end

Class Method Details

.configurationConfiguration Also known as: config

The client configuration

Returns:



19
20
21
# File 'lib/github_api.rb', line 19

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ nil

Configure options

Examples:

Github.configure do |c|
  c.some_option = true
end

Yields:

  • the configuration block

Yield Parameters:

Returns:

  • (nil)


38
39
40
# File 'lib/github_api.rb', line 38

def configure
  yield configuration
end

.default_middleware(options = {}) ⇒ Proc

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Default middleware stack that uses default adapter as specified by configuration setup

Returns:

  • (Proc)


60
61
62
# File 'lib/github_api.rb', line 60

def default_middleware(options = {})
  Middleware.default(options)
end

.deprecate(method, alternate_method = nil) ⇒ Object

Displays deprecation message to the user. Each message is printed once.



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

def deprecate(method, alternate_method=nil)
  return if deprecation_tracker.include? method
  deprecation_tracker << method

  message = <<-NOTICE
#{DEPRECATION_PREFIX}

* #{method} is deprecated.
NOTICE
  if alternate_method
    message << <<-ADDITIONAL
* please use #{alternate_method} instead.
ADDITIONAL
  end
  warn_deprecation(message)
end

.method_missing(method_name, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Delegate to Github::Client



67
68
69
70
71
72
73
74
75
# File 'lib/github_api.rb', line 67

def method_missing(method_name, *args, &block)
  if new.respond_to?(method_name)
    new.send(method_name, *args, &block)
  elsif configuration.respond_to?(method_name)
    Github.configuration.send(method_name, *args, &block)
  else
    super
  end
end

.new(options = {}, &block) ⇒ Github::Client

Alias for Github::Client.new

Parameters:

  • options (Hash) (defaults to: {})

    the configuration options

Returns:



50
51
52
# File 'lib/github_api.rb', line 50

def new(options = {}, &block)
  Client.new(options, &block)
end

.respond_to?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


77
78
79
80
81
# File 'lib/github_api.rb', line 77

def respond_to?(method_name, include_private = false)
  new.respond_to?(method_name, include_private) ||
  configuration.respond_to?(method_name) ||
  super(method_name, include_private)
end

.warn_deprecation(message) ⇒ Object



34
35
36
# File 'lib/github_api/deprecation.rb', line 34

def warn_deprecation(message)
  send :warn, message
end