octokit 1.18.0 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +1 -1
- data/.rspec +1 -0
- data/CHANGELOG.md +25 -0
- data/{LICENSE → LICENSE.md} +0 -0
- data/README.md +25 -8
- data/lib/faraday/response/raise_octokit_error.rb +4 -1
- data/lib/octokit/client.rb +6 -0
- data/lib/octokit/client/authorizations.rb +20 -7
- data/lib/octokit/client/commits.rb +120 -13
- data/lib/octokit/client/contents.rb +3 -4
- data/lib/octokit/client/downloads.rb +4 -3
- data/lib/octokit/client/emojis.rb +1 -1
- data/lib/octokit/client/events.rb +4 -4
- data/lib/octokit/client/gists.rb +33 -31
- data/lib/octokit/client/issues.rb +15 -15
- data/lib/octokit/client/labels.rb +13 -13
- data/lib/octokit/client/markdown.rb +2 -1
- data/lib/octokit/client/milestones.rb +6 -6
- data/lib/octokit/client/notifications.rb +222 -0
- data/lib/octokit/client/objects.rb +4 -4
- data/lib/octokit/client/organizations.rb +65 -20
- data/lib/octokit/client/pub_sub_hubbub.rb +2 -2
- data/lib/octokit/client/pulls.rb +91 -3
- data/lib/octokit/client/rate_limit.rb +20 -0
- data/lib/octokit/client/refs.rb +4 -4
- data/lib/octokit/client/repositories.rb +106 -37
- data/lib/octokit/client/say.rb +14 -0
- data/lib/octokit/client/statuses.rb +2 -2
- data/lib/octokit/client/users.rb +92 -24
- data/lib/octokit/connection.rb +21 -21
- data/lib/octokit/request.rb +47 -36
- data/lib/octokit/version.rb +1 -1
- data/octokit.gemspec +25 -25
- data/spec/fixtures/{v3/authorization.json → authorization.json} +0 -0
- data/spec/fixtures/{v3/authorizations.json → authorizations.json} +0 -0
- data/spec/fixtures/{v3/blob.json → blob.json} +0 -0
- data/spec/fixtures/{v3/blob_create.json → blob_create.json} +0 -0
- data/spec/fixtures/{v3/branches.json → branches.json} +0 -0
- data/spec/fixtures/{v3/collaborators.json → collaborators.json} +0 -0
- data/spec/fixtures/{v3/comment.json → comment.json} +0 -0
- data/spec/fixtures/{v3/comments.json → comments.json} +0 -0
- data/spec/fixtures/{v3/commit.json → commit.json} +0 -0
- data/spec/fixtures/{v3/commit_comment.json → commit_comment.json} +0 -0
- data/spec/fixtures/{v3/commit_comment_create.json → commit_comment_create.json} +0 -0
- data/spec/fixtures/{v3/commit_comment_update.json → commit_comment_update.json} +0 -0
- data/spec/fixtures/{v3/commit_comments.json → commit_comments.json} +0 -0
- data/spec/fixtures/{v3/commit_create.json → commit_create.json} +0 -0
- data/spec/fixtures/{v3/commits.json → commits.json} +0 -0
- data/spec/fixtures/{v3/compare.json → compare.json} +0 -0
- data/spec/fixtures/{v3/contents.json → contents.json} +0 -0
- data/spec/fixtures/{v3/contributors.json → contributors.json} +0 -0
- data/spec/fixtures/{v3/download.json → download.json} +0 -0
- data/spec/fixtures/{v3/download_create.json → download_create.json} +0 -0
- data/spec/fixtures/{v3/downloads.json → downloads.json} +0 -0
- data/spec/fixtures/{v3/emails.json → emails.json} +0 -0
- data/spec/fixtures/{v3/emojis.json → emojis.json} +0 -0
- data/spec/fixtures/{v3/followers.json → followers.json} +0 -0
- data/spec/fixtures/{v3/following.json → following.json} +0 -0
- data/spec/fixtures/{v3/forks.json → forks.json} +0 -0
- data/spec/fixtures/{v3/gist.json → gist.json} +0 -0
- data/spec/fixtures/{v3/gist_comment.json → gist_comment.json} +0 -0
- data/spec/fixtures/{v3/gist_comment_create.json → gist_comment_create.json} +0 -0
- data/spec/fixtures/{v3/gist_comment_update.json → gist_comment_update.json} +0 -0
- data/spec/fixtures/{v3/gist_comments.json → gist_comments.json} +0 -0
- data/spec/fixtures/{v3/gists.json → gists.json} +0 -0
- data/spec/fixtures/{v3/hook.json → hook.json} +0 -0
- data/spec/fixtures/{v3/hooks.json → hooks.json} +0 -0
- data/spec/fixtures/{v3/issue.json → issue.json} +0 -0
- data/spec/fixtures/{v3/issue_closed.json → issue_closed.json} +0 -0
- data/spec/fixtures/{v3/issue_event.json → issue_event.json} +0 -0
- data/spec/fixtures/{v3/issue_events.json → issue_events.json} +0 -0
- data/spec/fixtures/issue_full.json +38 -0
- data/spec/fixtures/{v3/issues.json → issues.json} +0 -0
- data/spec/fixtures/{v3/label.json → label.json} +0 -0
- data/spec/fixtures/{v3/labels.json → labels.json} +0 -0
- data/spec/fixtures/{v3/languages.json → languages.json} +0 -0
- data/spec/fixtures/{v3/list_commit_comments.json → list_commit_comments.json} +0 -0
- data/spec/fixtures/{v3/markdown_gfm → markdown_gfm} +0 -0
- data/spec/fixtures/{v3/merge.json → merge.json} +0 -0
- data/spec/fixtures/{v3/milestone.json → milestone.json} +0 -0
- data/spec/fixtures/{v3/milestones.json → milestones.json} +0 -0
- data/spec/fixtures/{v3/not_found.json → not_found.json} +0 -0
- data/spec/fixtures/notification_thread.json +32 -0
- data/spec/fixtures/notifications.json +32 -0
- data/spec/fixtures/{v3/organization-repositories.json → organization-repositories.json} +0 -0
- data/spec/fixtures/{v3/organization-repository.json → organization-repository.json} +0 -0
- data/spec/fixtures/{v3/organization.json → organization.json} +0 -0
- data/spec/fixtures/{v3/organization_members.json → organization_members.json} +0 -0
- data/spec/fixtures/{v3/organization_team_members.json → organization_team_members.json} +0 -0
- data/spec/fixtures/{v3/organization_team_repos.json → organization_team_repos.json} +0 -0
- data/spec/fixtures/{v3/organizations.json → organizations.json} +0 -0
- data/spec/fixtures/{v3/public_events.json → public_events.json} +0 -0
- data/spec/fixtures/{v3/public_gists.json → public_gists.json} +0 -0
- data/spec/fixtures/{v3/public_key.json → public_key.json} +0 -0
- data/spec/fixtures/public_key_update.json +5 -0
- data/spec/fixtures/{v3/public_keys.json → public_keys.json} +0 -0
- data/spec/fixtures/{v3/pull_created.json → pull_created.json} +0 -0
- data/spec/fixtures/{v3/pull_request.json → pull_request.json} +0 -0
- data/spec/fixtures/pull_request_comment.json +35 -0
- data/spec/fixtures/pull_request_comment_create.json +35 -0
- data/spec/fixtures/pull_request_comment_reply.json +35 -0
- data/spec/fixtures/pull_request_comment_update.json +35 -0
- data/spec/fixtures/{v3/pull_request_comments.json → pull_request_comments.json} +0 -0
- data/spec/fixtures/{v3/pull_request_commits.json → pull_request_commits.json} +0 -0
- data/spec/fixtures/{v3/pull_request_files.json → pull_request_files.json} +0 -0
- data/spec/fixtures/{v3/pull_request_merged.json → pull_request_merged.json} +0 -0
- data/spec/fixtures/{v3/pull_requests.json → pull_requests.json} +0 -0
- data/spec/fixtures/{v3/pull_update.json → pull_update.json} +0 -0
- data/spec/fixtures/{v3/readme.json → readme.json} +0 -0
- data/spec/fixtures/{v3/ref.json → ref.json} +0 -0
- data/spec/fixtures/{v3/ref_create.json → ref_create.json} +0 -0
- data/spec/fixtures/{v3/ref_update.json → ref_update.json} +0 -0
- data/spec/fixtures/{v3/refs.json → refs.json} +0 -0
- data/spec/fixtures/{v3/refs_tags.json → refs_tags.json} +0 -0
- data/spec/fixtures/{v3/repo_assignees.json → repo_assignees.json} +0 -0
- data/spec/fixtures/{v3/repo_events.json → repo_events.json} +0 -0
- data/spec/fixtures/{v3/repo_issues_events.json → repo_issues_events.json} +0 -0
- data/spec/fixtures/{v3/repositories.json → repositories.json} +0 -0
- data/spec/fixtures/{v3/repository.json → repository.json} +0 -0
- data/spec/fixtures/repository_notifications.json +32 -0
- data/spec/fixtures/say.txt +22 -0
- data/spec/fixtures/say_custom.txt +22 -0
- data/spec/fixtures/{v3/stargazers.json → stargazers.json} +0 -0
- data/spec/fixtures/{v3/starred.json → starred.json} +0 -0
- data/spec/fixtures/{v3/starred_gists.json → starred_gists.json} +0 -0
- data/spec/fixtures/{v3/status.json → status.json} +0 -0
- data/spec/fixtures/{v3/statuses.json → statuses.json} +0 -0
- data/spec/fixtures/subscribers.json +9 -0
- data/spec/fixtures/subscription.json +8 -0
- data/spec/fixtures/subscription_update.json +8 -0
- data/spec/fixtures/subscriptions.json +39 -0
- data/spec/fixtures/{v3/tag.json → tag.json} +0 -0
- data/spec/fixtures/{v3/tag_create.json → tag_create.json} +0 -0
- data/spec/fixtures/{v3/tags.json → tags.json} +0 -0
- data/spec/fixtures/{v3/team.json → team.json} +0 -0
- data/spec/fixtures/{v3/teams.json → teams.json} +0 -0
- data/spec/fixtures/thread_subscription.json +8 -0
- data/spec/fixtures/thread_subscription_update.json +8 -0
- data/spec/fixtures/{v3/tree.json → tree.json} +0 -0
- data/spec/fixtures/{v3/tree_create.json → tree_create.json} +0 -0
- data/spec/fixtures/{v3/user.json → user.json} +0 -0
- data/spec/fixtures/{v3/user_events.json → user_events.json} +0 -0
- data/spec/fixtures/validation_failed.json +11 -0
- data/spec/fixtures/{v3/watched.json → watched.json} +0 -0
- data/spec/fixtures/{v3/watchers.json → watchers.json} +0 -0
- data/spec/helper.rb +13 -2
- data/spec/octokit/client/authorizations_spec.rb +44 -7
- data/spec/octokit/client/commits_spec.rb +136 -11
- data/spec/octokit/client/contents_spec.rb +6 -3
- data/spec/octokit/client/downloads_spec.rb +5 -6
- data/spec/octokit/client/emojis_spec.rb +1 -1
- data/spec/octokit/client/events_spec.rb +5 -5
- data/spec/octokit/client/gists_spec.rb +20 -20
- data/spec/octokit/client/issue_events_spec.rb +2 -2
- data/spec/octokit/client/issues_spec.rb +25 -14
- data/spec/octokit/client/labels_spec.rb +18 -22
- data/spec/octokit/client/markdown_spec.rb +1 -1
- data/spec/octokit/client/milestones_spec.rb +8 -8
- data/spec/octokit/client/notifications_spec.rb +141 -0
- data/spec/octokit/client/objects_spec.rb +6 -6
- data/spec/octokit/client/organizations_spec.rb +65 -13
- data/spec/octokit/client/pub_sub_hubbub/service_hooks_spec.rb +4 -4
- data/spec/octokit/client/pub_sub_hubbub_spec.rb +3 -3
- data/spec/octokit/client/pulls_spec.rb +81 -10
- data/spec/octokit/client/refs_spec.rb +7 -7
- data/spec/octokit/client/repositories_spec.rb +86 -34
- data/spec/octokit/client/say_spec.rb +37 -0
- data/spec/octokit/client/statuses_spec.rb +2 -2
- data/spec/octokit/client/users_spec.rb +65 -16
- data/spec/octokit/client_spec.rb +37 -11
- data/spec/{repository_spec.rb → octokit/repository_spec.rb} +0 -0
- data/spec/octokit_spec.rb +1 -1
- metadata +240 -196
@@ -14,7 +14,8 @@ module Octokit
|
|
14
14
|
def markdown(text, options={})
|
15
15
|
options[:text] = text
|
16
16
|
options[:repo] = Repository.new(options[:repo]) if options[:repo]
|
17
|
-
|
17
|
+
options[:accept] = 'application/vnd.github.raw'
|
18
|
+
request(:post, "markdown", options).body
|
18
19
|
end
|
19
20
|
|
20
21
|
end
|
@@ -15,7 +15,7 @@ module Octokit
|
|
15
15
|
# @example List milestones for a repository
|
16
16
|
# Octokit.list_milestones("pengwynn/octokit")
|
17
17
|
def list_milestones(repository, options={})
|
18
|
-
get("repos/#{Repository.new(repository)}/milestones", options
|
18
|
+
get("repos/#{Repository.new(repository)}/milestones", options)
|
19
19
|
end
|
20
20
|
alias :milestones :list_milestones
|
21
21
|
|
@@ -32,7 +32,7 @@ module Octokit
|
|
32
32
|
# @example Get a single milestone for a repository
|
33
33
|
# Octokit.milestone("pengwynn/octokit", 1)
|
34
34
|
def milestone(repository, number, options={})
|
35
|
-
get("repos/#{Repository.new(repository)}/milestones/#{number}", options
|
35
|
+
get("repos/#{Repository.new(repository)}/milestones/#{number}", options)
|
36
36
|
end
|
37
37
|
|
38
38
|
# Create a milestone for a repository
|
@@ -48,7 +48,7 @@ module Octokit
|
|
48
48
|
# @example Create a milestone for a repository
|
49
49
|
# Octokit.create_milestone("pengwynn/octokit", "0.7.0", {:description => 'Add support for v3 of Github API'})
|
50
50
|
def create_milestone(repository, title, options={})
|
51
|
-
post("repos/#{Repository.new(repository)}/milestones", options.merge({:title => title})
|
51
|
+
post("repos/#{Repository.new(repository)}/milestones", options.merge({:title => title}))
|
52
52
|
end
|
53
53
|
|
54
54
|
# Update a milestone for a repository
|
@@ -65,7 +65,7 @@ module Octokit
|
|
65
65
|
# @example Update a milestone for a repository
|
66
66
|
# Octokit.update_milestone("pengwynn/octokit", 1, {:description => 'Add support for v3 of Github API'})
|
67
67
|
def update_milestone(repository, number, options={})
|
68
|
-
post("repos/#{Repository.new(repository)}/milestones/#{number}", options
|
68
|
+
post("repos/#{Repository.new(repository)}/milestones/#{number}", options)
|
69
69
|
end
|
70
70
|
alias :edit_milestone :update_milestone
|
71
71
|
|
@@ -74,12 +74,12 @@ module Octokit
|
|
74
74
|
# @param repository [String, Repository, Hash] A GitHub repository.
|
75
75
|
# @param options [Hash] A customizable set of options.
|
76
76
|
# @option options [Integer] :milestone Milestone number.
|
77
|
-
# @return [
|
77
|
+
# @return [Boolean] Success
|
78
78
|
# @see http://developer.github.com/v3/issues/milestones/#delete-a-milestone
|
79
79
|
# @example Delete a single milestone from a repository
|
80
80
|
# Octokit.delete_milestone("pengwynn/octokit", 1)
|
81
81
|
def delete_milestone(repository, number, options={})
|
82
|
-
delete
|
82
|
+
request(:delete, "repos/#{Repository.new(repository)}/milestones/#{number}", options).status == 204
|
83
83
|
end
|
84
84
|
|
85
85
|
end
|
@@ -0,0 +1,222 @@
|
|
1
|
+
module Octokit
|
2
|
+
class Client
|
3
|
+
module Notifications
|
4
|
+
|
5
|
+
# List your notifications
|
6
|
+
#
|
7
|
+
# @param options [Hash] Optional parameters
|
8
|
+
#
|
9
|
+
# @option options [Boolean] :all 'true' to show notifications marked as
|
10
|
+
# read.
|
11
|
+
#
|
12
|
+
# @option options [Boolean] :participating 'true' to show only
|
13
|
+
# notifications in which the user is directly participating or
|
14
|
+
# mentioned.
|
15
|
+
#
|
16
|
+
# @option options [String] :since Time filters out any notifications
|
17
|
+
# updated before the given time. The time should be passed in as UTC in
|
18
|
+
# the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Ex. '2012-10-09T23:39:01Z'
|
19
|
+
#
|
20
|
+
# @return [Array<Hashie::Mash>] Array of notifications.
|
21
|
+
#
|
22
|
+
# @see http://developer.github.com/v3/activity/notifications/#list-your-notifications
|
23
|
+
#
|
24
|
+
# @example Get users notifications
|
25
|
+
# @client.notifications
|
26
|
+
#
|
27
|
+
# @example Get all notifications since a certain time.
|
28
|
+
# @client.notifications({all: true, since: '2012-10-09T23:39:01Z'})
|
29
|
+
def notifications(options={})
|
30
|
+
get("notifications", options)
|
31
|
+
end
|
32
|
+
|
33
|
+
# List your notifications in a repository
|
34
|
+
#
|
35
|
+
# @param repo [String, Hash, Repository] A GitHub repository
|
36
|
+
# @param options [Hash] Optional parameters
|
37
|
+
#
|
38
|
+
# @option options [Boolean] :all 'true' to show notifications marked as
|
39
|
+
# read.
|
40
|
+
#
|
41
|
+
# @option options [Boolean] :participating 'true' to show only
|
42
|
+
# notifications in which the user is directly participating or
|
43
|
+
# mentioned.
|
44
|
+
#
|
45
|
+
# @option options [String] :since Time filters out any notifications
|
46
|
+
# updated before the given time. The time should be passed in as UTC in
|
47
|
+
# the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Ex. '2012-10-09T23:39:01Z'
|
48
|
+
#
|
49
|
+
# @return [Array<Hashie::Mash>] Array of notifications.
|
50
|
+
#
|
51
|
+
# @see http://developer.github.com/v3/activity/notifications/#list-your-notifications-in-a-repository
|
52
|
+
#
|
53
|
+
# @example Get your notifications for pengwynn/octokit
|
54
|
+
# @client.repository_notifications('pengwynn/octokit')
|
55
|
+
#
|
56
|
+
# @example Get your notifications for pengwynn/octokit since a time.
|
57
|
+
# @client.repository_notifications({since: '2012-10-09T23:39:01Z'})
|
58
|
+
def repository_notifications(repo, options={})
|
59
|
+
get("repos/#{Repository.new repo}/notifications", options)
|
60
|
+
end
|
61
|
+
alias :repo_notifications :repository_notifications
|
62
|
+
|
63
|
+
# Mark notifications as read
|
64
|
+
#
|
65
|
+
# @param options [Hash] Optional parameters
|
66
|
+
#
|
67
|
+
# @option options [Boolean] :unread Changes the unread status of the
|
68
|
+
# threads.
|
69
|
+
#
|
70
|
+
# @option options [Boolean] :read Inverse of 'unread'.
|
71
|
+
#
|
72
|
+
# @option options [String] :last_read_at ('Now') Describes the last point
|
73
|
+
# that notifications were checked. Anything updated since this time
|
74
|
+
# will not be updated. The time should be passed in as UTC in the
|
75
|
+
# ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Ex. '2012-10-09T23:39:01Z'
|
76
|
+
#
|
77
|
+
# @return [Boolean] True if marked as read, false otherwise
|
78
|
+
#
|
79
|
+
# @see http://developer.github.com/v3/activity/notifications/#mark-as-read
|
80
|
+
#
|
81
|
+
# @example
|
82
|
+
# @client.mark_notifications_as_read
|
83
|
+
def mark_notifications_as_read(options={})
|
84
|
+
begin
|
85
|
+
request(:put, "notifications", options).status == 205
|
86
|
+
rescue
|
87
|
+
false
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Mark notifications from a specific repository as read
|
92
|
+
#
|
93
|
+
# @param repo [String, Hash, Repository] A GitHub repository
|
94
|
+
# @param options [Hash] Optional parameters
|
95
|
+
#
|
96
|
+
# @option options [Boolean] :unread Changes the unread status of the
|
97
|
+
# threads.
|
98
|
+
#
|
99
|
+
# @option options [Boolean] :read Inverse of 'unread'.
|
100
|
+
#
|
101
|
+
# @option options [String] :last_read_at ('Now') Describes the last point
|
102
|
+
# that notifications were checked. Anything updated since this time
|
103
|
+
# will not be updated. The time should be passed in as UTC in the
|
104
|
+
# ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Ex. '2012-10-09T23:39:01Z'
|
105
|
+
#
|
106
|
+
# @return [Boolean] True if marked as read, false otherwise
|
107
|
+
#
|
108
|
+
# @see http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository
|
109
|
+
#
|
110
|
+
# @example
|
111
|
+
# @client.mark_notifications_as_read("pengwynn/octokit")
|
112
|
+
def mark_repository_notifications_as_read(repo, options={})
|
113
|
+
begin
|
114
|
+
request(:put, "repos/#{Repository.new repo}/notifications", options).status == 205
|
115
|
+
rescue
|
116
|
+
false
|
117
|
+
end
|
118
|
+
end
|
119
|
+
alias :mark_repo_notifications_as_read :mark_repository_notifications_as_read
|
120
|
+
|
121
|
+
# List notifications for a specific thread
|
122
|
+
#
|
123
|
+
# @param thread_id [Integer] Id of the thread.
|
124
|
+
#
|
125
|
+
# @return [Array<Hashie::Mashie>] Array of notifications.
|
126
|
+
#
|
127
|
+
# @see http://developer.github.com/v3/activity/notifications/#view-a-single-thread
|
128
|
+
#
|
129
|
+
# @example
|
130
|
+
# @client.notification_thread(1000)
|
131
|
+
def thread_notifications(thread_id, options={})
|
132
|
+
get("notifications/threads/#{thread_id}", options)
|
133
|
+
end
|
134
|
+
|
135
|
+
# Mark thread as read
|
136
|
+
#
|
137
|
+
# @param thread_id [Integer] Id of the thread to update.
|
138
|
+
# @param options [Hash] Optional parameters.
|
139
|
+
#
|
140
|
+
# @option options [Boolean] :unread Changes the unread status of the
|
141
|
+
# threads.
|
142
|
+
#
|
143
|
+
# @option options [Boolean] :read Inverse of 'unread'.
|
144
|
+
#
|
145
|
+
# @return [Boolean] True if updated, false otherwise.
|
146
|
+
#
|
147
|
+
# @see http://developer.github.com/v3/activity/notifications/#mark-a-thread-as-read
|
148
|
+
#
|
149
|
+
# @example
|
150
|
+
# @client.mark_thread_as_ready(1, :read => false)
|
151
|
+
def mark_thread_as_read(thread_id, options={})
|
152
|
+
begin
|
153
|
+
request(:patch, "notifications/threads/#{thread_id}", options).status == 205
|
154
|
+
rescue
|
155
|
+
false
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# Get thread subscription
|
160
|
+
#
|
161
|
+
# @param thread_id [Integer] Id of the thread.
|
162
|
+
#
|
163
|
+
# @return [Hashie::Mash] Subscription.
|
164
|
+
#
|
165
|
+
# @see http://developer.github.com/v3/activity/notifications/#get-a-thread-subscription
|
166
|
+
#
|
167
|
+
# @example
|
168
|
+
# @client.thread_subscription(1)
|
169
|
+
def thread_subscription(thread_id, options={})
|
170
|
+
get("notifications/threads/#{thread_id}/subscription", options)
|
171
|
+
end
|
172
|
+
|
173
|
+
# Update thread subscription
|
174
|
+
#
|
175
|
+
# This lets you subscribe to a thread, or ignore it. Subscribing to a
|
176
|
+
# thread is unnecessary if the user is already subscribed to the
|
177
|
+
# repository. Ignoring a thread will mute all future notifications (until
|
178
|
+
# you comment or get @mentioned).
|
179
|
+
#
|
180
|
+
# @param thread_id [Integer] Id of the thread.
|
181
|
+
# @param options
|
182
|
+
#
|
183
|
+
# @option options [Boolean] :subscribed Determines if notifications
|
184
|
+
# should be received from this repository.
|
185
|
+
#
|
186
|
+
# @option options [Boolean] :ignored Deterimines if all notifications
|
187
|
+
# should be blocked from this repository.
|
188
|
+
#
|
189
|
+
# @return [Hashie::Mash] Updated subscription.
|
190
|
+
#
|
191
|
+
# @see http://developer.github.com/v3/activity/notifications/#set-a-thread-subscription
|
192
|
+
#
|
193
|
+
# @example Subscribe to notifications
|
194
|
+
# @client.update_thread_subscription(1, :subscribed => true)
|
195
|
+
#
|
196
|
+
# @example Ignore notifications from a repo
|
197
|
+
# @client.update_thread_subscription(1, :ignored => true)
|
198
|
+
def update_thread_subscription(thread_id, options={})
|
199
|
+
put("notifications/threads/#{thread_id}/subscription", options)
|
200
|
+
end
|
201
|
+
|
202
|
+
# Delete a thread subscription
|
203
|
+
#
|
204
|
+
# @param thread_id [Integer] Id of the thread.
|
205
|
+
#
|
206
|
+
# @return [Boolean] True if delete successful, false otherwise.
|
207
|
+
#
|
208
|
+
# @see http://developer.github.com/v3/activity/notifications/#delete-a-thread-subscription
|
209
|
+
#
|
210
|
+
# @example
|
211
|
+
# @client.delete_thread_subscription(1)
|
212
|
+
def delete_thread_subscription(thread_id, options={})
|
213
|
+
begin
|
214
|
+
request(:delete, "notifications/threads/#{thread_id}", options).status == 204
|
215
|
+
rescue
|
216
|
+
false
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
@@ -33,7 +33,7 @@ module Octokit
|
|
33
33
|
# tree.tree.first.path # => "file.rb"
|
34
34
|
def create_tree(repo, tree, options={})
|
35
35
|
parameters = { :tree => tree }
|
36
|
-
post("repos/#{Repository.new(repo)}/git/trees", options.merge(parameters)
|
36
|
+
post("repos/#{Repository.new(repo)}/git/trees", options.merge(parameters))
|
37
37
|
end
|
38
38
|
|
39
39
|
# Get a single blob, fetching its content and encoding
|
@@ -73,7 +73,7 @@ module Octokit
|
|
73
73
|
:content => content,
|
74
74
|
:encoding => encoding
|
75
75
|
}
|
76
|
-
post("repos/#{Repository.new(repo)}/git/blobs", options.merge(parameters)
|
76
|
+
post("repos/#{Repository.new(repo)}/git/blobs", options.merge(parameters)).sha
|
77
77
|
end
|
78
78
|
|
79
79
|
# Get a tag
|
@@ -85,7 +85,7 @@ module Octokit
|
|
85
85
|
# @example Fetch a tag
|
86
86
|
# Octokit.tag('pengwynn/octokit', '23aad20633f4d2981b1c7209a800db3014774e96')
|
87
87
|
def tag(repo, tag_sha, options={})
|
88
|
-
get("repos/#{Repository.new repo}/git/tags/#{tag_sha}", options
|
88
|
+
get("repos/#{Repository.new repo}/git/tags/#{tag_sha}", options)
|
89
89
|
end
|
90
90
|
|
91
91
|
# Create a tag
|
@@ -127,7 +127,7 @@ module Octokit
|
|
127
127
|
:date => tagger_date
|
128
128
|
}
|
129
129
|
)
|
130
|
-
post("repos/#{Repository.new repo}/git/tags", options
|
130
|
+
post("repos/#{Repository.new repo}/git/tags", options)
|
131
131
|
end
|
132
132
|
end
|
133
133
|
end
|
@@ -11,7 +11,7 @@ module Octokit
|
|
11
11
|
# @example
|
12
12
|
# Octokit.org('github')
|
13
13
|
def organization(org, options={})
|
14
|
-
get("orgs/#{org}", options
|
14
|
+
get("orgs/#{org}", options)
|
15
15
|
end
|
16
16
|
alias :org :organization
|
17
17
|
|
@@ -40,7 +40,7 @@ module Octokit
|
|
40
40
|
# @example
|
41
41
|
# @client.update_org('github', {:company => 'Unicorns, Inc.'})
|
42
42
|
def update_organization(org, values, options={})
|
43
|
-
patch("orgs/#{org}", options.merge({:organization => values})
|
43
|
+
patch("orgs/#{org}", options.merge({:organization => values}))
|
44
44
|
end
|
45
45
|
alias :update_org :update_organization
|
46
46
|
|
@@ -73,9 +73,9 @@ module Octokit
|
|
73
73
|
# @client.organizations
|
74
74
|
def organizations(user=nil, options={})
|
75
75
|
if user
|
76
|
-
get("users/#{user}/orgs", options
|
76
|
+
get("users/#{user}/orgs", options)
|
77
77
|
else
|
78
|
-
get("user/orgs", options
|
78
|
+
get("user/orgs", options)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
alias :list_organizations :organizations
|
@@ -103,7 +103,7 @@ module Octokit
|
|
103
103
|
# @example
|
104
104
|
# @client.org_repos('github', {:type => 'private'})
|
105
105
|
def organization_repositories(org, options={})
|
106
|
-
get("orgs/#{org}/repos", options
|
106
|
+
get("orgs/#{org}/repos", options)
|
107
107
|
end
|
108
108
|
alias :org_repositories :organization_repositories
|
109
109
|
alias :org_repos :organization_repositories
|
@@ -125,10 +125,55 @@ module Octokit
|
|
125
125
|
# @example
|
126
126
|
# Octokit.org_members('github')
|
127
127
|
def organization_members(org, options={})
|
128
|
-
get("orgs/#{org}/members", options
|
128
|
+
get("orgs/#{org}/members", options)
|
129
129
|
end
|
130
130
|
alias :org_members :organization_members
|
131
131
|
|
132
|
+
# Check if a user is a member of an organization.
|
133
|
+
#
|
134
|
+
# Use this to check if another user is a member of an organization that
|
135
|
+
# you are a member. If you are not in the organization you are checking,
|
136
|
+
# use .organization_public_member? instead.
|
137
|
+
#
|
138
|
+
# @param org [String] Organization GitHub username.
|
139
|
+
# @param user [String] GitHub username of the user to check.
|
140
|
+
#
|
141
|
+
# @return [Boolean] Is a member?
|
142
|
+
#
|
143
|
+
# @see http://developer.github.com/v3/orgs/members/#check-membership
|
144
|
+
#
|
145
|
+
# @example Check if a user is in your organization
|
146
|
+
# @client.organization_member?('your_organization', 'pengwynn')
|
147
|
+
# => false
|
148
|
+
def organization_member?(org, user, options={})
|
149
|
+
request(:get, "orgs/#{org}/members/#{user}", options).status == 204
|
150
|
+
rescue Octokit::NotFound
|
151
|
+
false
|
152
|
+
end
|
153
|
+
alias :org_member? :organization_member?
|
154
|
+
|
155
|
+
# Check if a user is a public member of an organization.
|
156
|
+
#
|
157
|
+
# If you are checking for membership of a user of an organization that
|
158
|
+
# you are in, use .organization_member? instead.
|
159
|
+
#
|
160
|
+
# @param org [String] Organization GitHub username.
|
161
|
+
# @param user [String] GitHub username of the user to check.
|
162
|
+
#
|
163
|
+
# @return [Boolean] Is a public member?
|
164
|
+
#
|
165
|
+
# @see http://developer.github.com/v3/orgs/members/#check-public-membership
|
166
|
+
#
|
167
|
+
# @example Check if a user is a hubbernaut
|
168
|
+
# @client.organization_public_member?('github', 'pengwynn')
|
169
|
+
# => true
|
170
|
+
def organization_public_member?(org, user, options={})
|
171
|
+
request(:get, "orgs/#{org}/public_members/#{user}", options).status == 204
|
172
|
+
rescue Octokit::NotFound
|
173
|
+
false
|
174
|
+
end
|
175
|
+
alias :org_public_member? :organization_public_member?
|
176
|
+
|
132
177
|
# List teams
|
133
178
|
#
|
134
179
|
# Requires authenticated organization member.
|
@@ -142,7 +187,7 @@ module Octokit
|
|
142
187
|
# @example
|
143
188
|
# @client.org_teams('github')
|
144
189
|
def organization_teams(org, options={})
|
145
|
-
get("orgs/#{org}/teams", options
|
190
|
+
get("orgs/#{org}/teams", options)
|
146
191
|
end
|
147
192
|
alias :org_teams :organization_teams
|
148
193
|
|
@@ -169,7 +214,7 @@ module Octokit
|
|
169
214
|
# :permission => 'push'
|
170
215
|
# })
|
171
216
|
def create_team(org, options={})
|
172
|
-
post("orgs/#{org}/teams", options
|
217
|
+
post("orgs/#{org}/teams", options)
|
173
218
|
end
|
174
219
|
|
175
220
|
# Get team
|
@@ -183,7 +228,7 @@ module Octokit
|
|
183
228
|
# @example
|
184
229
|
# @client.team(100000)
|
185
230
|
def team(team_id, options={})
|
186
|
-
get("teams/#{team_id}", options
|
231
|
+
get("teams/#{team_id}", options)
|
187
232
|
end
|
188
233
|
|
189
234
|
# Update team
|
@@ -206,7 +251,7 @@ module Octokit
|
|
206
251
|
# :permission => 'push'
|
207
252
|
# })
|
208
253
|
def update_team(team_id, options={})
|
209
|
-
patch("teams/#{team_id}", options
|
254
|
+
patch("teams/#{team_id}", options)
|
210
255
|
end
|
211
256
|
|
212
257
|
# Delete team
|
@@ -220,7 +265,7 @@ module Octokit
|
|
220
265
|
# @example
|
221
266
|
# @client.delete_team(100000)
|
222
267
|
def delete_team(team_id, options={})
|
223
|
-
delete
|
268
|
+
request(:delete, "teams/#{team_id}", options).status == 204
|
224
269
|
end
|
225
270
|
|
226
271
|
# List team members
|
@@ -234,7 +279,7 @@ module Octokit
|
|
234
279
|
# @example
|
235
280
|
# @client.team_members(100000)
|
236
281
|
def team_members(team_id, options={})
|
237
|
-
get("teams/#{team_id}/members", options
|
282
|
+
get("teams/#{team_id}/members", options)
|
238
283
|
end
|
239
284
|
|
240
285
|
# Add team member
|
@@ -253,7 +298,7 @@ module Octokit
|
|
253
298
|
# There's a bug in this API call. The docs say to leave the body blank,
|
254
299
|
# but it fails if the body is both blank and the content-length header
|
255
300
|
# is not 0.
|
256
|
-
put
|
301
|
+
request(:put, "teams/#{team_id}/members/#{user}", options.merge({:name => user})).status == 204
|
257
302
|
end
|
258
303
|
|
259
304
|
# Remove team member
|
@@ -269,7 +314,7 @@ module Octokit
|
|
269
314
|
# @example
|
270
315
|
# @client.remove_team_member(100000, 'pengwynn')
|
271
316
|
def remove_team_member(team_id, user, options={})
|
272
|
-
delete
|
317
|
+
request(:delete, "teams/#{team_id}/members/#{user}", options).status == 204
|
273
318
|
end
|
274
319
|
|
275
320
|
# List team repositories
|
@@ -285,7 +330,7 @@ module Octokit
|
|
285
330
|
# @example
|
286
331
|
# @client.team_repos(100000)
|
287
332
|
def team_repositories(team_id, options={})
|
288
|
-
get("teams/#{team_id}/repos", options
|
333
|
+
get("teams/#{team_id}/repos", options)
|
289
334
|
end
|
290
335
|
alias :team_repos :team_repositories
|
291
336
|
|
@@ -306,7 +351,7 @@ module Octokit
|
|
306
351
|
# @example
|
307
352
|
# @client.add_team_repo(100000, 'github/developer.github.com')
|
308
353
|
def add_team_repository(team_id, repo, options={})
|
309
|
-
put
|
354
|
+
request(:put, "teams/#{team_id}/repos/#{Repository.new(repo)}", options.merge(:name => Repository.new(repo))).status == 204
|
310
355
|
end
|
311
356
|
alias :add_team_repo :add_team_repository
|
312
357
|
|
@@ -327,7 +372,7 @@ module Octokit
|
|
327
372
|
# @example
|
328
373
|
# @client.remove_team_repo(100000, 'github/developer.github.com')
|
329
374
|
def remove_team_repository(team_id, repo, options={})
|
330
|
-
delete
|
375
|
+
request(:delete, "teams/#{team_id}/repos/#{Repository.new(repo)}").status == 204
|
331
376
|
end
|
332
377
|
alias :remove_team_repo :remove_team_repository
|
333
378
|
|
@@ -347,7 +392,7 @@ module Octokit
|
|
347
392
|
def remove_organization_member(org, user, options={})
|
348
393
|
# this is a synonym for: for team in org.teams: remove_team_member(team.id, user)
|
349
394
|
# provided in the GH API v3
|
350
|
-
delete
|
395
|
+
request(:delete, "orgs/#{org}/members/#{user}", options).status == 204
|
351
396
|
end
|
352
397
|
alias :remove_org_member :remove_organization_member
|
353
398
|
|
@@ -363,7 +408,7 @@ module Octokit
|
|
363
408
|
# @example
|
364
409
|
# @client.publicize_membership('github', 'pengwynn')
|
365
410
|
def publicize_membership(org, user, options={})
|
366
|
-
put
|
411
|
+
request(:put, "orgs/#{org}/public_members/#{user}", options).status == 204
|
367
412
|
end
|
368
413
|
|
369
414
|
# Conceal a user's membership of an organization.
|
@@ -380,7 +425,7 @@ module Octokit
|
|
380
425
|
# @example
|
381
426
|
# @client.conceal_membership('github', 'pengwynn')
|
382
427
|
def unpublicize_membership(org, user, options={})
|
383
|
-
delete
|
428
|
+
request(:delete, "orgs/#{org}/public_members/#{user}", options).status == 204
|
384
429
|
end
|
385
430
|
alias :conceal_membership :unpublicize_membership
|
386
431
|
|