octokit 6.1.0 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afa7dae6ede3d3871a1ba78d8c0de33d3aa4692869eacdbb30e0867f555c21f2
4
- data.tar.gz: 213439dcb01e0af935df22e902caa69d9c395b1ab9076a83918efebc374140bd
3
+ metadata.gz: 68c11fbd1bb2d452acf5bbebf33974285207aa99513b22b4ff8d208e01f76e11
4
+ data.tar.gz: 63c099454a0ffcdbc621990114adbec36d44535929dfbfacaf09bb3d1b34394f
5
5
  SHA512:
6
- metadata.gz: 117e024b6078555cdd6809d941a19a0e8b77e629939e112ffe5a5116674c16d6b441358e3ba56bc2d27770fea108fd4adc18d48aa6c186206628abc28dd525d9
7
- data.tar.gz: 4caea9cb705c43d9c8022f0de6d74cc9ece8d1e1771ae7a43c0e53a748c226a8c231fe25c64b813bf025a80521dd5c201eb7d2693ebbd6074d47a776137dd7fb
6
+ metadata.gz: a7ed6fb3bdf0b189ed74e8d12705fd9c377407910a6f8f5a8bd6a16f47326b86126dbf973fbbd6045c3b7f31202fa8af9120fbf8acf99cab1f26765be8413bfc
7
+ data.tar.gz: 52da944c212373baa9a68476e719dd5b2156bccbd09f0d6028edcf34ca90e15961499cfc88acda86ac7fa6625576005cf79d1c2c7eb8cd9f6f2c453317bbe054
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Octokit
4
+ class Client
5
+ # Methods for the Environments API
6
+ #
7
+ # @see https://docs.github.com/en/rest/deployments/environments
8
+ module Environments
9
+ # Fetch a single environment for a repository
10
+ #
11
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
12
+ # @param environment_name [String] The name of the environment
13
+ # @return <Sawyer::Resource> A single environment
14
+ # @see https://docs.github.com/en/rest/deployments/environments#get-an-environment
15
+ def environment(repo, environment_name, options = {})
16
+ get("#{Repository.path repo}/environments/#{environment_name}", options)
17
+ end
18
+
19
+ # Lists the environments for a repository
20
+ #
21
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
22
+ # @option options [Integer] :per_page The number of results per page (max 100). Default: 30
23
+ # @option options [Integer] :page Page number of the results to fetch. Default: 1
24
+ # @return [Sawyer::Resource] Total count of environments and list of environments
25
+ # @see https://docs.github.com/en/rest/deployments/environments#list-environments
26
+ def environments(repo, options = {})
27
+ get("#{Repository.path repo}/environments", options)
28
+ end
29
+ alias list_environments environments
30
+
31
+ # Create or update an environment with protection rules, such as required reviewers
32
+ #
33
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
34
+ # @param environment_name [String] The name of the environment
35
+ # @option options [Integer] :wait_timer The amount of time to delay a job after the job is initially triggered. The time (in minutes) must be an integer between 0 and 43,200 (30 days).
36
+ # @option options [Array] :reviewers The people or teams that may review jobs that reference the environment. You can list up to six users or teams as reviewers.
37
+ # @option options [Object] :deployment_branch_policy The type of deployment branch policy for this environment. To allow all branches to deploy, set to null.
38
+ # @return [Sawyer::Resource] An environment
39
+ # @see https://docs.github.com/en/rest/deployments/environments#create-or-update-an-environment
40
+ def create_or_update_environment(repo, environment_name, options = {})
41
+ put("#{Repository.path repo}/environments/#{environment_name}", options)
42
+ end
43
+
44
+ # Delete an Environment
45
+ #
46
+ # @param repo [Integer, String, Repository, Hash] A GitHub repository
47
+ # @param environment_name [String] The name of the environment
48
+ # @return [No Content]
49
+ # @see https://docs.github.com/en/rest/deployments/environments#delete-an-environment
50
+ def delete_environment(repo, environment_name, options = {})
51
+ delete("#{Repository.path repo}/environments/#{environment_name}", options)
52
+ end
53
+ end
54
+ end
55
+ end
@@ -50,6 +50,22 @@ module Octokit
50
50
  end
51
51
  alias update_org update_organization
52
52
 
53
+ # Delete an organization.
54
+ #
55
+ # Requires authenticated organization owner.
56
+ #
57
+ # @param org [String, Integer] Organization login or ID.
58
+ # @return [Boolean] True if deletion successful, otherwise false.
59
+ # @see https://docs.github.com/rest/orgs/orgs#delete-an-organization
60
+ # @example
61
+ # @client.delete_organization("my-org")
62
+ # @example
63
+ # @client.delete_org("my-org")
64
+ def delete_organization(org)
65
+ boolean_from_response :delete, Organization.path(org)
66
+ end
67
+ alias delete_org delete_organization
68
+
53
69
  # Get organizations for a user.
54
70
  #
55
71
  # Nonauthenticated calls to this method will return organizations that
@@ -44,6 +44,7 @@ module Octokit
44
44
  # @option options [Integer] :per_page Number of items per page
45
45
  # @return [Sawyer::Resource] Search results object
46
46
  # @see https://developer.github.com/v3/search/#search-issues-and-pull-requests
47
+ # @see https://docs.github.com/en/rest/search#limitations-on-query-length
47
48
  def search_issues(query, options = {})
48
49
  search 'search/issues', query, options
49
50
  end
@@ -26,6 +26,7 @@ require 'octokit/client/community_profile'
26
26
  require 'octokit/client/contents'
27
27
  require 'octokit/client/downloads'
28
28
  require 'octokit/client/deployments'
29
+ require 'octokit/client/environments'
29
30
  require 'octokit/client/emojis'
30
31
  require 'octokit/client/events'
31
32
  require 'octokit/client/feeds'
@@ -86,6 +87,7 @@ module Octokit
86
87
  include Octokit::Client::Contents
87
88
  include Octokit::Client::Deployments
88
89
  include Octokit::Client::Downloads
90
+ include Octokit::Client::Environments
89
91
  include Octokit::Client::Emojis
90
92
  include Octokit::Client::Events
91
93
  include Octokit::Client::Feeds
data/lib/octokit/error.rb CHANGED
@@ -213,7 +213,7 @@ module Octokit
213
213
  end
214
214
 
215
215
  def redact_url(url_string)
216
- %w[client_secret access_token].each do |token|
216
+ %w[client_secret access_token api_key].each do |token|
217
217
  if url_string.include? token
218
218
  url_string.gsub!(/#{token}=\S+/, "#{token}=(redacted)")
219
219
  end
@@ -11,7 +11,7 @@ module Octokit
11
11
 
12
12
  # Current patch level.
13
13
  # @return [Integer]
14
- PATCH = 0
14
+ PATCH = 1
15
15
 
16
16
  # Full release version.
17
17
  # @return [String]
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: 6.1.0
4
+ version: 6.1.1
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: 2023-03-09 00:00:00.000000000 Z
13
+ date: 2023-04-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -101,6 +101,7 @@ files:
101
101
  - lib/octokit/client/deployments.rb
102
102
  - lib/octokit/client/downloads.rb
103
103
  - lib/octokit/client/emojis.rb
104
+ - lib/octokit/client/environments.rb
104
105
  - lib/octokit/client/events.rb
105
106
  - lib/octokit/client/feeds.rb
106
107
  - lib/octokit/client/gists.rb