octokit 4.15.0 → 4.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: acde45338bbfff0aac4a04d4e9867b5345f1b1123e58fdc80d0c69d01a1f0877
4
- data.tar.gz: 65324c811d6edbfb510ef41a2ffbe54cc3197d64cfc018e1997858e8d59a5e20
3
+ metadata.gz: df9b83eea7a75984e7f2c153a5329d58d277d73ee07a900f59c1f6b37f251965
4
+ data.tar.gz: 6ae139d074857f6724487097e797c9fdf8e062f7950d48c56564fbd57127087e
5
5
  SHA512:
6
- metadata.gz: dc30ba3288f921516c9aa78f27389c91840522aedb97e3a0c1fb21d672b69586d7096b12affc25a7cd859906da8fe6376a9b5244ca667a5977aad400ec65eff0
7
- data.tar.gz: cdd80e10b58cfa64d2ed18d0376c762ce478b6efddb41e1581f529c3c1d265a0fb67c337398a7e9beee307045b6468732d7d11db2b5b54797734dac917e6029b
6
+ metadata.gz: 9cbc7cb5daa1424380e6c8b2580a296bfd31cb68ef1d89077938711c1adf90b6b79d7bbe1e759358b639214d86336b7162dca286cb022657d46a2da6afcddae5
7
+ data.tar.gz: 668ae004a851737a0e5116117311a2aec314f3742f1677b270f98c91de1025b5fe6614c7c052d56065917bf2e6e9e87b69db226ba1f84a66bc10305e508940b4
@@ -43,22 +43,13 @@ module Octokit
43
43
  # requests at a higher rate limit
44
44
  #
45
45
  # @see https://developer.github.com/v3/#unauthenticated-rate-limited-requests
46
- # @return Boolean
46
+ # @return [Boolean]
47
47
  def application_authenticated?
48
- !!application_authentication
48
+ @client_id && @client_secret
49
49
  end
50
50
 
51
51
  private
52
52
 
53
- def application_authentication
54
- if @client_id && @client_secret
55
- {
56
- :client_id => @client_id,
57
- :client_secret => @client_secret
58
- }
59
- end
60
- end
61
-
62
53
  def login_from_netrc
63
54
  return unless netrc?
64
55
 
@@ -16,6 +16,7 @@ require 'octokit/client/checks'
16
16
  require 'octokit/client/commits'
17
17
  require 'octokit/client/commit_comments'
18
18
  require 'octokit/client/commit_pulls'
19
+ require 'octokit/client/commit_branches'
19
20
  require 'octokit/client/community_profile'
20
21
  require 'octokit/client/contents'
21
22
  require 'octokit/client/downloads'
@@ -75,6 +76,7 @@ module Octokit
75
76
  include Octokit::Client::Commits
76
77
  include Octokit::Client::CommitComments
77
78
  include Octokit::Client::CommitPulls
79
+ include Octokit::Client::CommitBranches
78
80
  include Octokit::Client::CommunityProfile
79
81
  include Octokit::Client::Contents
80
82
  include Octokit::Client::Deployments
@@ -8,7 +8,7 @@ module Octokit
8
8
  #
9
9
  # @param options [Hash] A customizable set of options
10
10
  #
11
- # @see https://developer.github.com/v3/apps/#find-installations
11
+ # @see https://developer.github.com/v3/apps/#list-installations
12
12
  #
13
13
  # @return [Array<Sawyer::Resource>] the total_count and an array of installations
14
14
  def find_app_installations(options = {})
@@ -31,7 +31,7 @@ module Octokit
31
31
  #
32
32
  # @param options [Hash] A customizable set of options
33
33
  #
34
- # @see https://developer.github.com/v3/apps/#list-installations-for-user
34
+ # @see https://developer.github.com/v3/apps/installations/#list-installations-for-a-user
35
35
  #
36
36
  # @return [Sawyer::Resource] the total_count and an array of installations
37
37
  def find_user_installations(options = {})
@@ -45,7 +45,7 @@ module Octokit
45
45
  #
46
46
  # @param id [Integer] Installation id
47
47
  #
48
- # @see https://developer.github.com/v3/apps/#get-a-single-installation
48
+ # @see https://developer.github.com/v3/apps/#get-an-installation
49
49
  #
50
50
  # @return [Sawyer::Resource] Installation information
51
51
  def installation(id, options = {})
@@ -58,7 +58,7 @@ module Octokit
58
58
  # @param installation [Integer] The id of a GitHub App Installation
59
59
  # @param options [Hash] A customizable set of options
60
60
  #
61
- # @see https://developer.github.com/v3/apps/#find-installations
61
+ # @see https://developer.github.com/v3/apps/#create-a-new-installation-token
62
62
  #
63
63
  # @return [<Sawyer::Resource>] An installation token
64
64
  def create_app_installation_access_token(installation, options = {})
@@ -82,7 +82,7 @@ module Octokit
82
82
  # @param organization [String] Organization GitHub login
83
83
  # @param options [Hash] A customizable set of options
84
84
  #
85
- # @see https://developer.github.com/v3/apps/#find-organization-installation
85
+ # @see https://developer.github.com/v3/apps/#get-an-organization-installation
86
86
  #
87
87
  # @return [Sawyer::Resource] Installation information
88
88
  def find_organization_installation(organization, options = {})
@@ -95,7 +95,7 @@ module Octokit
95
95
  # @param repo [String] A GitHub repository
96
96
  # @param options [Hash] A customizable set of options
97
97
  #
98
- # @see https://developer.github.com/v3/apps/#find-repository-installation
98
+ # @see https://developer.github.com/v3/apps/#get-a-repository-installation
99
99
  #
100
100
  # @return [Sawyer::Resource] Installation information
101
101
  def find_repository_installation(repo, options = {})
@@ -108,7 +108,7 @@ module Octokit
108
108
  # @param user [String] GitHub user login
109
109
  # @param options [Hash] A customizable set of options
110
110
  #
111
- # @see https://developer.github.com/v3/apps/#find-user-installation
111
+ # @see https://developer.github.com/v3/apps/#get-a-user-installation
112
112
  #
113
113
  # @return [Sawyer::Resource] Installation information
114
114
  def find_user_installation(user, options = {})
@@ -119,6 +119,7 @@ module Octokit
119
119
  # List repositories that are accessible to the authenticated installation
120
120
  #
121
121
  # @param options [Hash] A customizable set of options
122
+ #
122
123
  # @see https://developer.github.com/v3/apps/installations/#list-repositories
123
124
  #
124
125
  # @return [Sawyer::Resource] the total_count and an array of repositories
@@ -195,7 +196,7 @@ module Octokit
195
196
  # @param installation [Integer] The id of a GitHub App Installation
196
197
  # @param options [Hash] A customizable set of options
197
198
  #
198
- # @see https://developer.github.com/apps/building-integrations/setting-up-and-registering-github-apps/identifying-users-for-github-apps/
199
+ # @see https://developer.github.com/v3/apps/installations/#list-repositories-accessible-to-the-user-for-an-installation
199
200
  #
200
201
  # @return [Sawyer::Resource] the total_count and an array of repositories
201
202
  def find_installation_repositories_for_user(installation, options = {})
@@ -0,0 +1,20 @@
1
+ module Octokit
2
+ class Client
3
+
4
+ # Methods for the Branches for HEAD API
5
+ #
6
+ # @see https://developer.github.com/v3/repos/commits/
7
+ module CommitBranches
8
+
9
+ # List branches for a single HEAD commit
10
+ #
11
+ # @param repo [Integer, String, Hash, Repository] A GitHub repository
12
+ # @param sha [String] The SHA of the commit whose branches will be fetched
13
+ # @return [Array] List of branches
14
+ # @see https://developer.github.com/v3/repos/commits/#list-branches-for-head-commit
15
+ def commit_branches(repo, sha, options = {})
16
+ paginate "#{Repository.path repo}/commits/#{sha}/branches-where-head", options
17
+ end
18
+ end
19
+ end
20
+ end
@@ -333,7 +333,7 @@ module Octokit
333
333
  # @return [Sawyer::Resource] Hash representing team.
334
334
  # @see https://developer.github.com/v3/teams/#get-team-by-name
335
335
  # @example
336
- # @client.team("github", "justice-league")
336
+ # @client.team_by_name("github", "justice-league")
337
337
  def team_by_name(org, team_slug, options = {})
338
338
  get "#{Organization.path(org)}/teams/#{team_slug}", options
339
339
  end
@@ -60,11 +60,13 @@ module Octokit
60
60
  # @param repo [Integer, String, Repository, Hash] A GitHub repository
61
61
  # @param ref [String] The ref, e.g. <tt>tags/v0.0.3</tt>
62
62
  # @param sha [String] A SHA, e.g. <tt>827efc6d56897b048c772eb4087f854f46256132</tt>
63
- # @param force [Boolean] A flag indicating one wants to force the update to make sure the update is a fast-forward update.
63
+ # @param force [Boolean] A flag indicating whether to force the update or to make sure the update is a fast-forward update.
64
64
  # @return [Array<Sawyer::Resource>] The list of references updated
65
65
  # @see https://developer.github.com/v3/git/refs/#update-a-reference
66
66
  # @example Force update heads/sc/featureA for octocat/Hello-World with sha aa218f56b14c9653891f9e74264a383fa43fefbd
67
67
  # Octokit.update_ref("octocat/Hello-World", "heads/sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd")
68
+ # @example Fast-forward update heads/sc/featureA for octocat/Hello-World with sha aa218f56b14c9653891f9e74264a383fa43fefbd
69
+ # Octokit.update_ref("octocat/Hello-World", "heads/sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd", false)
68
70
  def update_ref(repo, ref, sha, force = true, options = {})
69
71
  parameters = {
70
72
  :sha => sha,
@@ -79,11 +81,13 @@ module Octokit
79
81
  # @param repo [Integer, String, Repository, Hash] A GitHub repository
80
82
  # @param branch [String] The ref, e.g. <tt>feature/new-shiny</tt>
81
83
  # @param sha [String] A SHA, e.g. <tt>827efc6d56897b048c772eb4087f854f46256132</tt>
82
- # @param force [Boolean] A flag indicating one wants to force the update to make sure the update is a fast-forward update.
84
+ # @param force [Boolean] A flag indicating whether to force the update or to make sure the update is a fast-forward update.
83
85
  # @return [Array<Sawyer::Resource>] The list of references updated
84
86
  # @see https://developer.github.com/v3/git/refs/#update-a-reference
85
87
  # @example Force update heads/sc/featureA for octocat/Hello-World with sha aa218f56b14c9653891f9e74264a383fa43fefbd
86
- # Octokit.update_branch("octocat/Hello-World","sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd")
88
+ # Octokit.update_branch("octocat/Hello-World", "sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd")
89
+ # @example Fast-forward update heads/sc/featureA for octocat/Hello-World with sha aa218f56b14c9653891f9e74264a383fa43fefbd
90
+ # Octokit.update_branch("octocat/Hello-World", "sc/featureA", "aa218f56b14c9653891f9e74264a383fa43fefbd", false)
87
91
  def update_branch(repo, branch, sha, force = true, options = {})
88
92
  update_ref repo, "heads/#{branch}", sha, force, options
89
93
  end
@@ -113,7 +113,7 @@ module Octokit
113
113
  elsif bearer_authenticated?
114
114
  http.authorization 'Bearer', @bearer_token
115
115
  elsif application_authenticated?
116
- http.params = http.params.merge application_authentication
116
+ http.basic_auth(@client_id, @client_secret)
117
117
  end
118
118
  end
119
119
  end
@@ -8,6 +8,7 @@ module Octokit
8
8
  :checks => 'application/vnd.github.antiope-preview+json'.freeze,
9
9
  :commit_search => 'application/vnd.github.cloak-preview+json'.freeze,
10
10
  :commit_pulls => 'application/vnd.github.groot-preview+json'.freeze,
11
+ :commit_branches => 'application/vnd.github.groot-preview+json'.freeze,
11
12
  :migrations => 'application/vnd.github.wyandotte-preview+json'.freeze,
12
13
  :licenses => 'application/vnd.github.drax-preview+json'.freeze,
13
14
  :source_imports => 'application/vnd.github.barred-rock-preview'.freeze,
@@ -5,7 +5,7 @@ module Octokit
5
5
 
6
6
  # Current minor release.
7
7
  # @return [Integer]
8
- MINOR = 15
8
+ MINOR = 16
9
9
 
10
10
  # Current patch level.
11
11
  # @return [Integer]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octokit
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.15.0
4
+ version: 4.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wynn Netherland
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-01-02 00:00:00.000000000 Z
13
+ date: 2020-02-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -88,6 +88,7 @@ files:
88
88
  - lib/octokit/client/apps.rb
89
89
  - lib/octokit/client/authorizations.rb
90
90
  - lib/octokit/client/checks.rb
91
+ - lib/octokit/client/commit_branches.rb
91
92
  - lib/octokit/client/commit_comments.rb
92
93
  - lib/octokit/client/commit_pulls.rb
93
94
  - lib/octokit/client/commits.rb