github_api 0.4.11 → 0.5.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +76 -72
- data/features/cassettes/gists/starred.yml +48 -0
- data/features/cassettes/pagination/repos/commits/list.yml +193 -0
- data/features/cassettes/pagination/repos/commits/next.yml +183 -0
- data/features/cassettes/pagination/repos/diff/next.yml +45 -0
- data/features/cassettes/pagination/repos/list.yml +176 -0
- data/features/cassettes/pagination/repos/list/next.yml +222 -0
- data/features/cassettes/pagination/repos/per_page/each_page.yml +45 -0
- data/features/cassettes/repos/list.yml +92 -0
- data/features/error_codes.feature +1 -1
- data/features/gists.feature +12 -3
- data/features/gists/comments.feature +3 -3
- data/features/github_api.feature +13 -2
- data/features/pagination.feature +40 -39
- data/features/repos.feature +2 -2
- data/features/step_definitions/common_steps.rb +12 -0
- data/features/step_definitions/github_api_steps.rb +12 -1
- data/lib/github_api.rb +1 -1
- data/lib/github_api/api.rb +4 -2
- data/lib/github_api/api_factory.rb +11 -5
- data/lib/github_api/authorizations.rb +23 -32
- data/lib/github_api/client.rb +1 -0
- data/lib/github_api/events.rb +38 -38
- data/lib/github_api/filter.rb +1 -1
- data/lib/github_api/gists.rb +47 -42
- data/lib/github_api/gists/comments.rb +77 -84
- data/lib/github_api/git_data.rb +25 -6
- data/lib/github_api/git_data/blobs.rb +48 -45
- data/lib/github_api/git_data/commits.rb +76 -73
- data/lib/github_api/git_data/references.rb +137 -118
- data/lib/github_api/git_data/tags.rb +74 -70
- data/lib/github_api/git_data/trees.rb +88 -85
- data/lib/github_api/issues.rb +43 -31
- data/lib/github_api/issues/comments.rb +116 -119
- data/lib/github_api/issues/events.rb +20 -19
- data/lib/github_api/issues/labels.rb +200 -197
- data/lib/github_api/issues/milestones.rb +137 -134
- data/lib/github_api/orgs.rb +27 -23
- data/lib/github_api/orgs/members.rb +105 -108
- data/lib/github_api/orgs/teams.rb +236 -237
- data/lib/github_api/paged_request.rb +1 -1
- data/lib/github_api/pull_requests.rb +40 -42
- data/lib/github_api/pull_requests/comments.rb +140 -143
- data/lib/github_api/repos.rb +101 -67
- data/lib/github_api/repos/collaborators.rb +64 -68
- data/lib/github_api/repos/commits.rb +50 -39
- data/lib/github_api/repos/downloads.rb +107 -110
- data/lib/github_api/repos/forks.rb +38 -39
- data/lib/github_api/repos/hooks.rb +161 -167
- data/lib/github_api/repos/keys.rb +86 -86
- data/lib/github_api/repos/pub_sub_hubbub.rb +99 -87
- data/lib/github_api/repos/watching.rb +80 -82
- data/lib/github_api/request.rb +5 -9
- data/lib/github_api/users.rb +26 -16
- data/lib/github_api/users/emails.rb +47 -47
- data/lib/github_api/users/followers.rb +85 -86
- data/lib/github_api/users/keys.rb +73 -75
- data/lib/github_api/validations.rb +25 -0
- data/lib/github_api/validations/format.rb +23 -0
- data/lib/github_api/validations/presence.rb +25 -0
- data/lib/github_api/validations/required.rb +21 -0
- data/lib/github_api/validations/token.rb +41 -0
- data/lib/github_api/version.rb +3 -3
- data/spec/fixtures/repos/commit_comparison.json +112 -0
- data/spec/github/api_factory_spec.rb +17 -1
- data/spec/github/authorizations_spec.rb +36 -34
- data/spec/github/gists/comments_spec.rb +39 -45
- data/spec/github/gists_spec.rb +50 -53
- data/spec/github/git_data/blobs_spec.rb +27 -20
- data/spec/github/git_data/commits_spec.rb +20 -19
- data/spec/github/git_data/references_spec.rb +83 -46
- data/spec/github/git_data/tags_spec.rb +16 -15
- data/spec/github/git_data/trees_spec.rb +20 -19
- data/spec/github/git_data_spec.rb +10 -1
- data/spec/github/issues/comments_spec.rb +78 -68
- data/spec/github/issues/events_spec.rb +42 -34
- data/spec/github/issues/labels_spec.rb +89 -101
- data/spec/github/issues/milestones_spec.rb +76 -54
- data/spec/github/issues_spec.rb +53 -57
- data/spec/github/orgs/members_spec.rb +64 -49
- data/spec/github/orgs/teams_spec.rb +112 -101
- data/spec/github/orgs_spec.rb +41 -31
- data/spec/github/paged_request_spec.rb +6 -5
- data/spec/github/pull_requests/comments_spec.rb +39 -44
- data/spec/github/pull_requests_spec.rb +32 -48
- data/spec/github/repos/collaborators_spec.rb +40 -29
- data/spec/github/repos/commits_spec.rb +108 -64
- data/spec/github/repos/downloads_spec.rb +46 -45
- data/spec/github/repos/forks_spec.rb +23 -24
- data/spec/github/repos/hooks_spec.rb +69 -71
- data/spec/github/repos/keys_spec.rb +39 -34
- data/spec/github/repos/pub_sub_hubbub_spec.rb +4 -4
- data/spec/github/repos/watching_spec.rb +31 -33
- data/spec/github/repos_spec.rb +74 -83
- data/spec/github/request_spec.rb +31 -2
- data/spec/github/users/emails_spec.rb +19 -17
- data/spec/github/users/followers_spec.rb +30 -28
- data/spec/github/users/keys_spec.rb +37 -33
- data/spec/github/users_spec.rb +124 -125
- data/spec/github/validations/format_spec.rb +42 -0
- data/spec/github/validations/presence_spec.rb +18 -0
- data/spec/github/validations/required_spec.rb +28 -0
- data/spec/github/validations/token_spec.rb +19 -0
- data/spec/github/validations_spec.rb +23 -0
- metadata +33 -10
- data/features/cassettes/pagination/repos.yml +0 -177
- data/features/cassettes/pagination/repos/next.yml +0 -177
- data/lib/github_api/validation.rb +0 -53
- data/spec/github/validation_spec.rb +0 -62
@@ -1,8 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Github
|
4
|
-
class Repos
|
5
|
-
module Commits
|
4
|
+
class Repos::Commits < API
|
6
5
|
|
7
6
|
REQUIRED_COMMENT_PARAMS = %w[
|
8
7
|
body
|
@@ -12,6 +11,23 @@ module Github
|
|
12
11
|
position
|
13
12
|
].freeze
|
14
13
|
|
14
|
+
# Compares two commits
|
15
|
+
#
|
16
|
+
# = Examples
|
17
|
+
# github = Github.new
|
18
|
+
# github.repos.commits.compare
|
19
|
+
# 'user-name',
|
20
|
+
# 'repo-name',
|
21
|
+
# 'v0.4.8',
|
22
|
+
# 'master'
|
23
|
+
#
|
24
|
+
def compare(user_name, repo_name, base, head, params={})
|
25
|
+
_validate_presence_of base, head
|
26
|
+
_normalize_params_keys(params)
|
27
|
+
|
28
|
+
get_request("/repos/#{user_name}/#{repo_name}/compare/#{base}...#{head}", params)
|
29
|
+
end
|
30
|
+
|
15
31
|
# Creates a commit comment
|
16
32
|
#
|
17
33
|
# = Inputs
|
@@ -22,8 +38,8 @@ module Github
|
|
22
38
|
# * <tt>:position</tt> - Required number - Line index in the diff to comment on.
|
23
39
|
#
|
24
40
|
# = Examples
|
25
|
-
#
|
26
|
-
#
|
41
|
+
# github = Github.new
|
42
|
+
# github.repos.commits.create_comment 'user-name', 'repo-name', 'sha-key',
|
27
43
|
# "body" => "Nice change",
|
28
44
|
# "commit_id" => "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
29
45
|
# "line" => 1,
|
@@ -40,15 +56,14 @@ module Github
|
|
40
56
|
|
41
57
|
_validate_inputs(REQUIRED_COMMENT_PARAMS, params)
|
42
58
|
|
43
|
-
|
59
|
+
post_request("/repos/#{user}/#{repo}/commits/#{sha}/comments", params)
|
44
60
|
end
|
45
|
-
alias :create_commit_comment :create_comment
|
46
61
|
|
47
62
|
# Deletes a commit comment
|
48
63
|
#
|
49
64
|
# = Examples
|
50
|
-
#
|
51
|
-
#
|
65
|
+
# github = Github.new
|
66
|
+
# github.repos.commits.delete_comment 'user-name', 'repo-name', 'comment-id'
|
52
67
|
#
|
53
68
|
def delete_comment(user_name, repo_name, comment_id, params={})
|
54
69
|
_update_user_repo_params(user_name, repo_name)
|
@@ -56,9 +71,8 @@ module Github
|
|
56
71
|
_validate_presence_of comment_id
|
57
72
|
_normalize_params_keys(params)
|
58
73
|
|
59
|
-
|
74
|
+
delete_request("/repos/#{user}/#{repo}/comments/#{comment_id}", params)
|
60
75
|
end
|
61
|
-
alias :delete_commit_comment :delete_comment
|
62
76
|
|
63
77
|
# List commits on a repository
|
64
78
|
#
|
@@ -67,37 +81,35 @@ module Github
|
|
67
81
|
# * <tt>:path</tt> Optional string. Only commits containing this file path will be returned
|
68
82
|
#
|
69
83
|
# = Examples
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
84
|
+
# github = Github.new
|
85
|
+
# github.repos.commits.list 'user-name', 'repo-name', :sha => '...'
|
86
|
+
# github.repos.commits.list 'user-name', 'repo-name', :sha => '...' { |commit| ... }
|
73
87
|
#
|
74
|
-
def
|
88
|
+
def list(user_name, repo_name, params={})
|
75
89
|
_update_user_repo_params(user_name, repo_name)
|
76
90
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
77
91
|
_normalize_params_keys(params)
|
78
92
|
_filter_params_keys(%w[ sha path], params)
|
79
93
|
|
80
|
-
response =
|
94
|
+
response = get_request("/repos/#{user}/#{repo}/commits", params)
|
81
95
|
return response unless block_given?
|
82
96
|
response.each { |el| yield el }
|
83
97
|
end
|
84
|
-
alias :
|
85
|
-
alias :list_repo_commits :commits
|
86
|
-
alias :list_repository_commits :commits
|
98
|
+
alias :all :list
|
87
99
|
|
88
100
|
# List commit comments for a repository
|
89
101
|
#
|
90
102
|
# = Examples
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
103
|
+
# github = Github.new
|
104
|
+
# github.repos.commits.repo_comments 'user-name', 'repo-name'
|
105
|
+
# github.repos.commits.repo_comments 'user-name', 'repo-name' { |com| ... }
|
94
106
|
#
|
95
|
-
def repo_comments(user_name
|
107
|
+
def repo_comments(user_name, repo_name, params={})
|
96
108
|
_update_user_repo_params(user_name, repo_name)
|
97
109
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
98
110
|
_normalize_params_keys(params)
|
99
111
|
|
100
|
-
response =
|
112
|
+
response = get_request("/repos/#{user}/#{repo}/comments", params)
|
101
113
|
return response unless block_given?
|
102
114
|
response.each { |el| yield el }
|
103
115
|
end
|
@@ -107,8 +119,8 @@ module Github
|
|
107
119
|
# List comments for a single commit
|
108
120
|
#
|
109
121
|
# = Examples
|
110
|
-
#
|
111
|
-
#
|
122
|
+
# github = Github.new
|
123
|
+
# github.repos.commits.commit_comments 'user-name', 'repo-name', '6dcb09b5b57875f334f61aebed695e2e4193db5e'
|
112
124
|
#
|
113
125
|
def commit_comments(user_name, repo_name, sha, params={})
|
114
126
|
_update_user_repo_params(user_name, repo_name)
|
@@ -116,7 +128,7 @@ module Github
|
|
116
128
|
_validate_presence_of sha
|
117
129
|
_normalize_params_keys(params)
|
118
130
|
|
119
|
-
response =
|
131
|
+
response = get_request("/repos/#{user}/#{repo}/commits/#{sha}/comments", params)
|
120
132
|
return response unless block_given?
|
121
133
|
response.each { |el| yield el }
|
122
134
|
end
|
@@ -126,23 +138,23 @@ module Github
|
|
126
138
|
#
|
127
139
|
# = Examples
|
128
140
|
# @github = Github.new
|
129
|
-
# @github.repos.
|
141
|
+
# @github.repos.commits.get 'user-name', 'repo-name', '6dcb09b5b57875f334f61aebed6')
|
130
142
|
#
|
131
|
-
def
|
143
|
+
def get(user_name, repo_name, sha, params={})
|
132
144
|
_update_user_repo_params(user_name, repo_name)
|
133
145
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
134
146
|
_validate_presence_of sha
|
135
147
|
_normalize_params_keys(params)
|
136
148
|
|
137
|
-
|
149
|
+
get_request("/repos/#{user}/#{repo}/commits/#{sha}", params)
|
138
150
|
end
|
139
|
-
alias :
|
151
|
+
alias :find :get
|
140
152
|
|
141
153
|
# Gets a single commit comment
|
142
154
|
#
|
143
155
|
# = Examples
|
144
|
-
#
|
145
|
-
#
|
156
|
+
# github = Github.new
|
157
|
+
# github.repos.commits.commit_comment 'user-name', 'repo-name', 'comment-id'
|
146
158
|
#
|
147
159
|
def commit_comment(user_name, repo_name, comment_id, params={})
|
148
160
|
_update_user_repo_params(user_name, repo_name)
|
@@ -150,7 +162,7 @@ module Github
|
|
150
162
|
_validate_presence_of comment_id
|
151
163
|
_normalize_params_keys(params)
|
152
164
|
|
153
|
-
|
165
|
+
get_request("/repos/#{user}/#{repo}/comments/#{comment_id}", params)
|
154
166
|
end
|
155
167
|
alias :get_commit_comment :commit_comment
|
156
168
|
|
@@ -160,9 +172,9 @@ module Github
|
|
160
172
|
# * <tt>:body</tt> - Required string.
|
161
173
|
#
|
162
174
|
# = Examples
|
163
|
-
#
|
164
|
-
#
|
165
|
-
# "body" => "Nice change"
|
175
|
+
# github = Github.new
|
176
|
+
# github.repos.commits.update_comment 'user-name', 'repo-name',
|
177
|
+
# 'comment-id', "body" => "Nice change"
|
166
178
|
#
|
167
179
|
def update_comment(user_name, repo_name, comment_id, params={})
|
168
180
|
_update_user_repo_params(user_name, repo_name)
|
@@ -172,9 +184,8 @@ module Github
|
|
172
184
|
_normalize_params_keys(params)
|
173
185
|
_validate_inputs(%w[ body ], params)
|
174
186
|
|
175
|
-
|
187
|
+
patch_request("/repos/#{user}/#{repo}/comments/#{comment_id}", params)
|
176
188
|
end
|
177
189
|
|
178
|
-
|
179
|
-
end # Repos
|
190
|
+
end # Repos::Commits
|
180
191
|
end # Github
|
@@ -3,114 +3,111 @@
|
|
3
3
|
require 'github_api/s3_uploader'
|
4
4
|
|
5
5
|
module Github
|
6
|
-
class Repos
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
end # Downloads
|
115
|
-
end # Repos
|
6
|
+
class Repos::Downloads < API
|
7
|
+
|
8
|
+
REQUIRED_PARAMS = %w[ name size ]
|
9
|
+
|
10
|
+
VALID_DOWNLOAD_PARAM_NAMES = %w[
|
11
|
+
name
|
12
|
+
size
|
13
|
+
description
|
14
|
+
content_type
|
15
|
+
].freeze
|
16
|
+
|
17
|
+
# List downloads for a repository
|
18
|
+
#
|
19
|
+
# = Examples
|
20
|
+
# github = Github.new
|
21
|
+
# github.repos.downloads.list 'user-name', 'repo-name'
|
22
|
+
# github.repos.downloads.list 'user-name', 'repo-name' { |downl| ... }
|
23
|
+
#
|
24
|
+
def list(user_name, repo_name, params={})
|
25
|
+
_update_user_repo_params(user_name, repo_name)
|
26
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
27
|
+
_normalize_params_keys(params)
|
28
|
+
|
29
|
+
response = get_request("/repos/#{user}/#{repo}/downloads", params)
|
30
|
+
return response unless block_given?
|
31
|
+
response.each { |el| yield el }
|
32
|
+
end
|
33
|
+
alias :all :list
|
34
|
+
|
35
|
+
# Get a single download
|
36
|
+
#
|
37
|
+
# = Examples
|
38
|
+
# github = Github.new
|
39
|
+
# github.repos.downloads.get 'user-name', 'repo-name', 'download-id'
|
40
|
+
#
|
41
|
+
def get(user_name, repo_name, download_id, params={})
|
42
|
+
_update_user_repo_params(user_name, repo_name)
|
43
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
44
|
+
_validate_presence_of download_id
|
45
|
+
_normalize_params_keys(params)
|
46
|
+
|
47
|
+
get_request("/repos/#{user}/#{repo}/downloads/#{download_id}", params)
|
48
|
+
end
|
49
|
+
alias :find :get
|
50
|
+
|
51
|
+
# Delete download from a repository
|
52
|
+
#
|
53
|
+
# = Examples
|
54
|
+
# github = Github.new
|
55
|
+
# github.repos.downloads.delete 'user-name', 'repo-name', 'download-id'
|
56
|
+
#
|
57
|
+
def delete(user_name, repo_name, download_id, params={})
|
58
|
+
_update_user_repo_params(user_name, repo_name)
|
59
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
60
|
+
_validate_presence_of download_id
|
61
|
+
_normalize_params_keys(params)
|
62
|
+
|
63
|
+
delete_request("/repos/#{user}/#{repo}/downloads/#{download_id}", params)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Creating a new download is a two step process.
|
67
|
+
# You must first create a new download resource using this method.
|
68
|
+
# Response from this method is to be used in #upload method.
|
69
|
+
#
|
70
|
+
# = Inputs
|
71
|
+
# * <tt>:name</tt> - Required string - name of the file that is being created.
|
72
|
+
# * <tt>:size</tt> - Required number - size of file in bytes.
|
73
|
+
# * <tt>:description</tt> - Optional string
|
74
|
+
# * <tt>:content_type</tt> - Optional string
|
75
|
+
#
|
76
|
+
# = Examples
|
77
|
+
# github = Github.new
|
78
|
+
# github.repos.downloads.create 'user-name', 'repo-name',
|
79
|
+
# "name" => "new_file.jpg",
|
80
|
+
# "size" => 114034,
|
81
|
+
# "description" => "Latest release",
|
82
|
+
# "content_type" => "text/plain"
|
83
|
+
#
|
84
|
+
def create(user_name, repo_name, params={})
|
85
|
+
_update_user_repo_params(user_name, repo_name)
|
86
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
87
|
+
|
88
|
+
_normalize_params_keys(params)
|
89
|
+
_filter_params_keys(VALID_DOWNLOAD_PARAM_NAMES, params)
|
90
|
+
_validate_inputs(REQUIRED_PARAMS, params)
|
91
|
+
|
92
|
+
post_request("/repos/#{user}/#{repo}/downloads", params)
|
93
|
+
end
|
94
|
+
|
95
|
+
# Upload a file to Amazon, using the reponse instance from
|
96
|
+
# Github::Repos::Downloads#create_download. This can be done by passing
|
97
|
+
# the response object as an argument to upload method.
|
98
|
+
#
|
99
|
+
# = Parameters
|
100
|
+
# * <tt>resource</tt> - Required resource of the create_download call.
|
101
|
+
# * <tt>:filename</tt> - Required filename, a path to a file location.
|
102
|
+
#
|
103
|
+
def upload(resource, filename)
|
104
|
+
_validate_presence_of resource, filename
|
105
|
+
|
106
|
+
response = Github::S3Uploader.new(resource, filename).send
|
107
|
+
response.body
|
108
|
+
end
|
109
|
+
alias :upload_to_s3 :upload
|
110
|
+
alias :upload_to_amazon :upload
|
111
|
+
|
112
|
+
end # Repos::Downloads
|
116
113
|
end # Github
|
@@ -1,48 +1,47 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
module Github
|
4
|
-
class Repos
|
5
|
-
module Forks
|
4
|
+
class Repos::Forks < API
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
6
|
+
# List repository forks
|
7
|
+
#
|
8
|
+
# = Parameters
|
9
|
+
# * <tt>:sort</tt> - newest, oldest, watchers, default: newest
|
10
|
+
#
|
11
|
+
# = Examples
|
12
|
+
# github = Github.new
|
13
|
+
# github.repos.forks.list 'user-name', 'repo-name'
|
14
|
+
# github.repos.forks.list 'user-name', 'repo-name' { |hook| ... }
|
15
|
+
#
|
16
|
+
def list(user_name, repo_name, params = {})
|
17
|
+
_update_user_repo_params(user_name, repo_name)
|
18
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
19
|
+
_normalize_params_keys(params)
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
alias :repository_forks :forks
|
21
|
+
response = get_request("/repos/#{user}/#{repo}/forks", params)
|
22
|
+
return response unless block_given?
|
23
|
+
response.each { |el| yield el }
|
24
|
+
end
|
25
|
+
alias :all :list
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
27
|
+
# Create a fork for the authenticated user
|
28
|
+
#
|
29
|
+
# = Inputs
|
30
|
+
# * <tt>:org</tt> - Optional string - the name of the service that is being called.
|
31
|
+
#
|
32
|
+
# = Examples
|
33
|
+
# github = Github.new
|
34
|
+
# github.repos.forks.create 'user-name', 'repo-name',
|
35
|
+
# "org" => "github"
|
36
|
+
#
|
37
|
+
def create(user_name, repo_name, params={})
|
38
|
+
_update_user_repo_params(user_name, repo_name)
|
39
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
40
|
+
_normalize_params_keys(params)
|
41
|
+
_filter_params_keys(%w[ org ], params)
|
39
42
|
|
40
|
-
|
41
|
-
|
43
|
+
post_request("/repos/#{user}/#{repo}/forks", params)
|
44
|
+
end
|
42
45
|
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
end # Forks
|
47
|
-
end # Repos
|
46
|
+
end # Repos::Forks
|
48
47
|
end # Github
|