github_api 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +2 -1
- data/features/README.rdoc +4 -4
- data/features/cassettes/gitignore/get.yml +60 -0
- data/features/cassettes/gitignore/get_raw.yml +224 -0
- data/features/cassettes/gitignore/list.yml +67 -0
- data/features/cassettes/issues/comments/get.yml +71 -0
- data/features/cassettes/issues/comments/list_issue.yml +82 -0
- data/features/cassettes/issues/comments/list_repo.yml +266 -0
- data/features/cassettes/pull_requests/comments/get.yml +159 -0
- data/features/cassettes/pull_requests/comments/list_pull.yml +54 -0
- data/features/cassettes/pull_requests/comments/list_repo.yml +54 -0
- data/features/cassettes/repos/list_repos.yml +129 -0
- data/features/cassettes/users/all.yml +256 -0
- data/features/gitignore.feature +37 -0
- data/features/issues/comments.feature +37 -0
- data/features/pull_requests/comments.feature +27 -0
- data/features/repos.feature +8 -0
- data/features/step_definitions/common_steps.rb +2 -0
- data/features/users.feature +8 -0
- data/lib/github_api.rb +1 -0
- data/lib/github_api/client.rb +5 -0
- data/lib/github_api/git_data/tags.rb +4 -4
- data/lib/github_api/gitignore.rb +56 -0
- data/lib/github_api/issues/comments.rb +23 -9
- data/lib/github_api/pull_requests/comments.rb +24 -6
- data/lib/github_api/repos.rb +14 -1
- data/lib/github_api/repos/keys.rb +4 -4
- data/lib/github_api/users.rb +21 -0
- data/lib/github_api/users/keys.rb +6 -6
- data/lib/github_api/version.rb +1 -1
- data/spec/fixtures/gitignore/template.json +4 -0
- data/spec/fixtures/gitignore/template_raw +1 -0
- data/spec/fixtures/gitignore/templates.json +9 -0
- data/spec/fixtures/users/users.json +9 -0
- data/spec/github/activity/notifications/mark_spec.rb +1 -1
- data/spec/github/activity/starring/starring_spec.rb +2 -2
- data/spec/github/activity/watching/watching_spec.rb +2 -2
- data/spec/github/git_data/commits/create_spec.rb +75 -0
- data/spec/github/git_data/commits/get_spec.rb +50 -0
- data/spec/github/git_data/commits_spec.rb +1 -126
- data/spec/github/git_data/references/create_spec.rb +67 -0
- data/spec/github/git_data/references/delete_spec.rb +38 -0
- data/spec/github/git_data/references/get_spec.rb +54 -0
- data/spec/github/git_data/references/list_spec.rb +77 -0
- data/spec/github/git_data/references/update_spec.rb +62 -0
- data/spec/github/git_data/references_spec.rb +1 -298
- data/spec/github/git_data/tags/create_spec.rb +61 -0
- data/spec/github/git_data/tags/get_spec.rb +48 -0
- data/spec/github/git_data/tags_spec.rb +0 -108
- data/spec/github/git_data/trees/create_spec.rb +62 -0
- data/spec/github/git_data/trees/get_spec.rb +69 -0
- data/spec/github/git_data/trees_spec.rb +0 -133
- data/spec/github/gitignore/get_spec.rb +54 -0
- data/spec/github/gitignore/list_spec.rb +42 -0
- data/spec/github/issues/comments_spec.rb +46 -11
- data/spec/github/pull_requests/comments_spec.rb +46 -11
- data/spec/github/pull_requests_spec.rb +3 -3
- data/spec/github/repos/contents/archive_spec.rb +26 -0
- data/spec/github/repos/contents/get_spec.rb +30 -0
- data/spec/github/repos/contents/readme_spec.rb +30 -0
- data/spec/github/repos/hooks/create_spec.rb +68 -0
- data/spec/github/repos/hooks/delete_spec.rb +40 -0
- data/spec/github/repos/hooks/edit_spec.rb +77 -0
- data/spec/github/repos/hooks/get_spec.rb +49 -0
- data/spec/github/repos/hooks/list_spec.rb +54 -0
- data/spec/github/repos/hooks/test_spec.rb +40 -0
- data/spec/github/repos/hooks_spec.rb +2 -337
- data/spec/github/repos/keys/create_spec.rb +50 -0
- data/spec/github/repos/keys/delete_spec.rb +40 -0
- data/spec/github/repos/keys/edit_spec.rb +40 -0
- data/spec/github/repos/keys/get_spec.rb +43 -0
- data/spec/github/repos/keys/list_spec.rb +52 -0
- data/spec/github/repos/keys_spec.rb +2 -213
- data/spec/github/repos/list_spec.rb +19 -3
- data/spec/github/repos/merging/merge_spec.rb +58 -0
- data/spec/github/repos/pub_sub_hubbub_spec.rb +16 -14
- data/spec/github/repos/statuses/create_spec.rb +54 -0
- data/spec/github/repos/statuses/list_spec.rb +53 -0
- data/spec/github/repos/statuses_spec.rb +1 -114
- data/spec/github/users/emails/add_spec.rb +33 -0
- data/spec/github/users/emails/delete_spec.rb +33 -0
- data/spec/github/users/emails/list_spec.rb +52 -0
- data/spec/github/users/followers/list_spec.rb +68 -0
- data/spec/github/users/followers_spec.rb +0 -70
- data/spec/github/users/get_spec.rb +66 -0
- data/spec/github/users/keys/create_spec.rb +51 -0
- data/spec/github/users/keys/delete_spec.rb +37 -0
- data/spec/github/users/keys/get_spec.rb +50 -0
- data/spec/github/users/keys/list_spec.rb +50 -0
- data/spec/github/users/keys/update_spec.rb +56 -0
- data/spec/github/users/list_spec.rb +45 -0
- data/spec/github/users/update_spec.rb +56 -0
- metadata +96 -43
- data/spec/github/repos/contents_spec.rb +0 -65
- data/spec/github/repos/merging_spec.rb +0 -71
- data/spec/github/repos/starring_spec.rb +0 -4
- data/spec/github/users/emails_spec.rb +0 -110
- data/spec/github/users/keys_spec.rb +0 -256
- data/spec/github/users_spec.rb +0 -128
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Feature: Markdown API
|
|
2
|
+
|
|
3
|
+
Background:
|
|
4
|
+
Given I have "Github::Gitignore" instance
|
|
5
|
+
|
|
6
|
+
Scenario: List available templates
|
|
7
|
+
|
|
8
|
+
Given I want to list resources
|
|
9
|
+
When I make request within a cassette named "gitignore/list"
|
|
10
|
+
Then the response status should be 200
|
|
11
|
+
And the response type should be JSON
|
|
12
|
+
And the response should have 76 items
|
|
13
|
+
And the response should contain Ruby
|
|
14
|
+
And the response should contain Rails
|
|
15
|
+
|
|
16
|
+
Scenario: Get a single template
|
|
17
|
+
|
|
18
|
+
Given I want to get resource with the following params:
|
|
19
|
+
| template_name |
|
|
20
|
+
| Ruby |
|
|
21
|
+
When I make request within a cassette named "gitignore/get"
|
|
22
|
+
Then the response status should be 200
|
|
23
|
+
And the response type should be JSON
|
|
24
|
+
And the response should have 2 items
|
|
25
|
+
|
|
26
|
+
Scenario: Get a raw contents
|
|
27
|
+
|
|
28
|
+
Given I want to get resource with the following params:
|
|
29
|
+
| template_name |
|
|
30
|
+
| Ruby |
|
|
31
|
+
And I pass the following request options:
|
|
32
|
+
| mime |
|
|
33
|
+
| application/vnd.github.raw |
|
|
34
|
+
When I make request within a cassette named "gitignore/get_raw"
|
|
35
|
+
Then the response status should be 200
|
|
36
|
+
And the response type should be RAW
|
|
37
|
+
And the response should contain InstalledFiles
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Feature: Issues Comments API
|
|
2
|
+
|
|
3
|
+
Background:
|
|
4
|
+
Given I have "Github::Issues::Comments" instance
|
|
5
|
+
|
|
6
|
+
Scenario: List in a repository
|
|
7
|
+
|
|
8
|
+
Given I want to list resources with the following params:
|
|
9
|
+
| user | repo |
|
|
10
|
+
| peter-murach | github |
|
|
11
|
+
When I make request within a cassette named "issues/comments/list_repo"
|
|
12
|
+
Then the response status should be 200
|
|
13
|
+
And the response type should be JSON
|
|
14
|
+
And the response should not be empty
|
|
15
|
+
|
|
16
|
+
Scenario: List on an issue
|
|
17
|
+
|
|
18
|
+
Given I want to list resources with the following params:
|
|
19
|
+
| user | repo |
|
|
20
|
+
| peter-murach | github |
|
|
21
|
+
And I pass the following request options:
|
|
22
|
+
| issue_id |
|
|
23
|
+
| 61 |
|
|
24
|
+
When I make request within a cassette named "issues/comments/list_issue"
|
|
25
|
+
Then the response status should be 200
|
|
26
|
+
And the response type should be JSON
|
|
27
|
+
And the response should not be empty
|
|
28
|
+
|
|
29
|
+
Scenario: Get a single comment
|
|
30
|
+
|
|
31
|
+
Given I want to get resource with the following params:
|
|
32
|
+
| user | repo | comment_id |
|
|
33
|
+
| peter-murach | github | 10321836 |
|
|
34
|
+
When I make request within a cassette named "issues/comments/get"
|
|
35
|
+
Then the response status should be 200
|
|
36
|
+
And the response type should be JSON
|
|
37
|
+
And the response should not be empty
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Feature: Pull Requests Comments API
|
|
2
|
+
|
|
3
|
+
Background:
|
|
4
|
+
Given I have "Github::PullRequests::Comments" instance
|
|
5
|
+
|
|
6
|
+
Scenario: List in a repository
|
|
7
|
+
|
|
8
|
+
Given I want to list resources with the following params:
|
|
9
|
+
| user | repo |
|
|
10
|
+
| peter-murach | github |
|
|
11
|
+
When I make request within a cassette named "pull_requests/comments/list_repo"
|
|
12
|
+
Then the response status should be 200
|
|
13
|
+
And the response type should be JSON
|
|
14
|
+
And the response should have 0 items
|
|
15
|
+
|
|
16
|
+
Scenario: List on a pull request
|
|
17
|
+
|
|
18
|
+
Given I want to list resources with the following params:
|
|
19
|
+
| user | repo |
|
|
20
|
+
| peter-murach | github |
|
|
21
|
+
And I pass the following request options:
|
|
22
|
+
| request_id |
|
|
23
|
+
| 62 |
|
|
24
|
+
When I make request within a cassette named "pull_requests/comments/list_pull"
|
|
25
|
+
Then the response status should be 200
|
|
26
|
+
And the response type should be JSON
|
|
27
|
+
And the response should have 0 items
|
data/features/repos.feature
CHANGED
|
@@ -44,6 +44,14 @@ Feature: Repositories API
|
|
|
44
44
|
And the response type should be JSON
|
|
45
45
|
And the response should not be empty
|
|
46
46
|
|
|
47
|
+
Scenario: All repositories
|
|
48
|
+
|
|
49
|
+
Given I want to list resources
|
|
50
|
+
When I make request within a cassette named "repos/list_repos"
|
|
51
|
+
Then the response status should be 200
|
|
52
|
+
And the response type should be JSON
|
|
53
|
+
And the response should not be empty
|
|
54
|
+
|
|
47
55
|
Scenario: Get a repository
|
|
48
56
|
|
|
49
57
|
Given I want to get resource with the following params:
|
data/features/users.feature
CHANGED
|
@@ -3,6 +3,14 @@ Feature: Users API
|
|
|
3
3
|
Background:
|
|
4
4
|
Given I have "Github::Users" instance
|
|
5
5
|
|
|
6
|
+
Scenario: List all users
|
|
7
|
+
|
|
8
|
+
Given I want to list resources
|
|
9
|
+
When I make request within a cassette named "users/all"
|
|
10
|
+
Then the response status should be 200
|
|
11
|
+
And the response type should be JSON
|
|
12
|
+
And the response should not be empty
|
|
13
|
+
|
|
6
14
|
Scenario: Get authenticated user
|
|
7
15
|
|
|
8
16
|
Given I want to get resource
|
data/lib/github_api.rb
CHANGED
data/lib/github_api/client.rb
CHANGED
|
@@ -18,6 +18,11 @@ module Github
|
|
|
18
18
|
@gists ||= ApiFactory.new 'Gists', options
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
def gitignore(options = {})
|
|
22
|
+
@gitignore ||= ApiFactory.new 'Gitignore', options
|
|
23
|
+
end
|
|
24
|
+
alias :git_ignore :gitignore
|
|
25
|
+
|
|
21
26
|
# The Git Database API gives you access to read and write raw Git objects
|
|
22
27
|
# to your Git database on GitHub and to list and update your references
|
|
23
28
|
# (branch heads and tags).
|
|
@@ -60,12 +60,12 @@ module Github
|
|
|
60
60
|
# = Examples
|
|
61
61
|
# github = Github.new
|
|
62
62
|
# github.git_data.tags.create 'user-name', 'repo-name',
|
|
63
|
-
# "tag" =>
|
|
63
|
+
# "tag" => "v0.0.1",
|
|
64
64
|
# "message" => "initial version\n",
|
|
65
|
-
# "type"
|
|
66
|
-
# "object"
|
|
65
|
+
# "type" => "commit",
|
|
66
|
+
# "object" => "c3d0be41ecbe669545ee3e94d31ed9a4bc91ee3c",
|
|
67
67
|
# "tagger" => {
|
|
68
|
-
# "name" =>
|
|
68
|
+
# "name" => "Scott Chacon",
|
|
69
69
|
# "email" => "schacon@gmail.com",
|
|
70
70
|
# "date" => "2011-06-17T14:53:3"
|
|
71
71
|
# }
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
module Github
|
|
4
|
+
|
|
5
|
+
# When you create a new GitHub repository via the API, you can specify a
|
|
6
|
+
# .gitignore template to apply to the repository upon creation.
|
|
7
|
+
class Gitignore < API
|
|
8
|
+
|
|
9
|
+
# Creates new Gitignore API
|
|
10
|
+
def initialize(options = {})
|
|
11
|
+
super(options)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# List all templates available to pass as an option when creating a repository.
|
|
15
|
+
#
|
|
16
|
+
# = Examples
|
|
17
|
+
# github = Github.new
|
|
18
|
+
# github.gitignore.list
|
|
19
|
+
# github.gitignore.list { |template| ... }
|
|
20
|
+
#
|
|
21
|
+
def list(*args)
|
|
22
|
+
params = args.extract_options!
|
|
23
|
+
normalize! params
|
|
24
|
+
|
|
25
|
+
response = get_request("/gitignore/templates", params)
|
|
26
|
+
return response unless block_given?
|
|
27
|
+
response.each { |el| yield el }
|
|
28
|
+
end
|
|
29
|
+
alias :all :list
|
|
30
|
+
|
|
31
|
+
# Get a single template
|
|
32
|
+
#
|
|
33
|
+
# = Examples
|
|
34
|
+
# github = Github.new
|
|
35
|
+
# github.gitignore.get "template-name"
|
|
36
|
+
#
|
|
37
|
+
# Use the raw media type to get the raw contents.
|
|
38
|
+
#
|
|
39
|
+
# = Examples
|
|
40
|
+
# github = Github.new
|
|
41
|
+
# github.gitignore.get "template-name", mime: 'applicatin/vnd.github.raw'
|
|
42
|
+
#
|
|
43
|
+
def get(name, params={})
|
|
44
|
+
normalize! params
|
|
45
|
+
assert_presence_of name
|
|
46
|
+
|
|
47
|
+
if (mime_type = params.delete('mime'))
|
|
48
|
+
options = { :raw => true, :headers => {'Accept' => mime_type} }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
get_request("/gitignore/templates/#{name}", params, options || {})
|
|
52
|
+
end
|
|
53
|
+
alias :find :get
|
|
54
|
+
|
|
55
|
+
end # Gitignore
|
|
56
|
+
end # Github
|
|
@@ -18,17 +18,33 @@ module Github
|
|
|
18
18
|
#
|
|
19
19
|
# = Examples
|
|
20
20
|
# github = Github.new
|
|
21
|
-
# github.issues.comments.all 'user-name', 'repo-name', '
|
|
22
|
-
# github.issues.comments.all 'user-name', 'repo-name', '
|
|
21
|
+
# github.issues.comments.all 'user-name', 'repo-name', issue_id: 'id'
|
|
22
|
+
# github.issues.comments.all 'user-name', 'repo-name', issue_id: 'id' {|com| .. }
|
|
23
23
|
#
|
|
24
|
-
|
|
24
|
+
# List comments in a repository
|
|
25
|
+
#
|
|
26
|
+
# = Parameters
|
|
27
|
+
# * <tt>:sort</tt> - Optional string, <tt>created</tt> or <tt>updated</tt>
|
|
28
|
+
# * <tt>:direction</tt> - Optional string, <tt>asc</tt> or <tt>desc</tt>.
|
|
29
|
+
# Ignored with sort parameter.
|
|
30
|
+
# * <tt>:since</tt> - Optional string of a timestamp in ISO 8601
|
|
31
|
+
# format: YYYY-MM-DDTHH:MM:SSZ
|
|
32
|
+
#
|
|
33
|
+
# = Examples
|
|
34
|
+
# github = Github.new
|
|
35
|
+
# github.issues.comments.all 'user-name', 'repo-name'
|
|
36
|
+
# github.issues.comments.all 'user-name', 'repo-name' {|com| .. }
|
|
37
|
+
#
|
|
38
|
+
def list(user_name, repo_name, params={})
|
|
25
39
|
set :user => user_name, :repo => repo_name
|
|
26
|
-
assert_presence_of user, repo
|
|
27
|
-
|
|
40
|
+
assert_presence_of user, repo
|
|
28
41
|
normalize! params
|
|
29
|
-
# _merge_mime_type(:issue_comment, params)
|
|
30
42
|
|
|
31
|
-
response =
|
|
43
|
+
response = if (issue_id = params.delete('issue_id'))
|
|
44
|
+
get_request("/repos/#{user}/#{repo}/issues/#{issue_id}/comments", params)
|
|
45
|
+
else
|
|
46
|
+
get_request("/repos/#{user}/#{repo}/issues/comments", params)
|
|
47
|
+
end
|
|
32
48
|
return response unless block_given?
|
|
33
49
|
response.each { |el| yield el }
|
|
34
50
|
end
|
|
@@ -43,9 +59,7 @@ module Github
|
|
|
43
59
|
def get(user_name, repo_name, comment_id, params={})
|
|
44
60
|
set :user => user_name, :repo => repo_name
|
|
45
61
|
assert_presence_of user, repo, comment_id
|
|
46
|
-
|
|
47
62
|
normalize! params
|
|
48
|
-
# _merge_mime_type(:issue_comment, params)
|
|
49
63
|
|
|
50
64
|
get_request("/repos/#{user}/#{repo}/issues/comments/#{comment_id}", params)
|
|
51
65
|
end
|
|
@@ -17,16 +17,34 @@ module Github
|
|
|
17
17
|
#
|
|
18
18
|
# = Examples
|
|
19
19
|
# github = Github.new
|
|
20
|
-
# github.pull_requests.comments.list 'user-name', 'repo-name', '
|
|
20
|
+
# github.pull_requests.comments.list 'user-name', 'repo-name', request_id: 'id'
|
|
21
21
|
#
|
|
22
|
-
|
|
22
|
+
# List comments in a repository
|
|
23
|
+
#
|
|
24
|
+
# By default, Review Comments are ordered by ascending ID.
|
|
25
|
+
#
|
|
26
|
+
# = Parameters
|
|
27
|
+
#
|
|
28
|
+
# * <tt>:sort</tt> - Optional string, <tt>created</tt> or <tt>updated</tt>
|
|
29
|
+
# * <tt>:direction</tt> - Optional string, <tt>asc</tt> or <tt>desc</tt>.
|
|
30
|
+
# Ignored with sort parameter.
|
|
31
|
+
# * <tt>:since</tt> - Optional string of a timestamp in ISO 8601
|
|
32
|
+
# format: YYYY-MM-DDTHH:MM:SSZ
|
|
33
|
+
# = Examples
|
|
34
|
+
# github = Github.new
|
|
35
|
+
# github.pull_requests.comments.list 'user-name', 'repo-name'
|
|
36
|
+
# github.pull_requests.comments.list 'user-name', 'repo-name' { |comm| ... }
|
|
37
|
+
#
|
|
38
|
+
def list(user_name, repo_name, params={})
|
|
23
39
|
set :user => user_name, :repo => repo_name
|
|
24
|
-
assert_presence_of user, repo
|
|
25
|
-
|
|
40
|
+
assert_presence_of user, repo
|
|
26
41
|
normalize! params
|
|
27
|
-
# _merge_mime_type(:pull_comment, params)
|
|
28
42
|
|
|
29
|
-
response =
|
|
43
|
+
response = if (request_id = params.delete('request_id'))
|
|
44
|
+
get_request("/repos/#{user}/#{repo}/pulls/#{request_id}/comments", params)
|
|
45
|
+
else
|
|
46
|
+
get_request("/repos/#{user}/#{repo}/pulls/comments", params)
|
|
47
|
+
end
|
|
30
48
|
return response unless block_given?
|
|
31
49
|
response.each { |el| yield el }
|
|
32
50
|
end
|
data/lib/github_api/repos.rb
CHANGED
|
@@ -294,6 +294,17 @@ module Github
|
|
|
294
294
|
# github.repos.list
|
|
295
295
|
# github.repos.list { |repo| ... }
|
|
296
296
|
#
|
|
297
|
+
# List all repositories
|
|
298
|
+
#
|
|
299
|
+
# This provides a dump of every repository, in the order that they were created.
|
|
300
|
+
# = Parameters
|
|
301
|
+
# * <tt>:since</tt> - the integer ID of the last Repository that you've seen.
|
|
302
|
+
#
|
|
303
|
+
# = Examples
|
|
304
|
+
# github = Github.new
|
|
305
|
+
# github.repos.list
|
|
306
|
+
# github.repos.list { |repo| ... }
|
|
307
|
+
#
|
|
297
308
|
# List public repositories for the specified user.
|
|
298
309
|
#
|
|
299
310
|
# = Examples
|
|
@@ -317,9 +328,11 @@ module Github
|
|
|
317
328
|
get_request("/users/#{user_name}/repos", params)
|
|
318
329
|
elsif (org_name = params.delete("org"))
|
|
319
330
|
get_request("/orgs/#{org_name}/repos", params)
|
|
320
|
-
|
|
331
|
+
elsif authenticated?
|
|
321
332
|
# For authenticated user
|
|
322
333
|
get_request("/user/repos", params)
|
|
334
|
+
else
|
|
335
|
+
get_request("/repositories", params)
|
|
323
336
|
end
|
|
324
337
|
return response unless block_given?
|
|
325
338
|
response.each { |el| yield el }
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Github
|
|
4
4
|
class Repos::Keys < API
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
VALID_KEY_OPTIONS = %w[ title key ].freeze
|
|
7
7
|
|
|
8
8
|
# List deploy keys
|
|
9
9
|
#
|
|
@@ -54,8 +54,8 @@ module Github
|
|
|
54
54
|
set :user => user_name, :repo => repo_name
|
|
55
55
|
assert_presence_of user, repo
|
|
56
56
|
normalize! params
|
|
57
|
-
filter!
|
|
58
|
-
assert_required_keys(
|
|
57
|
+
filter! VALID_KEY_OPTIONS, params
|
|
58
|
+
assert_required_keys(VALID_KEY_OPTIONS, params)
|
|
59
59
|
|
|
60
60
|
post_request("/repos/#{user}/#{repo}/keys", params)
|
|
61
61
|
end
|
|
@@ -77,7 +77,7 @@ module Github
|
|
|
77
77
|
assert_presence_of user, repo, key_id
|
|
78
78
|
|
|
79
79
|
normalize! params
|
|
80
|
-
filter!
|
|
80
|
+
filter! VALID_KEY_OPTIONS, params
|
|
81
81
|
|
|
82
82
|
patch_request("/repos/#{user}/#{repo}/keys/#{key_id}", params)
|
|
83
83
|
end
|
data/lib/github_api/users.rb
CHANGED
|
@@ -40,6 +40,27 @@ module Github
|
|
|
40
40
|
@keys ||= ApiFactory.new 'Users::Keys'
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
# List all users.
|
|
44
|
+
#
|
|
45
|
+
# This provides a dump of every user, in the order that they signed up
|
|
46
|
+
# for GitHub.
|
|
47
|
+
#
|
|
48
|
+
# = Parameters
|
|
49
|
+
# * <tt>:since</tt> - The integer ID of the last User that you’ve seen.
|
|
50
|
+
#
|
|
51
|
+
# = Examples
|
|
52
|
+
# users = Github::Users.new
|
|
53
|
+
# users.list
|
|
54
|
+
#
|
|
55
|
+
def list(params={})
|
|
56
|
+
normalize! params
|
|
57
|
+
|
|
58
|
+
response = get_request("/users", params)
|
|
59
|
+
return response unless block_given?
|
|
60
|
+
response.each { |el| yield el }
|
|
61
|
+
end
|
|
62
|
+
alias :all :list
|
|
63
|
+
|
|
43
64
|
# Get a single unauthenticated user
|
|
44
65
|
#
|
|
45
66
|
# = Examples
|
|
@@ -9,8 +9,8 @@ module Github
|
|
|
9
9
|
#
|
|
10
10
|
# = Examples
|
|
11
11
|
# github = Github.new :oauth_token => '...'
|
|
12
|
-
# github.users.
|
|
13
|
-
# github.users.
|
|
12
|
+
# github.users.keys.list
|
|
13
|
+
# github.users.keys.list { |key| ... }
|
|
14
14
|
#
|
|
15
15
|
def list(params={})
|
|
16
16
|
normalize! params
|
|
@@ -24,7 +24,7 @@ module Github
|
|
|
24
24
|
#
|
|
25
25
|
# = Examples
|
|
26
26
|
# github = Github.new :oauth_token => '...'
|
|
27
|
-
# github.users.
|
|
27
|
+
# github.users.keys.get 'key-id'
|
|
28
28
|
#
|
|
29
29
|
def get(key_id, params={})
|
|
30
30
|
assert_presence_of key_id
|
|
@@ -41,7 +41,7 @@ module Github
|
|
|
41
41
|
#
|
|
42
42
|
# = Examples
|
|
43
43
|
# github = Github.new :oauth_token => '...'
|
|
44
|
-
# github.users.
|
|
44
|
+
# github.users.keys.create "title" => "octocat@octomac",
|
|
45
45
|
# "key" => "ssh-rsa AAA..."
|
|
46
46
|
#
|
|
47
47
|
def create(params={})
|
|
@@ -58,7 +58,7 @@ module Github
|
|
|
58
58
|
#
|
|
59
59
|
# = Examples
|
|
60
60
|
# github = Github.new :oauth_token => '...'
|
|
61
|
-
# github.users.
|
|
61
|
+
# github.users.keys.update 'key-id', "title" => "octocat@octomac",
|
|
62
62
|
# "key" => "ssh-rsa AAA..."
|
|
63
63
|
#
|
|
64
64
|
def update(key_id, params={})
|
|
@@ -72,7 +72,7 @@ module Github
|
|
|
72
72
|
#
|
|
73
73
|
# = Examples
|
|
74
74
|
# github = Github.new :oauth_token => '...'
|
|
75
|
-
# github.users.
|
|
75
|
+
# github.users.keys.delete 'key-id'
|
|
76
76
|
#
|
|
77
77
|
def delete(key_id, params={})
|
|
78
78
|
assert_presence_of key_id
|