octokit 4.21.0 → 4.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +90 -63
  3. data/Rakefile +5 -3
  4. data/lib/ext/sawyer/relation.rb +4 -2
  5. data/lib/octokit/arguments.rb +2 -2
  6. data/lib/octokit/authentication.rb +10 -3
  7. data/lib/octokit/client/actions_secrets.rb +2 -3
  8. data/lib/octokit/client/actions_workflow_runs.rb +2 -0
  9. data/lib/octokit/client/actions_workflows.rb +2 -1
  10. data/lib/octokit/client/apps.rb +26 -26
  11. data/lib/octokit/client/authorizations.rb +20 -17
  12. data/lib/octokit/client/checks.rb +18 -9
  13. data/lib/octokit/client/commit_branches.rb +2 -2
  14. data/lib/octokit/client/commit_comments.rb +8 -8
  15. data/lib/octokit/client/commit_pulls.rb +2 -2
  16. data/lib/octokit/client/commits.rb +31 -34
  17. data/lib/octokit/client/community_profile.rb +2 -2
  18. data/lib/octokit/client/contents.rb +20 -21
  19. data/lib/octokit/client/deployments.rb +6 -6
  20. data/lib/octokit/client/downloads.rb +5 -6
  21. data/lib/octokit/client/emojis.rb +3 -3
  22. data/lib/octokit/client/events.rb +4 -4
  23. data/lib/octokit/client/feeds.rb +4 -5
  24. data/lib/octokit/client/gists.rb +6 -6
  25. data/lib/octokit/client/gitignore.rb +3 -3
  26. data/lib/octokit/client/hooks.rb +10 -10
  27. data/lib/octokit/client/issues.rb +14 -14
  28. data/lib/octokit/client/labels.rb +10 -10
  29. data/lib/octokit/client/legacy_search.rb +3 -3
  30. data/lib/octokit/client/licenses.rb +3 -3
  31. data/lib/octokit/client/markdown.rb +3 -3
  32. data/lib/octokit/client/marketplace.rb +4 -4
  33. data/lib/octokit/client/meta.rb +4 -5
  34. data/lib/octokit/client/milestones.rb +5 -5
  35. data/lib/octokit/client/notifications.rb +6 -6
  36. data/lib/octokit/client/oauth_applications.rb +0 -2
  37. data/lib/octokit/client/objects.rb +14 -14
  38. data/lib/octokit/client/organizations.rb +48 -48
  39. data/lib/octokit/client/pages.rb +3 -3
  40. data/lib/octokit/client/projects.rb +18 -19
  41. data/lib/octokit/client/pub_sub_hubbub.rb +16 -16
  42. data/lib/octokit/client/pull_requests.rb +41 -42
  43. data/lib/octokit/client/rate_limit.rb +9 -11
  44. data/lib/octokit/client/reactions.rb +6 -6
  45. data/lib/octokit/client/refs.rb +14 -15
  46. data/lib/octokit/client/releases.rb +13 -13
  47. data/lib/octokit/client/repositories.rb +36 -36
  48. data/lib/octokit/client/repository_invitations.rb +3 -3
  49. data/lib/octokit/client/reviews.rb +7 -7
  50. data/lib/octokit/client/say.rb +4 -5
  51. data/lib/octokit/client/search.rb +9 -9
  52. data/lib/octokit/client/service_status.rb +19 -9
  53. data/lib/octokit/client/source_import.rb +6 -6
  54. data/lib/octokit/client/stats.rb +10 -9
  55. data/lib/octokit/client/statuses.rb +5 -5
  56. data/lib/octokit/client/traffic.rb +2 -3
  57. data/lib/octokit/client/users.rb +27 -26
  58. data/lib/octokit/client.rb +28 -14
  59. data/lib/octokit/configurable.rb +33 -27
  60. data/lib/octokit/connection.rb +22 -23
  61. data/lib/octokit/default.rb +30 -18
  62. data/lib/octokit/enterprise_admin_client/admin_stats.rb +13 -14
  63. data/lib/octokit/enterprise_admin_client/license.rb +3 -4
  64. data/lib/octokit/enterprise_admin_client/orgs.rb +3 -4
  65. data/lib/octokit/enterprise_admin_client/search_indexing.rb +7 -8
  66. data/lib/octokit/enterprise_admin_client/users.rb +5 -4
  67. data/lib/octokit/enterprise_admin_client.rb +9 -3
  68. data/lib/octokit/enterprise_management_console_client/management_console.rb +32 -32
  69. data/lib/octokit/enterprise_management_console_client.rb +8 -2
  70. data/lib/octokit/error.rb +27 -23
  71. data/lib/octokit/gist.rb +2 -3
  72. data/lib/octokit/middleware/follow_redirects.rb +15 -11
  73. data/lib/octokit/organization.rb +3 -1
  74. data/lib/octokit/preview.rb +29 -29
  75. data/lib/octokit/rate_limit.rb +3 -3
  76. data/lib/octokit/repo_arguments.rb +2 -3
  77. data/lib/octokit/repository.rb +23 -24
  78. data/lib/octokit/response/base_middleware.rb +10 -0
  79. data/lib/octokit/response/feed_parser.rb +5 -7
  80. data/lib/octokit/response/raise_error.rb +4 -4
  81. data/lib/octokit/user.rb +4 -2
  82. data/lib/octokit/version.rb +3 -1
  83. data/lib/octokit/warnable.rb +4 -5
  84. data/lib/octokit.rb +15 -8
  85. data/octokit.gemspec +11 -9
  86. metadata +19 -17
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'faraday'
2
4
  require 'set'
3
5
 
@@ -7,9 +9,7 @@ require 'set'
7
9
  # https://github.com/lostisland/faraday_middleware/blob/138766e/lib/faraday_middleware/response/follow_redirects.rb
8
10
 
9
11
  module Octokit
10
-
11
12
  module Middleware
12
-
13
13
  # Public: Exception thrown when the maximum amount of requests is exceeded.
14
14
  class RedirectLimitReached < Faraday::ClientError
15
15
  attr_reader :response
@@ -30,13 +30,13 @@ module Octokit
30
30
  # doesn't support parallelism.
31
31
  class FollowRedirects < Faraday::Middleware
32
32
  # HTTP methods for which 30x redirects can be followed
33
- ALLOWED_METHODS = Set.new [:head, :options, :get, :post, :put, :patch, :delete]
33
+ ALLOWED_METHODS = Set.new %i[head options get post put patch delete]
34
34
 
35
35
  # HTTP redirect status codes that this middleware implements
36
36
  REDIRECT_CODES = Set.new [301, 302, 303, 307]
37
37
 
38
38
  # Keys in env hash which will get cleared between requests
39
- ENV_TO_CLEAR = Set.new [:status, :response, :response_headers]
39
+ ENV_TO_CLEAR = Set.new %i[status response response_headers]
40
40
 
41
41
  # Default value for max redirects followed
42
42
  FOLLOW_LIMIT = 3
@@ -44,7 +44,7 @@ module Octokit
44
44
  # Regex that matches characters that need to be escaped in URLs, sans
45
45
  # the "%" character which we assume already represents an escaped
46
46
  # sequence.
47
- URI_UNSAFE = /[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]%]/
47
+ URI_UNSAFE = %r{[^\-_.!~*'()a-zA-Z\d;/?:@&=+$,\[\]%]}.freeze
48
48
 
49
49
  # Public: Initialize the middleware.
50
50
  #
@@ -64,7 +64,7 @@ module Octokit
64
64
  private
65
65
 
66
66
  def convert_to_get?(response)
67
- ![:head, :options].include?(response.env[:method]) &&
67
+ !%i[head options].include?(response.env[:method]) &&
68
68
  @convert_to_get.include?(response.status)
69
69
  end
70
70
 
@@ -75,6 +75,7 @@ module Octokit
75
75
  response.on_complete do |response_env|
76
76
  if follow_redirect?(response_env, response)
77
77
  raise(RedirectLimitReached, response) if follows.zero?
78
+
78
79
  new_request_env = update_env(response_env, request_body, response)
79
80
  response = perform_with_redirection(new_request_env, follows - 1)
80
81
  end
@@ -84,9 +85,12 @@ module Octokit
84
85
 
85
86
  def update_env(env, request_body, response)
86
87
  original_url = env[:url]
87
- env[:url] += safe_escape(response["location"])
88
+ env[:url] += safe_escape(response['location'])
88
89
  unless same_host?(original_url, env[:url])
89
- env[:request_headers].delete("Authorization")
90
+ # HACK: Faraday’s Authorization middlewares don’t touch the request if the `Authorization` header is set.
91
+ # This is a workaround to drop authentication info.
92
+ # See https://github.com/octokit/octokit.rb/pull/1359#issuecomment-925609697
93
+ env[:request_headers]['Authorization'] = 'dummy'
90
94
  end
91
95
 
92
96
  if convert_to_get?(response)
@@ -122,9 +126,9 @@ module Octokit
122
126
  # URI:HTTP using the `+` operator. Doesn't escape "%" characters so to not
123
127
  # risk double-escaping.
124
128
  def safe_escape(uri)
125
- uri.to_s.gsub(URI_UNSAFE) { |match|
126
- "%" + match.unpack("H2" * match.bytesize).join("%").upcase
127
- }
129
+ uri.to_s.gsub(URI_UNSAFE) do |match|
130
+ '%' + match.unpack('H2' * match.bytesize).join('%').upcase
131
+ end
128
132
  end
129
133
  end
130
134
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  # GitHub organization class to generate API path urls
3
5
  class Organization
@@ -5,7 +7,7 @@ module Octokit
5
7
  #
6
8
  # @param org [String, Integer] GitHub organization login or id
7
9
  # @return [String] Organization Api path
8
- def self.path org
10
+ def self.path(org)
9
11
  case org
10
12
  when String
11
13
  "orgs/#{org}"
@@ -1,31 +1,31 @@
1
- module Octokit
1
+ # frozen_string_literal: true
2
2
 
3
+ module Octokit
3
4
  # Default setup options for preview features
4
5
  module Preview
5
-
6
6
  PREVIEW_TYPES = {
7
- :applications_api => 'application/vnd.github.doctor-strange-preview+json'.freeze,
8
- :branch_protection => 'application/vnd.github.luke-cage-preview+json'.freeze,
9
- :commit_search => 'application/vnd.github.cloak-preview+json'.freeze,
10
- :commit_pulls => 'application/vnd.github.groot-preview+json'.freeze,
11
- :commit_branches => 'application/vnd.github.groot-preview+json'.freeze,
12
- :migrations => 'application/vnd.github.wyandotte-preview+json'.freeze,
13
- :licenses => 'application/vnd.github.drax-preview+json'.freeze,
14
- :source_imports => 'application/vnd.github.barred-rock-preview'.freeze,
15
- :reactions => 'application/vnd.github.squirrel-girl-preview'.freeze,
16
- :transfer_repository => 'application/vnd.github.nightshade-preview+json'.freeze,
17
- :issue_timelines => 'application/vnd.github.mockingbird-preview+json'.freeze,
18
- :nested_teams => 'application/vnd.github.hellcat-preview+json'.freeze,
19
- :pages => 'application/vnd.github.mister-fantastic-preview+json'.freeze,
20
- :projects => 'application/vnd.github.inertia-preview+json'.freeze,
21
- :traffic => 'application/vnd.github.spiderman-preview'.freeze,
22
- :topics => 'application/vnd.github.mercy-preview+json'.freeze,
23
- :community_profile => 'application/vnd.github.black-panther-preview+json'.freeze,
24
- :strict_validation => 'application/vnd.github.speedy-preview+json'.freeze,
25
- :template_repositories => 'application/vnd.github.baptiste-preview+json'.freeze,
26
- :project_card_events => 'application/vnd.github.starfox-preview+json'.freeze,
27
- :vulnerability_alerts => 'application/vnd.github.dorian-preview+json'.freeze,
28
- }
7
+ applications_api: 'application/vnd.github.doctor-strange-preview+json',
8
+ branch_protection: 'application/vnd.github.luke-cage-preview+json',
9
+ commit_search: 'application/vnd.github.cloak-preview+json',
10
+ commit_pulls: 'application/vnd.github.groot-preview+json',
11
+ commit_branches: 'application/vnd.github.groot-preview+json',
12
+ migrations: 'application/vnd.github.wyandotte-preview+json',
13
+ licenses: 'application/vnd.github.drax-preview+json',
14
+ source_imports: 'application/vnd.github.barred-rock-preview',
15
+ reactions: 'application/vnd.github.squirrel-girl-preview',
16
+ transfer_repository: 'application/vnd.github.nightshade-preview+json',
17
+ issue_timelines: 'application/vnd.github.mockingbird-preview+json',
18
+ nested_teams: 'application/vnd.github.hellcat-preview+json',
19
+ pages: 'application/vnd.github.mister-fantastic-preview+json',
20
+ projects: 'application/vnd.github.inertia-preview+json',
21
+ traffic: 'application/vnd.github.spiderman-preview',
22
+ topics: 'application/vnd.github.mercy-preview+json',
23
+ community_profile: 'application/vnd.github.black-panther-preview+json',
24
+ strict_validation: 'application/vnd.github.speedy-preview+json',
25
+ template_repositories: 'application/vnd.github.baptiste-preview+json',
26
+ project_card_events: 'application/vnd.github.starfox-preview+json',
27
+ vulnerability_alerts: 'application/vnd.github.dorian-preview+json'
28
+ }.freeze
29
29
 
30
30
  def ensure_api_media_type(type, options)
31
31
  if options[:accept].nil?
@@ -36,11 +36,11 @@ module Octokit
36
36
  end
37
37
 
38
38
  def warn_preview(type)
39
- octokit_warn <<-EOS
40
- WARNING: The preview version of the #{type.to_s.capitalize} API is not yet suitable for production use.
41
- You can avoid this message by supplying an appropriate media type in the 'Accept' request
42
- header.
43
- EOS
39
+ octokit_warn <<~EOS
40
+ WARNING: The preview version of the #{type.to_s.capitalize} API is not yet suitable for production use.
41
+ You can avoid this message by supplying an appropriate media type in the 'Accept' request
42
+ header.
43
+ EOS
44
44
  end
45
45
  end
46
46
  end
@@ -1,5 +1,6 @@
1
- module Octokit
1
+ # frozen_string_literal: true
2
2
 
3
+ module Octokit
3
4
  # Class for API Rate Limit info
4
5
  #
5
6
  # @!attribute [w] limit
@@ -13,14 +14,13 @@ module Octokit
13
14
  #
14
15
  # @see https://developer.github.com/v3/#rate-limiting
15
16
  class RateLimit < Struct.new(:limit, :remaining, :resets_at, :resets_in)
16
-
17
17
  # Get rate limit info from HTTP response
18
18
  #
19
19
  # @param response [#headers] HTTP response
20
20
  # @return [RateLimit]
21
21
  def self.from_response(response)
22
22
  info = new
23
- if response && response.respond_to?(:headers) && !response.headers.nil?
23
+ if response&.respond_to?(:headers) && !response.headers.nil?
24
24
  info.limit = (response.headers['X-RateLimit-Limit'] || 1).to_i
25
25
  info.remaining = (response.headers['X-RateLimit-Remaining'] || 1).to_i
26
26
  info.resets_at = Time.at((response.headers['X-RateLimit-Reset'] || Time.now).to_i)
@@ -1,9 +1,9 @@
1
- module Octokit
1
+ # frozen_string_literal: true
2
2
 
3
+ module Octokit
3
4
  # Class to extract options from Ruby arguments for
4
5
  # Repository-related methods
5
6
  class RepoArguments < Arguments
6
-
7
7
  # !@attribute [r] repo
8
8
  # @return [Repository]
9
9
  attr_reader :repo
@@ -14,6 +14,5 @@ module Octokit
14
14
 
15
15
  arguments
16
16
  end
17
-
18
17
  end
19
18
  end
@@ -1,19 +1,20 @@
1
- module Octokit
1
+ # frozen_string_literal: true
2
2
 
3
+ module Octokit
3
4
  # Class to parse GitHub repository owner and name from
4
5
  # URLs and to generate URLs
5
6
  class Repository
6
7
  attr_accessor :owner, :name, :id
7
- NAME_WITH_OWNER_PATTERN = /\A[\w.-]+\/[\w.-]+\z/i
8
+ NAME_WITH_OWNER_PATTERN = %r{\A[\w.-]+/[\w.-]+\z}i.freeze
8
9
 
9
10
  # Instantiate from a GitHub repository URL
10
11
  #
11
12
  # @return [Repository]
12
13
  def self.from_url(url)
13
- new URI.parse(url).path[1..-1].
14
- gsub(/^repos\//,'').
15
- split('/', 3)[0..1].
16
- join('/')
14
+ new URI.parse(url).path[1..-1]
15
+ .gsub(%r{^repos/}, '')
16
+ .split('/', 3)[0..1]
17
+ .join('/')
17
18
  end
18
19
 
19
20
  # @raise [Octokit::InvalidRepository] if the repository
@@ -23,7 +24,7 @@ module Octokit
23
24
  when Integer
24
25
  @id = repo
25
26
  when NAME_WITH_OWNER_PATTERN
26
- @owner, @name = repo.split("/")
27
+ @owner, @name = repo.split('/')
27
28
  when Repository
28
29
  @owner = repo.owner
29
30
  @name = repo.name
@@ -33,9 +34,7 @@ module Octokit
33
34
  else
34
35
  raise_invalid_repository!(repo)
35
36
  end
36
- if @owner && @name
37
- validate_owner_and_name!(repo)
38
- end
37
+ validate_owner_and_name!(repo) if @owner && @name
39
38
  end
40
39
 
41
40
  # Repository owner/name
@@ -43,7 +42,7 @@ module Octokit
43
42
  def slug
44
43
  "#{@owner}/#{@name}"
45
44
  end
46
- alias :to_s :slug
45
+ alias to_s slug
47
46
 
48
47
  # @return [String] Repository API path
49
48
  def path
@@ -54,7 +53,7 @@ module Octokit
54
53
  # Get the api path for a repo
55
54
  # @param repo [Integer, String, Hash, Repository] A GitHub repository.
56
55
  # @return [String] Api path.
57
- def self.path repo
56
+ def self.path(repo)
58
57
  new(repo).path
59
58
  end
60
59
 
@@ -74,22 +73,22 @@ module Octokit
74
73
  "#{Octokit.web_endpoint}#{slug}"
75
74
  end
76
75
 
77
- alias :user :owner
78
- alias :username :owner
79
- alias :repo :name
76
+ alias user owner
77
+ alias username owner
78
+ alias repo name
80
79
 
81
80
  private
82
81
 
83
- def validate_owner_and_name!(repo)
84
- if @owner.include?('/') || @name.include?('/') || !url.match(URI::ABS_URI)
85
- raise_invalid_repository!(repo)
86
- end
82
+ def validate_owner_and_name!(repo)
83
+ if @owner.include?('/') || @name.include?('/') || !url.match(URI::ABS_URI)
84
+ raise_invalid_repository!(repo)
87
85
  end
86
+ end
88
87
 
89
- def raise_invalid_repository!(repo)
90
- msg = "#{repo.inspect} is invalid as a repository identifier. " +
91
- "Use the user/repo (String) format, or the repository ID (Integer), or a hash containing :repo and :user keys."
92
- raise Octokit::InvalidRepository, msg
93
- end
88
+ def raise_invalid_repository!(repo)
89
+ msg = "#{repo.inspect} is invalid as a repository identifier. " \
90
+ 'Use the user/repo (String) format, or the repository ID (Integer), or a hash containing :repo and :user keys.'
91
+ raise Octokit::InvalidRepository, msg
92
+ end
94
93
  end
95
94
  end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'faraday'
4
+
5
+ module Octokit
6
+ module Response
7
+ # In Faraday 2.x, Faraday::Response::Middleware was removed
8
+ BaseMiddleware = defined?(Faraday::Response::Middleware) ? Faraday::Response::Middleware : Faraday::Middleware
9
+ end
10
+ end
@@ -1,19 +1,17 @@
1
- require 'faraday'
1
+ # frozen_string_literal: true
2
2
 
3
- module Octokit
3
+ require 'octokit/response/base_middleware'
4
4
 
5
+ module Octokit
5
6
  module Response
6
-
7
7
  # Parses RSS and Atom feed responses.
8
- class FeedParser < Faraday::Response::Middleware
9
-
8
+ class FeedParser < BaseMiddleware
10
9
  def on_complete(env)
11
- if env[:response_headers]["content-type"] =~ /(\batom|\brss)/
10
+ if env[:response_headers]['content-type'] =~ /(\batom|\brss)/
12
11
  require 'rss'
13
12
  env[:body] = RSS::Parser.parse env[:body]
14
13
  end
15
14
  end
16
-
17
15
  end
18
16
  end
19
17
  end
@@ -1,14 +1,14 @@
1
- require 'faraday'
1
+ # frozen_string_literal: true
2
+
3
+ require 'octokit/response/base_middleware'
2
4
  require 'octokit/error'
3
5
 
4
6
  module Octokit
5
7
  # Faraday response middleware
6
8
  module Response
7
-
8
9
  # This class raises an Octokit-flavored exception based
9
10
  # HTTP status codes returned by the API
10
- class RaiseError < Faraday::Response::Middleware
11
-
11
+ class RaiseError < BaseMiddleware
12
12
  def on_complete(response)
13
13
  if error = Octokit::Error.from_response(response)
14
14
  raise error
data/lib/octokit/user.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  # GitHub user class to generate API path urls
3
5
  class User
@@ -5,14 +7,14 @@ module Octokit
5
7
  #
6
8
  # @param user [String, Integer] GitHub user login or id
7
9
  # @return [String] User Api path
8
- def self.path user
10
+ def self.path(user)
9
11
  case user
10
12
  when String
11
13
  "users/#{user}"
12
14
  when Integer
13
15
  "user/#{user}"
14
16
  else
15
- "user"
17
+ 'user'
16
18
  end
17
19
  end
18
20
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Octokit
2
4
  # Current major release.
3
5
  # @return [Integer]
@@ -5,7 +7,7 @@ module Octokit
5
7
 
6
8
  # Current minor release.
7
9
  # @return [Integer]
8
- MINOR = 21
10
+ MINOR = 25
9
11
 
10
12
  # Current patch level.
11
13
  # @return [Integer]
@@ -1,17 +1,16 @@
1
- module Octokit
1
+ # frozen_string_literal: true
2
2
 
3
+ module Octokit
3
4
  # Allows warnings to be suppressed via environment variable.
4
5
  module Warnable
6
+ module_function
5
7
 
6
8
  # Wrapper around Kernel#warn to print warnings unless
7
9
  # OCTOKIT_SILENT is set to true.
8
10
  #
9
11
  # @return [nil]
10
12
  def octokit_warn(*message)
11
- unless ENV['OCTOKIT_SILENT']
12
- warn message
13
- end
13
+ warn message unless ENV['OCTOKIT_SILENT']
14
14
  end
15
15
  end
16
16
  end
17
-
data/lib/octokit.rb CHANGED
@@ -1,11 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'octokit/default'
1
4
  require 'octokit/client'
2
5
  require 'octokit/enterprise_admin_client'
3
6
  require 'octokit/enterprise_management_console_client'
4
- require 'octokit/default'
5
7
 
6
8
  # Ruby toolkit for the GitHub API
7
9
  module Octokit
8
-
9
10
  class << self
10
11
  include Octokit::Configurable
11
12
 
@@ -14,6 +15,7 @@ module Octokit
14
15
  # @return [Octokit::Client] API wrapper
15
16
  def client
16
17
  return @client if defined?(@client) && @client.same_options?(options)
18
+
17
19
  @client = Octokit::Client.new(options)
18
20
  end
19
21
 
@@ -21,7 +23,10 @@ module Octokit
21
23
  #
22
24
  # @return [Octokit::EnterpriseAdminClient] API wrapper
23
25
  def enterprise_admin_client
24
- return @enterprise_admin_client if defined?(@enterprise_admin_client) && @enterprise_admin_client.same_options?(options)
26
+ if defined?(@enterprise_admin_client) && @enterprise_admin_client.same_options?(options)
27
+ return @enterprise_admin_client
28
+ end
29
+
25
30
  @enterprise_admin_client = Octokit::EnterpriseAdminClient.new(options)
26
31
  end
27
32
 
@@ -29,16 +34,19 @@ module Octokit
29
34
  #
30
35
  # @return [Octokit::EnterpriseManagementConsoleClient] API wrapper
31
36
  def enterprise_management_console_client
32
- return @enterprise_management_console_client if defined?(@enterprise_management_console_client) && @enterprise_management_console_client.same_options?(options)
37
+ if defined?(@enterprise_management_console_client) && @enterprise_management_console_client.same_options?(options)
38
+ return @enterprise_management_console_client
39
+ end
40
+
33
41
  @enterprise_management_console_client = Octokit::EnterpriseManagementConsoleClient.new(options)
34
42
  end
35
43
 
36
44
  private
37
45
 
38
- def respond_to_missing?(method_name, include_private=false)
46
+ def respond_to_missing?(method_name, include_private = false)
39
47
  client.respond_to?(method_name, include_private) ||
40
- enterprise_admin_client.respond_to?(method_name, include_private) ||
41
- enterprise_management_console_client.respond_to?(method_name, include_private)
48
+ enterprise_admin_client.respond_to?(method_name, include_private) ||
49
+ enterprise_management_console_client.respond_to?(method_name, include_private)
42
50
  end
43
51
 
44
52
  def method_missing(method_name, *args, &block)
@@ -52,7 +60,6 @@ module Octokit
52
60
 
53
61
  super
54
62
  end
55
-
56
63
  end
57
64
  end
58
65
 
data/octokit.gemspec CHANGED
@@ -1,23 +1,25 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'octokit/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
8
  spec.add_development_dependency 'bundler', '>= 1', '< 3'
8
- spec.add_dependency 'sawyer', '>= 0.5.3', '~> 0.8.0'
9
- spec.add_dependency 'faraday', '>= 0.9'
10
- spec.authors = ["Wynn Netherland", "Erik Michaels-Ober", "Clint Shryock"]
11
- spec.description = %q{Simple wrapper for the GitHub API}
9
+ spec.add_dependency 'faraday', '>= 1', '< 3'
10
+ spec.add_dependency 'sawyer', '~> 0.9'
11
+ spec.authors = ['Wynn Netherland', 'Erik Michaels-Ober', 'Clint Shryock']
12
+ spec.description = 'Simple wrapper for the GitHub API'
12
13
  spec.email = ['wynn.netherland@gmail.com', 'sferik@gmail.com', 'clint@ctshryock.com']
13
- spec.files = %w(.document CONTRIBUTING.md LICENSE.md README.md Rakefile octokit.gemspec)
14
- spec.files += Dir.glob("lib/**/*.rb")
14
+ spec.files = %w[.document CONTRIBUTING.md LICENSE.md README.md Rakefile octokit.gemspec]
15
+ spec.files += Dir.glob('lib/**/*.rb')
15
16
  spec.homepage = 'https://github.com/octokit/octokit.rb'
16
17
  spec.licenses = ['MIT']
17
18
  spec.name = 'octokit'
18
19
  spec.require_paths = ['lib']
19
20
  spec.required_ruby_version = '>= 2.0.0'
20
21
  spec.required_rubygems_version = '>= 1.3.5'
21
- spec.summary = "Ruby toolkit for working with the GitHub API"
22
+ spec.summary = 'Ruby toolkit for working with the GitHub API'
22
23
  spec.version = Octokit::VERSION.dup
24
+ spec.metadata = { 'rubygems_mfa_required' => 'true' }
23
25
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.21.0
4
+ version: 4.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wynn Netherland
8
8
  - Erik Michaels-Ober
9
9
  - Clint Shryock
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-04-26 00:00:00.000000000 Z
13
+ date: 2022-06-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -33,37 +33,37 @@ dependencies:
33
33
  - !ruby/object:Gem::Version
34
34
  version: '3'
35
35
  - !ruby/object:Gem::Dependency
36
- name: sawyer
36
+ name: faraday
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 0.5.3
42
- - - "~>"
41
+ version: '1'
42
+ - - "<"
43
43
  - !ruby/object:Gem::Version
44
- version: 0.8.0
44
+ version: '3'
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
48
48
  requirements:
49
49
  - - ">="
50
50
  - !ruby/object:Gem::Version
51
- version: 0.5.3
52
- - - "~>"
51
+ version: '1'
52
+ - - "<"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.8.0
54
+ version: '3'
55
55
  - !ruby/object:Gem::Dependency
56
- name: faraday
56
+ name: sawyer
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.9'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.9'
69
69
  description: Simple wrapper for the GitHub API
@@ -155,6 +155,7 @@ files:
155
155
  - lib/octokit/rate_limit.rb
156
156
  - lib/octokit/repo_arguments.rb
157
157
  - lib/octokit/repository.rb
158
+ - lib/octokit/response/base_middleware.rb
158
159
  - lib/octokit/response/feed_parser.rb
159
160
  - lib/octokit/response/raise_error.rb
160
161
  - lib/octokit/user.rb
@@ -164,8 +165,9 @@ files:
164
165
  homepage: https://github.com/octokit/octokit.rb
165
166
  licenses:
166
167
  - MIT
167
- metadata: {}
168
- post_install_message:
168
+ metadata:
169
+ rubygems_mfa_required: 'true'
170
+ post_install_message:
169
171
  rdoc_options: []
170
172
  require_paths:
171
173
  - lib
@@ -180,8 +182,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
182
  - !ruby/object:Gem::Version
181
183
  version: 1.3.5
182
184
  requirements: []
183
- rubygems_version: 3.0.3
184
- signing_key:
185
+ rubygems_version: 3.1.2
186
+ signing_key:
185
187
  specification_version: 4
186
188
  summary: Ruby toolkit for working with the GitHub API
187
189
  test_files: []