octokit 4.21.0 → 4.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +90 -63
- data/Rakefile +5 -3
- data/lib/ext/sawyer/relation.rb +4 -2
- data/lib/octokit/arguments.rb +2 -2
- data/lib/octokit/authentication.rb +10 -3
- data/lib/octokit/client/actions_secrets.rb +2 -3
- data/lib/octokit/client/actions_workflow_runs.rb +2 -0
- data/lib/octokit/client/actions_workflows.rb +2 -1
- data/lib/octokit/client/apps.rb +26 -26
- data/lib/octokit/client/authorizations.rb +20 -17
- data/lib/octokit/client/checks.rb +18 -9
- data/lib/octokit/client/commit_branches.rb +2 -2
- data/lib/octokit/client/commit_comments.rb +8 -8
- data/lib/octokit/client/commit_pulls.rb +2 -2
- data/lib/octokit/client/commits.rb +31 -34
- data/lib/octokit/client/community_profile.rb +2 -2
- data/lib/octokit/client/contents.rb +20 -21
- data/lib/octokit/client/deployments.rb +6 -6
- data/lib/octokit/client/downloads.rb +5 -6
- data/lib/octokit/client/emojis.rb +3 -3
- data/lib/octokit/client/events.rb +4 -4
- data/lib/octokit/client/feeds.rb +4 -5
- data/lib/octokit/client/gists.rb +6 -6
- data/lib/octokit/client/gitignore.rb +3 -3
- data/lib/octokit/client/hooks.rb +10 -10
- data/lib/octokit/client/issues.rb +14 -14
- data/lib/octokit/client/labels.rb +10 -10
- data/lib/octokit/client/legacy_search.rb +3 -3
- data/lib/octokit/client/licenses.rb +3 -3
- data/lib/octokit/client/markdown.rb +3 -3
- data/lib/octokit/client/marketplace.rb +4 -4
- data/lib/octokit/client/meta.rb +4 -5
- data/lib/octokit/client/milestones.rb +5 -5
- data/lib/octokit/client/notifications.rb +6 -6
- data/lib/octokit/client/oauth_applications.rb +0 -2
- data/lib/octokit/client/objects.rb +14 -14
- data/lib/octokit/client/organizations.rb +48 -48
- data/lib/octokit/client/pages.rb +3 -3
- data/lib/octokit/client/projects.rb +18 -19
- data/lib/octokit/client/pub_sub_hubbub.rb +16 -16
- data/lib/octokit/client/pull_requests.rb +41 -42
- data/lib/octokit/client/rate_limit.rb +9 -11
- data/lib/octokit/client/reactions.rb +6 -6
- data/lib/octokit/client/refs.rb +14 -15
- data/lib/octokit/client/releases.rb +13 -13
- data/lib/octokit/client/repositories.rb +36 -36
- data/lib/octokit/client/repository_invitations.rb +3 -3
- data/lib/octokit/client/reviews.rb +7 -7
- data/lib/octokit/client/say.rb +4 -5
- data/lib/octokit/client/search.rb +9 -9
- data/lib/octokit/client/service_status.rb +19 -9
- data/lib/octokit/client/source_import.rb +6 -6
- data/lib/octokit/client/stats.rb +10 -9
- data/lib/octokit/client/statuses.rb +5 -5
- data/lib/octokit/client/traffic.rb +2 -3
- data/lib/octokit/client/users.rb +27 -26
- data/lib/octokit/client.rb +28 -14
- data/lib/octokit/configurable.rb +33 -27
- data/lib/octokit/connection.rb +22 -23
- data/lib/octokit/default.rb +30 -18
- data/lib/octokit/enterprise_admin_client/admin_stats.rb +13 -14
- data/lib/octokit/enterprise_admin_client/license.rb +3 -4
- data/lib/octokit/enterprise_admin_client/orgs.rb +3 -4
- data/lib/octokit/enterprise_admin_client/search_indexing.rb +7 -8
- data/lib/octokit/enterprise_admin_client/users.rb +5 -4
- data/lib/octokit/enterprise_admin_client.rb +9 -3
- data/lib/octokit/enterprise_management_console_client/management_console.rb +32 -32
- data/lib/octokit/enterprise_management_console_client.rb +8 -2
- data/lib/octokit/error.rb +27 -23
- data/lib/octokit/gist.rb +2 -3
- data/lib/octokit/middleware/follow_redirects.rb +15 -11
- data/lib/octokit/organization.rb +3 -1
- data/lib/octokit/preview.rb +29 -29
- data/lib/octokit/rate_limit.rb +3 -3
- data/lib/octokit/repo_arguments.rb +2 -3
- data/lib/octokit/repository.rb +23 -24
- data/lib/octokit/response/base_middleware.rb +10 -0
- data/lib/octokit/response/feed_parser.rb +5 -7
- data/lib/octokit/response/raise_error.rb +4 -4
- data/lib/octokit/user.rb +4 -2
- data/lib/octokit/version.rb +3 -1
- data/lib/octokit/warnable.rb +4 -5
- data/lib/octokit.rb +15 -8
- data/octokit.gemspec +11 -9
- metadata +19 -17
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Organizations API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/orgs/
|
7
8
|
module Organizations
|
8
|
-
|
9
9
|
# Get an organization
|
10
10
|
#
|
11
11
|
# @param org [String, Integer] Organization GitHub login or id.
|
@@ -18,7 +18,7 @@ module Octokit
|
|
18
18
|
def organization(org, options = {})
|
19
19
|
get Organization.path(org), options
|
20
20
|
end
|
21
|
-
alias
|
21
|
+
alias org organization
|
22
22
|
|
23
23
|
# Update an organization.
|
24
24
|
#
|
@@ -48,7 +48,7 @@ module Octokit
|
|
48
48
|
def update_organization(org, values, options = {})
|
49
49
|
patch Organization.path(org), options.merge(values)
|
50
50
|
end
|
51
|
-
alias
|
51
|
+
alias update_org update_organization
|
52
52
|
|
53
53
|
# Get organizations for a user.
|
54
54
|
#
|
@@ -78,12 +78,12 @@ module Octokit
|
|
78
78
|
# Octokit.list_orgs('pengwynn')
|
79
79
|
# @example
|
80
80
|
# @client.organizations
|
81
|
-
def organizations(user=nil, options = {})
|
81
|
+
def organizations(user = nil, options = {})
|
82
82
|
paginate "#{User.path user}/orgs", options
|
83
83
|
end
|
84
|
-
alias
|
85
|
-
alias
|
86
|
-
alias
|
84
|
+
alias list_organizations organizations
|
85
|
+
alias list_orgs organizations
|
86
|
+
alias orgs organizations
|
87
87
|
|
88
88
|
# List all GitHub organizations
|
89
89
|
#
|
@@ -98,9 +98,9 @@ module Octokit
|
|
98
98
|
#
|
99
99
|
# @return [Array<Sawyer::Resource>] List of GitHub organizations.
|
100
100
|
def all_organizations(options = {})
|
101
|
-
paginate
|
101
|
+
paginate 'organizations', options
|
102
102
|
end
|
103
|
-
alias
|
103
|
+
alias all_orgs all_organizations
|
104
104
|
|
105
105
|
# List organization repositories
|
106
106
|
#
|
@@ -125,8 +125,8 @@ module Octokit
|
|
125
125
|
def organization_repositories(org, options = {})
|
126
126
|
paginate "#{Organization.path org}/repos", options
|
127
127
|
end
|
128
|
-
alias
|
129
|
-
alias
|
128
|
+
alias org_repositories organization_repositories
|
129
|
+
alias org_repos organization_repositories
|
130
130
|
|
131
131
|
# Get organization members
|
132
132
|
#
|
@@ -143,10 +143,10 @@ module Octokit
|
|
143
143
|
# Octokit.org_members('github')
|
144
144
|
def organization_members(org, options = {})
|
145
145
|
options = options.dup
|
146
|
-
path =
|
146
|
+
path = 'public_' if options.delete(:public)
|
147
147
|
paginate "#{Organization.path org}/#{path}members", options
|
148
148
|
end
|
149
|
-
alias
|
149
|
+
alias org_members organization_members
|
150
150
|
|
151
151
|
# Get organization public members
|
152
152
|
#
|
@@ -160,9 +160,9 @@ module Octokit
|
|
160
160
|
# @example
|
161
161
|
# Octokit.org_public_members('github')
|
162
162
|
def organization_public_members(org, options = {})
|
163
|
-
organization_members org, options.merge(:
|
163
|
+
organization_members org, options.merge(public: true)
|
164
164
|
end
|
165
|
-
alias
|
165
|
+
alias org_public_members organization_public_members
|
166
166
|
|
167
167
|
# Check if a user is a member of an organization.
|
168
168
|
#
|
@@ -188,7 +188,7 @@ module Octokit
|
|
188
188
|
result
|
189
189
|
end
|
190
190
|
end
|
191
|
-
alias
|
191
|
+
alias org_member? organization_member?
|
192
192
|
|
193
193
|
# Check if a user is a public member of an organization.
|
194
194
|
#
|
@@ -208,7 +208,7 @@ module Octokit
|
|
208
208
|
def organization_public_member?(org, user, options = {})
|
209
209
|
boolean_from_response :get, "#{Organization.path org}/public_members/#{user}", options
|
210
210
|
end
|
211
|
-
alias
|
211
|
+
alias org_public_member? organization_public_member?
|
212
212
|
|
213
213
|
# List pending organization invitations
|
214
214
|
#
|
@@ -223,7 +223,7 @@ module Octokit
|
|
223
223
|
def organization_invitations(org, options = {})
|
224
224
|
get "#{Organization.path org}/invitations", options
|
225
225
|
end
|
226
|
-
alias
|
226
|
+
alias org_invitations organization_invitations
|
227
227
|
|
228
228
|
# List outside collaborators for an organization
|
229
229
|
#
|
@@ -235,7 +235,7 @@ module Octokit
|
|
235
235
|
#
|
236
236
|
# @example
|
237
237
|
# @client.outside_collaborators('github')
|
238
|
-
def outside_collaborators(org, options={})
|
238
|
+
def outside_collaborators(org, options = {})
|
239
239
|
paginate "#{Organization.path org}/outside_collaborators", options
|
240
240
|
end
|
241
241
|
|
@@ -250,7 +250,7 @@ module Octokit
|
|
250
250
|
#
|
251
251
|
# @example
|
252
252
|
# @client.remove_outside_collaborator('github', 'lizzhale')
|
253
|
-
def remove_outside_collaborator(org, user, options={})
|
253
|
+
def remove_outside_collaborator(org, user, options = {})
|
254
254
|
boolean_from_response :delete, "#{Organization.path org}/outside_collaborators/#{user}", options
|
255
255
|
end
|
256
256
|
|
@@ -265,7 +265,7 @@ module Octokit
|
|
265
265
|
#
|
266
266
|
# @example
|
267
267
|
# @client.convert_to_outside_collaborator('github', 'lizzhale')
|
268
|
-
def convert_to_outside_collaborator(org, user, options={})
|
268
|
+
def convert_to_outside_collaborator(org, user, options = {})
|
269
269
|
boolean_from_response :put, "#{Organization.path org}/outside_collaborators/#{user}", options
|
270
270
|
end
|
271
271
|
|
@@ -283,7 +283,7 @@ module Octokit
|
|
283
283
|
def organization_teams(org, options = {})
|
284
284
|
paginate "#{Organization.path org}/teams", options
|
285
285
|
end
|
286
|
-
alias
|
286
|
+
alias org_teams organization_teams
|
287
287
|
|
288
288
|
# Create team
|
289
289
|
#
|
@@ -303,7 +303,7 @@ module Octokit
|
|
303
303
|
# })
|
304
304
|
def create_team(org, options = {})
|
305
305
|
if options.key?(:permission)
|
306
|
-
octokit_warn
|
306
|
+
octokit_warn 'Deprecated: Passing :permission option to #create_team. Assign team repository permission by passing :permission to #add_team_repository instead.'
|
307
307
|
end
|
308
308
|
if options.key?(:parent_team_id)
|
309
309
|
options = ensure_api_media_type(:nested_teams, options)
|
@@ -429,7 +429,7 @@ module Octokit
|
|
429
429
|
# There's a bug in this API call. The docs say to leave the body blank,
|
430
430
|
# but it fails if the body is both blank and the content-length header
|
431
431
|
# is not 0.
|
432
|
-
boolean_from_response :put, "teams/#{team_id}/members/#{user}", options.merge({:
|
432
|
+
boolean_from_response :put, "teams/#{team_id}/members/#{user}", options.merge({ name: user })
|
433
433
|
end
|
434
434
|
|
435
435
|
# Remove team member
|
@@ -494,7 +494,7 @@ module Octokit
|
|
494
494
|
def team_repositories(team_id, options = {})
|
495
495
|
paginate "teams/#{team_id}/repos", options
|
496
496
|
end
|
497
|
-
alias
|
497
|
+
alias team_repos team_repositories
|
498
498
|
|
499
499
|
# Check if a repo is managed by a specific team
|
500
500
|
#
|
@@ -508,10 +508,10 @@ module Octokit
|
|
508
508
|
# @client.team_repository?(8675309, 'octokit/octokit.rb')
|
509
509
|
# @example
|
510
510
|
# @client.team_repo?(8675309, 'octokit/octokit.rb')
|
511
|
-
def team_repository?(team_id, repo,
|
511
|
+
def team_repository?(team_id, repo, _options = {})
|
512
512
|
boolean_from_response :get, "teams/#{team_id}/repos/#{Repository.new(repo)}"
|
513
513
|
end
|
514
|
-
alias
|
514
|
+
alias team_repo? team_repository?
|
515
515
|
|
516
516
|
# Add team repository
|
517
517
|
#
|
@@ -540,7 +540,7 @@ module Octokit
|
|
540
540
|
def add_team_repository(team_id, repo, options = {})
|
541
541
|
boolean_from_response :put, "teams/#{team_id}/repos/#{Repository.new(repo)}", options
|
542
542
|
end
|
543
|
-
alias
|
543
|
+
alias add_team_repo add_team_repository
|
544
544
|
|
545
545
|
# Remove team repository
|
546
546
|
#
|
@@ -557,10 +557,10 @@ module Octokit
|
|
557
557
|
# @client.remove_team_repository(100000, 'github/developer.github.com')
|
558
558
|
# @example
|
559
559
|
# @client.remove_team_repo(100000, 'github/developer.github.com')
|
560
|
-
def remove_team_repository(team_id, repo,
|
560
|
+
def remove_team_repository(team_id, repo, _options = {})
|
561
561
|
boolean_from_response :delete, "teams/#{team_id}/repos/#{Repository.new(repo)}"
|
562
562
|
end
|
563
|
-
alias
|
563
|
+
alias remove_team_repo remove_team_repository
|
564
564
|
|
565
565
|
# Remove organization member
|
566
566
|
#
|
@@ -579,7 +579,7 @@ module Octokit
|
|
579
579
|
# provided in the GH API v3
|
580
580
|
boolean_from_response :delete, "#{Organization.path org}/members/#{user}", options
|
581
581
|
end
|
582
|
-
alias
|
582
|
+
alias remove_org_member remove_organization_member
|
583
583
|
|
584
584
|
# Publicize a user's membership of an organization
|
585
585
|
#
|
@@ -610,14 +610,14 @@ module Octokit
|
|
610
610
|
def unpublicize_membership(org, user, options = {})
|
611
611
|
boolean_from_response :delete, "#{Organization.path org}/public_members/#{user}", options
|
612
612
|
end
|
613
|
-
alias
|
613
|
+
alias conceal_membership unpublicize_membership
|
614
614
|
|
615
615
|
# List all teams for the authenticated user across all their orgs
|
616
616
|
#
|
617
617
|
# @return [Array<Sawyer::Resource>] Array of team resources.
|
618
618
|
# @see https://developer.github.com/v3/orgs/teams/#list-user-teams
|
619
619
|
def user_teams(options = {})
|
620
|
-
paginate
|
620
|
+
paginate 'user/teams', options
|
621
621
|
end
|
622
622
|
|
623
623
|
# Check if a user has a team membership.
|
@@ -667,9 +667,9 @@ module Octokit
|
|
667
667
|
# @return [Array<Sawyer::Resource>] Array of organizations memberships.
|
668
668
|
# @see https://developer.github.com/v3/orgs/members/#list-your-organization-memberships
|
669
669
|
def organization_memberships(options = {})
|
670
|
-
paginate
|
670
|
+
paginate 'user/memberships/orgs', options
|
671
671
|
end
|
672
|
-
alias
|
672
|
+
alias org_memberships organization_memberships
|
673
673
|
|
674
674
|
# Get an organization membership
|
675
675
|
#
|
@@ -686,7 +686,7 @@ module Octokit
|
|
686
686
|
get "user/memberships/orgs/#{org}", options
|
687
687
|
end
|
688
688
|
end
|
689
|
-
alias
|
689
|
+
alias org_membership organization_membership
|
690
690
|
|
691
691
|
# Edit an organization membership
|
692
692
|
#
|
@@ -707,7 +707,7 @@ module Octokit
|
|
707
707
|
patch "user/memberships/orgs/#{org}", options
|
708
708
|
end
|
709
709
|
end
|
710
|
-
alias
|
710
|
+
alias update_org_membership update_organization_membership
|
711
711
|
|
712
712
|
# Remove an organization membership
|
713
713
|
#
|
@@ -719,7 +719,7 @@ module Octokit
|
|
719
719
|
user = options.delete(:user)
|
720
720
|
user && boolean_from_response(:delete, "#{Organization.path(org)}/memberships/#{user}", options)
|
721
721
|
end
|
722
|
-
alias
|
722
|
+
alias remove_org_membership remove_organization_membership
|
723
723
|
|
724
724
|
# Initiates the generation of a migration archive.
|
725
725
|
#
|
@@ -731,7 +731,7 @@ module Octokit
|
|
731
731
|
# @return [Sawyer::Resource] Hash representing the new migration.
|
732
732
|
# @example
|
733
733
|
# @client.start_migration('github', ['github/dotfiles'])
|
734
|
-
# @see https://
|
734
|
+
# @see https://docs.github.com/en/rest/reference/migrations#start-an-organization-migration
|
735
735
|
def start_migration(org, repositories, options = {})
|
736
736
|
options = ensure_api_media_type(:migrations, options)
|
737
737
|
options[:repositories] = repositories
|
@@ -744,7 +744,7 @@ module Octokit
|
|
744
744
|
#
|
745
745
|
# @param org [String, Integer] Organization GitHub login or id.
|
746
746
|
# @return [Array<Sawyer::Resource>] Array of migration resources.
|
747
|
-
# @see https://
|
747
|
+
# @see https://docs.github.com/en/rest/reference/migrations#list-organization-migrations
|
748
748
|
def migrations(org, options = {})
|
749
749
|
options = ensure_api_media_type(:migrations, options)
|
750
750
|
paginate "#{Organization.path(org)}/migrations", options
|
@@ -756,7 +756,7 @@ module Octokit
|
|
756
756
|
#
|
757
757
|
# @param org [String, Integer] Organization GitHub login or id.
|
758
758
|
# @param id [Integer] ID number of the migration.
|
759
|
-
# @see https://
|
759
|
+
# @see https://docs.github.com/en/rest/reference/migrations#get-an-organization-migration-status
|
760
760
|
def migration_status(org, id, options = {})
|
761
761
|
options = ensure_api_media_type(:migrations, options)
|
762
762
|
get "#{Organization.path(org)}/migrations/#{id}", options
|
@@ -768,7 +768,7 @@ module Octokit
|
|
768
768
|
#
|
769
769
|
# @param org [String, Integer] Organization GitHub login or id.
|
770
770
|
# @param id [Integer] ID number of the migration.
|
771
|
-
# @see https://
|
771
|
+
# @see https://docs.github.com/en/rest/reference/migrations#download-an-organization-migration-archive
|
772
772
|
def migration_archive_url(org, id, options = {})
|
773
773
|
options = ensure_api_media_type(:migrations, options)
|
774
774
|
url = "#{Organization.path(org)}/migrations/#{id}/archive"
|
@@ -783,7 +783,7 @@ module Octokit
|
|
783
783
|
#
|
784
784
|
# @param org [String, Integer] Organization GitHub login or id.
|
785
785
|
# @param id [Integer] ID number of the migration.
|
786
|
-
# @see https://
|
786
|
+
# @see https://docs.github.com/en/rest/reference/migrations#delete-an-organization-migration-archive
|
787
787
|
def delete_migration_archive(org, id, options = {})
|
788
788
|
options = ensure_api_media_type(:migrations, options)
|
789
789
|
delete "#{Organization.path(org)}/migrations/#{id}/archive", options
|
@@ -796,20 +796,20 @@ module Octokit
|
|
796
796
|
# @param org [String, Integer] Organization GitHub login or id.
|
797
797
|
# @param id [Integer] ID number of the migration.
|
798
798
|
# @param repo [String] Name of the repository.
|
799
|
-
# @see https://
|
799
|
+
# @see https://docs.github.com/en/rest/reference/migrations#unlock-an-organization-repository
|
800
800
|
def unlock_repository(org, id, repo, options = {})
|
801
801
|
options = ensure_api_media_type(:migrations, options)
|
802
802
|
delete "#{Organization.path(org)}/migrations/#{id}/repos/#{repo}/lock", options
|
803
803
|
end
|
804
804
|
|
805
805
|
# Get GitHub Actions billing for an organization
|
806
|
-
#
|
806
|
+
#
|
807
807
|
# Requires authenticated organization owner.
|
808
|
-
#
|
808
|
+
#
|
809
809
|
# @param org [String, Integer] Organization GitHub login or id.
|
810
810
|
# @return [Sawyer::Resource] Hash representing GitHub Actions billing for an organization.
|
811
811
|
# @see https://docs.github.com/en/rest/reference/billing#get-github-actions-billing-for-an-organization
|
812
|
-
#
|
812
|
+
#
|
813
813
|
# @example
|
814
814
|
# @client.billing_actions('github')
|
815
815
|
def billing_actions(org)
|
data/lib/octokit/client/pages.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the Pages API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/pages/
|
7
8
|
module Pages
|
8
|
-
|
9
9
|
# List Pages information for a repository
|
10
10
|
#
|
11
11
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
@@ -36,7 +36,7 @@ module Octokit
|
|
36
36
|
def pages_builds(repo, options = {})
|
37
37
|
get "#{Repository.path repo}/pages/builds", options
|
38
38
|
end
|
39
|
-
alias
|
39
|
+
alias list_pages_builds pages_builds
|
40
40
|
|
41
41
|
# List the latest Pages build information for a repository
|
42
42
|
#
|
@@ -1,18 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for Projects API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/projects
|
7
8
|
module Projects
|
8
|
-
|
9
9
|
# List projects for a repository
|
10
10
|
#
|
11
11
|
# Requires authenticated client
|
12
12
|
#
|
13
13
|
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
14
14
|
# @return [Array<Sawyer::Resource>] Repository projects
|
15
|
-
# @see https://developer.github.com/v3/projects/#list-repository-projects
|
15
|
+
# @see https://developer.github.com/v3/projects/#list-repository-projects
|
16
16
|
# @example
|
17
17
|
# @client.projects('octokit/octokit.rb')
|
18
18
|
def projects(repo, options = {})
|
@@ -28,7 +28,7 @@ module Octokit
|
|
28
28
|
# @param name [String] Project name
|
29
29
|
# @option options [String] :body Body of the project
|
30
30
|
# @return [Sawyer::Resource] Fresh new project
|
31
|
-
# @see https://developer.github.com/v3/projects/#create-a-repository-project
|
31
|
+
# @see https://developer.github.com/v3/projects/#create-a-repository-project
|
32
32
|
# @example Create project with only a name
|
33
33
|
# @client.create_project('octokit/octokit.rb', 'implement new APIs')
|
34
34
|
#
|
@@ -53,7 +53,7 @@ module Octokit
|
|
53
53
|
opts = ensure_api_media_type(:projects, options)
|
54
54
|
paginate "orgs/#{org}/projects", opts
|
55
55
|
end
|
56
|
-
alias
|
56
|
+
alias organization_projects org_projects
|
57
57
|
|
58
58
|
# Create organization project
|
59
59
|
#
|
@@ -73,13 +73,13 @@ module Octokit
|
|
73
73
|
opts[:name] = name
|
74
74
|
post "orgs/#{org}/projects", opts
|
75
75
|
end
|
76
|
-
alias
|
76
|
+
alias create_organization_project create_org_project
|
77
77
|
|
78
|
-
# Get a project by id
|
78
|
+
# Get a project by id
|
79
79
|
#
|
80
80
|
# @param id [Integer] Project id
|
81
81
|
# @return [Sawyer::Resource] Project
|
82
|
-
# @see https://developer.github.com/v3/projects/#get-a-project
|
82
|
+
# @see https://developer.github.com/v3/projects/#get-a-project
|
83
83
|
# @example
|
84
84
|
# Octokit.project(123942)
|
85
85
|
def project(id, options = {})
|
@@ -95,7 +95,7 @@ module Octokit
|
|
95
95
|
# @option options [String] :name Project name
|
96
96
|
# @option options [String] :body Project body
|
97
97
|
# @return [Sawyer::Resource] Project
|
98
|
-
# @see https://developer.github.com/v3/projects/#update-a-project
|
98
|
+
# @see https://developer.github.com/v3/projects/#update-a-project
|
99
99
|
# @example Update project name
|
100
100
|
# @client.update_project(123942, name: 'New name')
|
101
101
|
def update_project(id, options = {})
|
@@ -109,7 +109,7 @@ module Octokit
|
|
109
109
|
#
|
110
110
|
# @param id [Integer] Project id
|
111
111
|
# @return [Boolean] Result of deletion
|
112
|
-
# @see https://developer.github.com/v3/projects/#delete-a-project
|
112
|
+
# @see https://developer.github.com/v3/projects/#delete-a-project
|
113
113
|
# @example
|
114
114
|
# @client.delete_project(123942)
|
115
115
|
def delete_project(id, options = {})
|
@@ -119,9 +119,9 @@ module Octokit
|
|
119
119
|
|
120
120
|
# List project columns
|
121
121
|
#
|
122
|
-
# @param id [Integer] Project id
|
122
|
+
# @param id [Integer] Project id
|
123
123
|
# @return [Array<Sawyer::Resource>] List of project columns
|
124
|
-
# @see https://developer.github.com/v3/projects/columns/#list-project-columns
|
124
|
+
# @see https://developer.github.com/v3/projects/columns/#list-project-columns
|
125
125
|
# @example
|
126
126
|
# @client.project_columns(123942)
|
127
127
|
def project_columns(id, options = {})
|
@@ -136,7 +136,7 @@ module Octokit
|
|
136
136
|
# @param id [Integer] Project column id
|
137
137
|
# @param name [String] New column name
|
138
138
|
# @return [Sawyer::Resource] Newly created column
|
139
|
-
# @see https://developer.github.com/v3/projects/columns/#create-a-project-column
|
139
|
+
# @see https://developer.github.com/v3/projects/columns/#create-a-project-column
|
140
140
|
# @example
|
141
141
|
# @client.create_project_column(123942, "To Dones")
|
142
142
|
def create_project_column(id, name, options = {})
|
@@ -149,7 +149,7 @@ module Octokit
|
|
149
149
|
#
|
150
150
|
# @param id [Integer] Project column id
|
151
151
|
# @return [Sawyer::Resource] Project column
|
152
|
-
# @see https://developer.github.com/v3/projects/columns/#get-a-project-column
|
152
|
+
# @see https://developer.github.com/v3/projects/columns/#get-a-project-column
|
153
153
|
# @example
|
154
154
|
# Octokit.project_column(30294)
|
155
155
|
def project_column(id, options = {})
|
@@ -164,7 +164,7 @@ module Octokit
|
|
164
164
|
# @param id [Integer] Project column id
|
165
165
|
# @param name [String] New column name
|
166
166
|
# @return [Sawyer::Resource] Updated column
|
167
|
-
# @see https://developer.github.com/v3/projects/columns/#update-a-project-column
|
167
|
+
# @see https://developer.github.com/v3/projects/columns/#update-a-project-column
|
168
168
|
# @example
|
169
169
|
# @client.update_project_column(30294, "new column name")
|
170
170
|
def update_project_column(id, name, options = {})
|
@@ -179,7 +179,7 @@ module Octokit
|
|
179
179
|
#
|
180
180
|
# @param id [Integer] Project column id
|
181
181
|
# @return [Boolean] Result of deletion request, true when deleted
|
182
|
-
# @see https://developer.github.com/v3/projects/columns/#delete-a-project-column
|
182
|
+
# @see https://developer.github.com/v3/projects/columns/#delete-a-project-column
|
183
183
|
# @example
|
184
184
|
# @client.delete_project_column(30294)
|
185
185
|
def delete_project_column(id, options = {})
|
@@ -192,7 +192,7 @@ module Octokit
|
|
192
192
|
# Requires authenticated client
|
193
193
|
#
|
194
194
|
# @param id [Integer] Project column id
|
195
|
-
# @param position [String] New position for the column. Can be one of
|
195
|
+
# @param position [String] New position for the column. Can be one of
|
196
196
|
# <tt>first</tt>, <tt>last</tt>, or <tt>after:<column-id></tt>, where
|
197
197
|
# <tt><column-id></tt> is the id value of a column in the same project.
|
198
198
|
# @return [Sawyer::Resource] Result
|
@@ -296,7 +296,7 @@ module Octokit
|
|
296
296
|
end
|
297
297
|
|
298
298
|
# Delete a project card
|
299
|
-
#
|
299
|
+
#
|
300
300
|
# Requires authenticated client
|
301
301
|
#
|
302
302
|
# @param id [Integer] Project card id
|
@@ -308,7 +308,6 @@ module Octokit
|
|
308
308
|
opts = ensure_api_media_type(:projects, options)
|
309
309
|
boolean_from_response :delete, "projects/columns/cards/#{id}", opts
|
310
310
|
end
|
311
|
-
|
312
311
|
end # Projects
|
313
312
|
end
|
314
313
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Octokit
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Methods for the PubSubHubbub API
|
5
6
|
#
|
6
7
|
# @see https://developer.github.com/v3/repos/hooks/#pubsubhubbub
|
7
8
|
module PubSubHubbub
|
8
|
-
|
9
9
|
# Subscribe to a pubsub topic
|
10
10
|
#
|
11
11
|
# @param topic [String] A recoginized and supported pubsub topic
|
@@ -18,11 +18,11 @@ module Octokit
|
|
18
18
|
# client.subscribe("https://github.com/joshk/devise_imapable/events/push", "github://Email?address=josh.kalderimis@gmail.com")
|
19
19
|
def subscribe(topic, callback, secret = nil)
|
20
20
|
options = {
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
"hub.callback": callback,
|
22
|
+
"hub.mode": 'subscribe',
|
23
|
+
"hub.topic": topic
|
24
24
|
}
|
25
|
-
options.merge!(
|
25
|
+
options.merge!("hub.secret": secret) unless secret.nil?
|
26
26
|
|
27
27
|
response = pub_sub_hubbub_request(options)
|
28
28
|
|
@@ -40,9 +40,9 @@ module Octokit
|
|
40
40
|
# client.unsubscribe("https://github.com/joshk/devise_imapable/events/push", "github://Email?address=josh.kalderimis@gmail.com")
|
41
41
|
def unsubscribe(topic, callback)
|
42
42
|
options = {
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
"hub.callback": callback,
|
44
|
+
"hub.mode": 'unsubscribe',
|
45
|
+
"hub.topic": topic
|
46
46
|
}
|
47
47
|
response = pub_sub_hubbub_request(options)
|
48
48
|
|
@@ -64,7 +64,7 @@ module Octokit
|
|
64
64
|
# client.subscribe_service_hook('joshk/device_imapable', 'Travis', { :token => "test", :domain => "domain", :user => "user" })
|
65
65
|
def subscribe_service_hook(repo, service_name, service_arguments = {}, secret = nil)
|
66
66
|
topic = "#{Octokit.web_endpoint}#{Repository.new(repo)}/events/push"
|
67
|
-
callback = "github://#{service_name}?#{service_arguments.collect{ |k,v| [
|
67
|
+
callback = "github://#{service_name}?#{service_arguments.collect { |k, v| [k, v].map { |p| URI.encode_www_form_component(p) }.join('=') }.join('&')}"
|
68
68
|
subscribe(topic, callback, secret)
|
69
69
|
end
|
70
70
|
|
@@ -88,20 +88,20 @@ module Octokit
|
|
88
88
|
def pub_sub_hubbub_request(options = {})
|
89
89
|
# This method is janky, bypass normal stack so we don't
|
90
90
|
# serialize request as JSON
|
91
|
-
conn = Faraday.new(:
|
91
|
+
conn = Faraday.new(url: @api_endpoint) do |http|
|
92
92
|
http.headers[:user_agent] = user_agent
|
93
93
|
if basic_authenticated?
|
94
|
-
http.
|
94
|
+
http.request *FARADAY_BASIC_AUTH_KEYS, @login, @password
|
95
95
|
elsif token_authenticated?
|
96
|
-
http.authorization 'token', @access_token
|
96
|
+
http.request :authorization, 'token', @access_token
|
97
97
|
end
|
98
|
-
http.request
|
98
|
+
http.request :url_encoded
|
99
99
|
http.use Octokit::Response::RaiseError
|
100
|
-
http.adapter
|
100
|
+
http.adapter Faraday.default_adapter
|
101
101
|
end
|
102
102
|
|
103
103
|
conn.post do |req|
|
104
|
-
req.url
|
104
|
+
req.url 'hub'
|
105
105
|
req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
106
106
|
req.body = options
|
107
107
|
end
|