octodoggy 4.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/CONTRIBUTING.md +22 -0
- data/LICENSE.md +20 -0
- data/README.md +714 -0
- data/Rakefile +22 -0
- data/lib/ext/sawyer/relation.rb +10 -0
- data/lib/octokit.rb +59 -0
- data/lib/octokit/arguments.rb +14 -0
- data/lib/octokit/authentication.rb +82 -0
- data/lib/octokit/client.rb +238 -0
- data/lib/octokit/client/authorizations.rb +244 -0
- data/lib/octokit/client/commit_comments.rb +95 -0
- data/lib/octokit/client/commits.rb +239 -0
- data/lib/octokit/client/contents.rb +162 -0
- data/lib/octokit/client/deployments.rb +62 -0
- data/lib/octokit/client/downloads.rb +50 -0
- data/lib/octokit/client/emojis.rb +18 -0
- data/lib/octokit/client/events.rb +151 -0
- data/lib/octokit/client/feeds.rb +33 -0
- data/lib/octokit/client/gists.rb +233 -0
- data/lib/octokit/client/gitignore.rb +43 -0
- data/lib/octokit/client/hooks.rb +297 -0
- data/lib/octokit/client/integrations.rb +77 -0
- data/lib/octokit/client/issues.rb +321 -0
- data/lib/octokit/client/labels.rb +156 -0
- data/lib/octokit/client/legacy_search.rb +42 -0
- data/lib/octokit/client/licenses.rb +45 -0
- data/lib/octokit/client/markdown.rb +27 -0
- data/lib/octokit/client/meta.rb +21 -0
- data/lib/octokit/client/milestones.rb +87 -0
- data/lib/octokit/client/notifications.rb +171 -0
- data/lib/octokit/client/objects.rb +141 -0
- data/lib/octokit/client/organizations.rb +768 -0
- data/lib/octokit/client/pages.rb +63 -0
- data/lib/octokit/client/projects.rb +314 -0
- data/lib/octokit/client/pub_sub_hubbub.rb +111 -0
- data/lib/octokit/client/pull_requests.rb +301 -0
- data/lib/octokit/client/rate_limit.rb +54 -0
- data/lib/octokit/client/reactions.rb +158 -0
- data/lib/octokit/client/refs.rb +118 -0
- data/lib/octokit/client/releases.rb +163 -0
- data/lib/octokit/client/repositories.rb +654 -0
- data/lib/octokit/client/repository_invitations.rb +103 -0
- data/lib/octokit/client/reviews.rb +174 -0
- data/lib/octokit/client/say.rb +19 -0
- data/lib/octokit/client/search.rb +76 -0
- data/lib/octokit/client/service_status.rb +38 -0
- data/lib/octokit/client/source_import.rb +161 -0
- data/lib/octokit/client/stats.rb +105 -0
- data/lib/octokit/client/statuses.rb +47 -0
- data/lib/octokit/client/traffic.rb +69 -0
- data/lib/octokit/client/users.rb +354 -0
- data/lib/octokit/configurable.rb +147 -0
- data/lib/octokit/connection.rb +199 -0
- data/lib/octokit/default.rb +166 -0
- data/lib/octokit/enterprise_admin_client.rb +40 -0
- data/lib/octokit/enterprise_admin_client/admin_stats.rb +120 -0
- data/lib/octokit/enterprise_admin_client/license.rb +18 -0
- data/lib/octokit/enterprise_admin_client/orgs.rb +27 -0
- data/lib/octokit/enterprise_admin_client/search_indexing.rb +83 -0
- data/lib/octokit/enterprise_admin_client/users.rb +128 -0
- data/lib/octokit/enterprise_management_console_client.rb +50 -0
- data/lib/octokit/enterprise_management_console_client/management_console.rb +176 -0
- data/lib/octokit/error.rb +286 -0
- data/lib/octokit/gist.rb +36 -0
- data/lib/octokit/middleware/follow_redirects.rb +131 -0
- data/lib/octokit/organization.rb +17 -0
- data/lib/octokit/preview.rb +38 -0
- data/lib/octokit/rate_limit.rb +33 -0
- data/lib/octokit/repo_arguments.rb +19 -0
- data/lib/octokit/repository.rb +93 -0
- data/lib/octokit/response/feed_parser.rb +21 -0
- data/lib/octokit/response/raise_error.rb +21 -0
- data/lib/octokit/user.rb +19 -0
- data/lib/octokit/version.rb +17 -0
- data/lib/octokit/warnable.rb +17 -0
- data/octokit.gemspec +22 -0
- metadata +160 -0
@@ -0,0 +1,103 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Repository Invitations API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/repos/invitations/
|
7
|
+
module RepositoryInvitations
|
8
|
+
|
9
|
+
# Invite a user to a repository
|
10
|
+
#
|
11
|
+
# Requires authenticated client
|
12
|
+
#
|
13
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
14
|
+
# @param user [String] User GitHub username to add
|
15
|
+
# @return [Sawyer::Resource] The repository invitation
|
16
|
+
# @see https://developer.github.com/v3/repos/invitations/#invite-a-user-to-a-repository
|
17
|
+
def invite_user_to_repository(repo, user, options = {})
|
18
|
+
options = ensure_api_media_type(:repository_invitations, options)
|
19
|
+
put "#{Repository.path repo}/collaborators/#{user}", options
|
20
|
+
end
|
21
|
+
alias invite_user_to_repo invite_user_to_repository
|
22
|
+
|
23
|
+
# List all invitations for a repository
|
24
|
+
#
|
25
|
+
# Requires authenticated client
|
26
|
+
#
|
27
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
28
|
+
# @return [Array<Sawyer::Resource>] A list of invitations
|
29
|
+
# @see https://developer.github.com/v3/repos/invitations/#list-invitations-for-a-repository
|
30
|
+
def repository_invitations(repo, options = {})
|
31
|
+
options = ensure_api_media_type(:repository_invitations, options)
|
32
|
+
paginate "#{Repository.path repo}/invitations", options
|
33
|
+
end
|
34
|
+
alias repo_invitations repository_invitations
|
35
|
+
|
36
|
+
# Delete an invitation for a repository
|
37
|
+
#
|
38
|
+
# Requires authenticated client
|
39
|
+
#
|
40
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
41
|
+
# @param invitation_id [Integer] The id of the invitation
|
42
|
+
# @return [Boolean] True if the invitation was successfully deleted
|
43
|
+
# @see https://developer.github.com/v3/repos/invitations/#delete-a-repository-invitation
|
44
|
+
def delete_repository_invitation(repo, invitation_id, options = {})
|
45
|
+
options = ensure_api_media_type(:repository_invitations, options)
|
46
|
+
boolean_from_response :delete, "#{Repository.path repo}/invitations/#{invitation_id}", options
|
47
|
+
end
|
48
|
+
alias delete_repo_invitation delete_repository_invitation
|
49
|
+
|
50
|
+
# Update an invitation for a repository
|
51
|
+
#
|
52
|
+
# Requires authenticated client
|
53
|
+
#
|
54
|
+
# @param repo [Integer, String, Repository, Hash] A GitHub repository
|
55
|
+
# @param invitation_id [Integer] The id of the invitation
|
56
|
+
# @return [Sawyer::Resource] The updated repository invitation
|
57
|
+
# @see https://developer.github.com/v3/repos/invitations/#update-a-repository-invitation
|
58
|
+
def update_repository_invitation(repo, invitation_id, options = {})
|
59
|
+
options = ensure_api_media_type(:repository_invitations, options)
|
60
|
+
patch "#{Repository.path repo}/invitations/#{invitation_id}", options
|
61
|
+
end
|
62
|
+
alias update_repo_invitation update_repository_invitation
|
63
|
+
|
64
|
+
# List all repository invitations for the user
|
65
|
+
#
|
66
|
+
# Requires authenticated client
|
67
|
+
#
|
68
|
+
# @return [Array<Sawyer::Resource>] The users repository invitations
|
69
|
+
# @see https://developer.github.com/v3/repos/invitations/#list-a-users-repository-invitations
|
70
|
+
def user_repository_invitations(options = {})
|
71
|
+
options = ensure_api_media_type(:repository_invitations, options)
|
72
|
+
paginate "/user/repository_invitations", options
|
73
|
+
end
|
74
|
+
alias user_repo_invitations user_repository_invitations
|
75
|
+
|
76
|
+
# Accept a repository invitation
|
77
|
+
#
|
78
|
+
# Requires authenticated client
|
79
|
+
#
|
80
|
+
# @param invitation_id [Integer] The id of the invitation
|
81
|
+
# @return [Boolean] True if the acceptance of the invitation was successful
|
82
|
+
# @see https://developer.github.com/v3/repos/invitations/#accept-a-repository-invitation
|
83
|
+
def accept_repository_invitation(invitation_id, options = {})
|
84
|
+
options = ensure_api_media_type(:repository_invitations, options)
|
85
|
+
patch "/user/repository_invitations/#{invitation_id}", options
|
86
|
+
end
|
87
|
+
alias accept_repo_invitation accept_repository_invitation
|
88
|
+
|
89
|
+
# Decline a repository invitation
|
90
|
+
#
|
91
|
+
# Requires authenticated client
|
92
|
+
#
|
93
|
+
# @param invitation_id [Integer] The id of the invitation
|
94
|
+
# @return [Boolean] True if the acceptance of the invitation was successful
|
95
|
+
# @see https://developer.github.com/v3/repos/invitations/#decline-a-repository-invitation
|
96
|
+
def decline_repository_invitation(invitation_id, options = {})
|
97
|
+
options = ensure_api_media_type(:repository_invitations, options)
|
98
|
+
boolean_from_response :delete, "/user/repository_invitations/#{invitation_id}", options
|
99
|
+
end
|
100
|
+
alias decline_invitation decline_repository_invitation
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,174 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Reviews API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/reviews/
|
7
|
+
module Reviews
|
8
|
+
|
9
|
+
# List reviews on a pull request
|
10
|
+
#
|
11
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
12
|
+
# @param id [Integer] The id of the pull request
|
13
|
+
# @see https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# @client.pull_request_reviews('octokit/octokit.rb', 2)
|
17
|
+
#
|
18
|
+
# @return [Array<Sawyer::Resource>] Array of Hashes representing the reviews
|
19
|
+
def pull_request_reviews(repo, id, options = {})
|
20
|
+
options = ensure_api_media_type(:reviews, options)
|
21
|
+
get "#{Repository.path repo}/pulls/#{id}/reviews", options
|
22
|
+
end
|
23
|
+
|
24
|
+
# Get a single review
|
25
|
+
#
|
26
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
27
|
+
# @param number [Integer] The id of the pull request
|
28
|
+
# @param review [Integer] The id of the review
|
29
|
+
# @see https://developer.github.com/v3/pulls/reviews/#get-a-single-review
|
30
|
+
#
|
31
|
+
# @example
|
32
|
+
# @client.pull_request_review('octokit/octokit.rb', 825, 6505518)
|
33
|
+
#
|
34
|
+
# @return [Sawyer::Resource] Hash representing the review
|
35
|
+
def pull_request_review(repo, number, review, options = {})
|
36
|
+
options = ensure_api_media_type(:reviews, options)
|
37
|
+
get "#{Repository.path repo}/pulls/#{number}/reviews/#{review}", options
|
38
|
+
end
|
39
|
+
|
40
|
+
# Delete a pending review
|
41
|
+
#
|
42
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
43
|
+
# @param number [Integer] The id of the pull request
|
44
|
+
# @param review [Integer] The id of the review
|
45
|
+
# @see https://developer.github.com/v3/pulls/reviews/#delete-a-pending-review
|
46
|
+
#
|
47
|
+
# @example
|
48
|
+
# @client.delete_pull_request_review('octokit/octokit.rb', 825, 6505518)
|
49
|
+
#
|
50
|
+
# @return [Sawyer::Resource] Hash representing the deleted review
|
51
|
+
def delete_pull_request_review(repo, number, review, options = {})
|
52
|
+
options = ensure_api_media_type(:reviews, options)
|
53
|
+
delete "#{Repository.path repo}/pulls/#{number}/reviews/#{review}", options
|
54
|
+
end
|
55
|
+
|
56
|
+
# Get comments for a single review
|
57
|
+
#
|
58
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
59
|
+
# @param number [Integer] The id of the pull request
|
60
|
+
# @param review [Integer] The id of the review
|
61
|
+
# @see https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review
|
62
|
+
#
|
63
|
+
# @example
|
64
|
+
# @client.pull_request_review_comments('octokit/octokit.rb', 825, 6505518)
|
65
|
+
#
|
66
|
+
# @return [Array<Sawyer::Resource>] Array of Hashes representing the review comments
|
67
|
+
def pull_request_review_comments(repo, number, review, options = {})
|
68
|
+
options = ensure_api_media_type(:reviews, options)
|
69
|
+
get "#{Repository.path repo}/pulls/#{number}/reviews/#{review}/comments", options
|
70
|
+
end
|
71
|
+
|
72
|
+
# Create a pull request review
|
73
|
+
#
|
74
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
75
|
+
# @param id [Integer] The id of the pull request
|
76
|
+
# @param options [Hash] Method options
|
77
|
+
# @option options [String] :event The review action (event) to perform;
|
78
|
+
# can be one of APPROVE, REQUEST_CHANGES, or COMMENT.
|
79
|
+
# If left blank, the review is left PENDING.
|
80
|
+
# @option options [String] :body The body text of the pull request review
|
81
|
+
# @option options [Array<Hash>] :comments Comments part of the review
|
82
|
+
# @option comments [String] :path The path to the file being commented on
|
83
|
+
# @option comments [Integer] :position The position in the file to be commented on
|
84
|
+
# @option comments [String] :body Body of the comment
|
85
|
+
# @see https://developer.github.com/v3/pulls/reviews/#create-a-pull-request-review
|
86
|
+
#
|
87
|
+
# @example
|
88
|
+
# comments = [
|
89
|
+
# { path: '.travis.yml', position: 10, body: 'ruby-head is under development that is not stable.' },
|
90
|
+
# { path: '.travis.yml', position: 32, body: 'ruby-head is also required in thervm section.' },
|
91
|
+
# ]
|
92
|
+
# options = { event: 'REQUEST_CHANGES', comments: comments }
|
93
|
+
# @client.create_pull_request_review('octokit/octokit.rb', 844, options)
|
94
|
+
#
|
95
|
+
# @return [Sawyer::Resource>] Hash respresenting the review
|
96
|
+
def create_pull_request_review(repo, id, options = {})
|
97
|
+
options = ensure_api_media_type(:reviews, options)
|
98
|
+
post "#{Repository.path repo}/pulls/#{id}/reviews", options
|
99
|
+
end
|
100
|
+
|
101
|
+
# Submit a pull request review
|
102
|
+
#
|
103
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
104
|
+
# @param number [Integer] The id of the pull request
|
105
|
+
# @param review [Integer] The id of the review
|
106
|
+
# @param event [String] The review action (event) to perform; can be one of
|
107
|
+
# APPROVE, REQUEST_CHANGES, or COMMENT.
|
108
|
+
# @param options [Hash] Method options
|
109
|
+
# @option options [String] :body The body text of the pull request review
|
110
|
+
# @see https://developer.github.com/v3/pulls/reviews/#submit-a-pull-request-review
|
111
|
+
#
|
112
|
+
# @example
|
113
|
+
# @client.submit_pull_request_review('octokit/octokit.rb', 825, 6505518,
|
114
|
+
# 'APPROVE', body: 'LGTM!')
|
115
|
+
#
|
116
|
+
# @return [Sawyer::Resource] Hash respresenting the review
|
117
|
+
def submit_pull_request_review(repo, number, review, event, options = {})
|
118
|
+
options = options.merge(event: event)
|
119
|
+
options = ensure_api_media_type(:reviews, options)
|
120
|
+
post "#{Repository.path repo}/pulls/#{number}/reviews/#{review}/events", options
|
121
|
+
end
|
122
|
+
|
123
|
+
# Dismiss a pull request review
|
124
|
+
#
|
125
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
126
|
+
# @param number [Integer] The id of the pull request
|
127
|
+
# @param review [Integer] The id of the review
|
128
|
+
# @param message [String] The message for the pull request review dismissal
|
129
|
+
# @see https://developer.github.com/v3/pulls/reviews/#dismiss-a-pull-request-review
|
130
|
+
#
|
131
|
+
# @example
|
132
|
+
# @client.dismiss_pull_request_review('octokit/octokit.rb', 825, 6505518)
|
133
|
+
#
|
134
|
+
# @return [Sawyer::Resource] Hash representing the dismissed review
|
135
|
+
def dismiss_pull_request_review(repo, number, review, message, options = {})
|
136
|
+
options = options.merge(message: message)
|
137
|
+
options = ensure_api_media_type(:reviews, options)
|
138
|
+
put "#{Repository.path repo}/pulls/#{number}/reviews/#{review}/dismissals", options
|
139
|
+
end
|
140
|
+
|
141
|
+
# List review requests
|
142
|
+
#
|
143
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
144
|
+
# @param id [Integer] The id of the pull request
|
145
|
+
# @see https://developer.github.com/v3/pulls/review_requests/#list-review-requests
|
146
|
+
#
|
147
|
+
# @example
|
148
|
+
# @client.pull_request_review_requests('octokit/octokit.rb', 2)
|
149
|
+
#
|
150
|
+
# @return [Array<Sawyer::Resource>] Array of Hashes representing the review requests
|
151
|
+
def pull_request_review_requests(repo, id, options = {})
|
152
|
+
options = ensure_api_media_type(:reviews, options)
|
153
|
+
get "#{Repository.path repo}/pulls/#{id}/requested_reviewers", options
|
154
|
+
end
|
155
|
+
|
156
|
+
# Create a review request
|
157
|
+
#
|
158
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository
|
159
|
+
# @param id [Integer] The id of the pull request
|
160
|
+
# @param reviewers [Array<String>] An array of user logins that will be requested
|
161
|
+
# @see https://developer.github.com/v3/pulls/review_requests/#create-a-review-request
|
162
|
+
#
|
163
|
+
# @example
|
164
|
+
# @client.request_pull_request_review('octokit/octokit.rb', 2, ['soudy'])
|
165
|
+
#
|
166
|
+
# @return [Sawyer::Resource>] Hash respresenting the pull request
|
167
|
+
def request_pull_request_review(repo, id, reviewers, options = {})
|
168
|
+
options = options.merge(reviewers: reviewers)
|
169
|
+
options = ensure_api_media_type(:reviews, options)
|
170
|
+
post "#{Repository.path repo}/pulls/#{id}/requested_reviewers", options
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the unpublished Octocat API
|
5
|
+
module Say
|
6
|
+
|
7
|
+
# Return a nifty ASCII Octocat with GitHub wisdom
|
8
|
+
# or your own
|
9
|
+
#
|
10
|
+
# @return [String]
|
11
|
+
def say(text = nil, options = {})
|
12
|
+
options[:s] = text if text
|
13
|
+
get "octocat", options
|
14
|
+
end
|
15
|
+
alias :octocat :say
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Search API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/search/
|
7
|
+
module Search
|
8
|
+
|
9
|
+
# Search code
|
10
|
+
#
|
11
|
+
# @param query [String] Search term and qualifiers
|
12
|
+
# @param options [Hash] Sort and pagination options
|
13
|
+
# @option options [String] :sort Sort field
|
14
|
+
# @option options [String] :order Sort order (asc or desc)
|
15
|
+
# @option options [Integer] :page Page of paginated results
|
16
|
+
# @option options [Integer] :per_page Number of items per page
|
17
|
+
# @return [Sawyer::Resource] Search results object
|
18
|
+
# @see https://developer.github.com/v3/search/#search-code
|
19
|
+
def search_code(query, options = {})
|
20
|
+
search "search/code", query, options
|
21
|
+
end
|
22
|
+
|
23
|
+
# Search issues
|
24
|
+
#
|
25
|
+
# @param query [String] Search term and qualifiers
|
26
|
+
# @param options [Hash] Sort and pagination options
|
27
|
+
# @option options [String] :sort Sort field
|
28
|
+
# @option options [String] :order Sort order (asc or desc)
|
29
|
+
# @option options [Integer] :page Page of paginated results
|
30
|
+
# @option options [Integer] :per_page Number of items per page
|
31
|
+
# @return [Sawyer::Resource] Search results object
|
32
|
+
# @see https://developer.github.com/v3/search/#search-issues
|
33
|
+
def search_issues(query, options = {})
|
34
|
+
search "search/issues", query, options
|
35
|
+
end
|
36
|
+
|
37
|
+
# Search repositories
|
38
|
+
#
|
39
|
+
# @param query [String] Search term and qualifiers
|
40
|
+
# @param options [Hash] Sort and pagination options
|
41
|
+
# @option options [String] :sort Sort field
|
42
|
+
# @option options [String] :order Sort order (asc or desc)
|
43
|
+
# @option options [Integer] :page Page of paginated results
|
44
|
+
# @option options [Integer] :per_page Number of items per page
|
45
|
+
# @return [Sawyer::Resource] Search results object
|
46
|
+
# @see https://developer.github.com/v3/search/#search-repositories
|
47
|
+
def search_repositories(query, options = {})
|
48
|
+
search "search/repositories", query, options
|
49
|
+
end
|
50
|
+
alias :search_repos :search_repositories
|
51
|
+
|
52
|
+
# Search users
|
53
|
+
#
|
54
|
+
# @param query [String] Search term and qualifiers
|
55
|
+
# @param options [Hash] Sort and pagination options
|
56
|
+
# @option options [String] :sort Sort field
|
57
|
+
# @option options [String] :order Sort order (asc or desc)
|
58
|
+
# @option options [Integer] :page Page of paginated results
|
59
|
+
# @option options [Integer] :per_page Number of items per page
|
60
|
+
# @return [Sawyer::Resource] Search results object
|
61
|
+
# @see https://developer.github.com/v3/search/#search-users
|
62
|
+
def search_users(query, options = {})
|
63
|
+
search "search/users", query, options
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def search(path, query, options = {})
|
69
|
+
opts = options.merge(:q => query)
|
70
|
+
paginate(path, opts) do |data, last_response|
|
71
|
+
data.items.concat last_response.data.items
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the GitHub Status API
|
5
|
+
#
|
6
|
+
# @see https://status.github.com/api
|
7
|
+
module ServiceStatus
|
8
|
+
|
9
|
+
# Root for status API
|
10
|
+
# @private
|
11
|
+
STATUS_ROOT = 'https://status.github.com/api.json'
|
12
|
+
|
13
|
+
# Returns the current system status
|
14
|
+
#
|
15
|
+
# @return [Sawyer::Resource] GitHub status
|
16
|
+
# @see https://status.github.com/api#api-current-status
|
17
|
+
def github_status
|
18
|
+
get(STATUS_ROOT).rels[:status].get.data
|
19
|
+
end
|
20
|
+
|
21
|
+
# Returns the last human communication, status, and timestamp.
|
22
|
+
#
|
23
|
+
# @return [Sawyer::Resource] GitHub status last message
|
24
|
+
# @see https://status.github.com/api#api-last-message
|
25
|
+
def github_status_last_message
|
26
|
+
get(STATUS_ROOT).rels[:last_message].get.data
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns the most recent human communications with status and timestamp.
|
30
|
+
#
|
31
|
+
# @return [Array<Sawyer::Resource>] GitHub status messages
|
32
|
+
# @see https://status.github.com/api#api-recent-messages
|
33
|
+
def github_status_messages
|
34
|
+
get(STATUS_ROOT).rels[:messages].get.data
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
|
4
|
+
# Methods for the Source Import API
|
5
|
+
#
|
6
|
+
# @see https://developer.github.com/v3/migration/source_imports
|
7
|
+
module SourceImport
|
8
|
+
|
9
|
+
# Start a source import to a GitHub repository using GitHub Importer.
|
10
|
+
#
|
11
|
+
# @overload start_source_import(repo, vcs, vcs_url, options = {})
|
12
|
+
# @deprecated
|
13
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
14
|
+
# @param vcs [String] The originating VCS type. Can be one of "subversion", "git", "mercurial", or "tfvc".
|
15
|
+
# @param vcs_url [String] The URL of the originating repository.
|
16
|
+
# @param options [Hash]
|
17
|
+
# @option options [String] :vcs_username If authentication is required, the username to provide to vcs_url.
|
18
|
+
# @option options [String] :vcs_password If authentication is required, the password to provide to vcs_url.
|
19
|
+
# @option options [String] :tfvc_project For a tfvc import, the name of the project that is being imported.
|
20
|
+
# @overload start_source_import(repo, vcs_url, options = {})
|
21
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
22
|
+
# @param vcs_url [String] The URL of the originating repository.
|
23
|
+
# @param options [Hash]
|
24
|
+
# @param options [String] :vcs The originating VCS type. Can be one of "subversion", "git", "mercurial", or "tfvc".
|
25
|
+
# @option options [String] :vcs_username If authentication is required, the username to provide to vcs_url.
|
26
|
+
# @option options [String] :vcs_password If authentication is required, the password to provide to vcs_url.
|
27
|
+
# @option options [String] :tfvc_project For a tfvc import, the name of the project that is being imported.
|
28
|
+
# @return [Sawyer::Resource] Hash representing the repository import
|
29
|
+
# @see https://developer.github.com/v3/migration/source_imports/#start-an-import
|
30
|
+
#
|
31
|
+
# @example
|
32
|
+
# @client.start_source_import("octokit/octokit.rb", "http://svn.mycompany.com/svn/myproject", {
|
33
|
+
# :vcs => "subversion",
|
34
|
+
# :vcs_username" => "octocat",
|
35
|
+
# :vcs_password => "secret"
|
36
|
+
# })
|
37
|
+
def start_source_import(*args)
|
38
|
+
arguments = Octokit::RepoArguments.new(args)
|
39
|
+
vcs_url = arguments.pop
|
40
|
+
vcs = arguments.pop
|
41
|
+
if vcs
|
42
|
+
octokit_warn "Octokit#start_source_import vcs parameter is now an option, please update your call before the next major Octokit version update."
|
43
|
+
arguments.options.merge!(:vcs => vcs)
|
44
|
+
end
|
45
|
+
options = ensure_api_media_type(:source_imports, arguments.options.merge(:vcs_url => vcs_url))
|
46
|
+
put "#{Repository.path arguments.repo}/import", options
|
47
|
+
end
|
48
|
+
|
49
|
+
# View the progress of an import.
|
50
|
+
#
|
51
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
52
|
+
# @return [Sawyer::Resource] Hash representing the progress of the import
|
53
|
+
# @see https://developer.github.com/v3/migration/source_imports/#get-import-progress
|
54
|
+
#
|
55
|
+
# @example
|
56
|
+
# @client.source_import_progress("octokit/octokit.rb")
|
57
|
+
def source_import_progress(repo, options = {})
|
58
|
+
options = ensure_api_media_type(:source_imports, options)
|
59
|
+
get "#{Repository.path repo}/import", options
|
60
|
+
end
|
61
|
+
|
62
|
+
# Update source import with authentication or project choice
|
63
|
+
# Restart source import if no options are passed
|
64
|
+
#
|
65
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
66
|
+
# @return [Sawyer::Resource] Hash representing the repository import
|
67
|
+
# @see https://developer.github.com/v3/migration/source_imports/#update-existing-import
|
68
|
+
# @option options [String] :vcs_username If authentication is required, the username to provide to vcs_url.
|
69
|
+
# @option options [String] :vcs_password If authentication is required, the password to provide to vcs_url.
|
70
|
+
# @option options [String] To update project choice, please refer to the project_choice array from the progress return hash for the exact attributes.
|
71
|
+
# https://developer.github.com/v3/migration/source_imports/#update-existing-import
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# @client.update_source_import("octokit/octokit.rb", {
|
75
|
+
# :vcs_username" => "octocat",
|
76
|
+
# :vcs_password => "secret"
|
77
|
+
# })
|
78
|
+
def update_source_import(repo, options = {})
|
79
|
+
options = ensure_api_media_type(:source_imports, options)
|
80
|
+
patch "#{Repository.path repo}/import", options
|
81
|
+
end
|
82
|
+
|
83
|
+
# List source import commit authors
|
84
|
+
#
|
85
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
86
|
+
# @param options [Hash]
|
87
|
+
# @option options [String] :since Only authors found after this id are returned.
|
88
|
+
# @return [Array<Sawyer::Resource>] Array of hashes representing commit_authors.
|
89
|
+
# @see https://developer.github.com/v3/migration/source_imports/#get-commit-authors
|
90
|
+
#
|
91
|
+
# @example
|
92
|
+
# @client.source_import_commit_authors("octokit/octokit.rb")
|
93
|
+
def source_import_commit_authors(repo, options = {})
|
94
|
+
options = ensure_api_media_type(:source_imports, options)
|
95
|
+
get "#{Repository.path repo}/import/authors", options
|
96
|
+
end
|
97
|
+
|
98
|
+
# Update an author's identity for the import.
|
99
|
+
#
|
100
|
+
# @param author_url [String] The source import API url for the commit author
|
101
|
+
# @param values [Hash] The updated author attributes
|
102
|
+
# @option values [String] :email The new Git author email.
|
103
|
+
# @option values [String] :name The new Git author name.
|
104
|
+
# @return [Sawyer::Resource] Hash representing the updated commit author
|
105
|
+
# @see https://developer.github.com/v3/migration/source_imports/#map-a-commit-author
|
106
|
+
#
|
107
|
+
# @example
|
108
|
+
# author_url = "https://api.github.com/repos/octokit/octokit.rb/import/authors/1"
|
109
|
+
# @client.map_source_import_commit_author(author_url, {
|
110
|
+
# :email => "hubot@github.com",
|
111
|
+
# :name => "Hubot the Robot"
|
112
|
+
# })
|
113
|
+
def map_source_import_commit_author(author_url, values, options = {})
|
114
|
+
options = ensure_api_media_type(:source_imports, options.merge(values))
|
115
|
+
patch author_url, options
|
116
|
+
end
|
117
|
+
|
118
|
+
# Stop an import for a repository.
|
119
|
+
#
|
120
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
121
|
+
# @return [Boolean] True if the import has been cancelled, false otherwise.
|
122
|
+
# @see https://developer.github.com/v3/migration/source_imports/#cancel-an-import
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
# @client.cancel_source_import("octokit/octokit.rb")
|
126
|
+
def cancel_source_import(repo, options = {})
|
127
|
+
options = ensure_api_media_type(:source_imports, options)
|
128
|
+
boolean_from_response :delete, "#{Repository.path repo}/import", options
|
129
|
+
end
|
130
|
+
|
131
|
+
# List source import large files
|
132
|
+
#
|
133
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
134
|
+
# @param options [Hash]
|
135
|
+
# @option options [Integer] :page Page of paginated results
|
136
|
+
# @return [Array<Sawyer::Resource>] Array of hashes representing files over 100MB.
|
137
|
+
# @see https://developer.github.com/v3/migration/source_imports/#get-large-files
|
138
|
+
#
|
139
|
+
# @example
|
140
|
+
# @client.source_import_large_files("octokit/octokit.rb")
|
141
|
+
def source_import_large_files(repo, options = {})
|
142
|
+
options = ensure_api_media_type(:source_imports, options)
|
143
|
+
get "#{Repository.path repo}/import/large_files", options
|
144
|
+
end
|
145
|
+
|
146
|
+
# Set preference for using Git LFS to import files over 100MB
|
147
|
+
#
|
148
|
+
# @param repo [Integer, String, Hash, Repository] A GitHub repository.
|
149
|
+
# @param use_lfs [String] Preference for using Git LFS to import large files. Can be one of "opt_in" or "opt_out"
|
150
|
+
# @return [Sawyer::Resource] Hash representing the repository import
|
151
|
+
# @see https://developer.github.com/v3/migration/source_imports/#set-git-lfs-preference
|
152
|
+
#
|
153
|
+
# @example
|
154
|
+
# @client.opt_in_source_import_lfs("octokit/octokit.rb", "opt_in")
|
155
|
+
def set_source_import_lfs_preference(repo, use_lfs, options = {})
|
156
|
+
options = ensure_api_media_type(:source_imports, options.merge(:use_lfs => use_lfs))
|
157
|
+
patch "#{Repository.path repo}/import/lfs", options
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|