github_api 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -1
- data/lib/github_api/api.rb +5 -3
- data/lib/github_api/authorizations.rb +8 -8
- data/lib/github_api/connection.rb +1 -1
- data/lib/github_api/events.rb +8 -8
- data/lib/github_api/gists/comments.rb +7 -7
- data/lib/github_api/gists.rb +10 -10
- data/lib/github_api/git_data/blobs.rb +3 -3
- data/lib/github_api/git_data/commits.rb +3 -3
- data/lib/github_api/git_data/references.rb +7 -7
- data/lib/github_api/git_data/tags.rb +3 -3
- data/lib/github_api/git_data/trees.rb +3 -3
- data/lib/github_api/issues/comments.rb +7 -7
- data/lib/github_api/issues/events.rb +2 -2
- data/lib/github_api/issues/labels.rb +12 -11
- data/lib/github_api/issues/milestones.rb +8 -8
- data/lib/github_api/issues.rb +9 -9
- data/lib/github_api/normalizer.rb +27 -0
- data/lib/github_api/orgs/members.rb +7 -7
- data/lib/github_api/orgs/teams.rb +15 -16
- data/lib/github_api/orgs.rb +4 -3
- data/lib/github_api/parameter_filter.rb +32 -0
- data/lib/github_api/pull_requests/comments.rb +7 -7
- data/lib/github_api/pull_requests.rb +12 -12
- data/lib/github_api/repos/collaborators.rb +4 -4
- data/lib/github_api/repos/commits.rb +11 -11
- data/lib/github_api/repos/contents.rb +3 -3
- data/lib/github_api/repos/downloads.rb +5 -5
- data/lib/github_api/repos/forks.rb +3 -3
- data/lib/github_api/repos/hooks.rb +8 -8
- data/lib/github_api/repos/keys.rb +7 -7
- data/lib/github_api/repos/pub_sub_hubbub.rb +4 -4
- data/lib/github_api/repos/watching.rb +5 -5
- data/lib/github_api/repos.rb +13 -13
- data/lib/github_api/search.rb +4 -4
- data/lib/github_api/users/emails.rb +3 -3
- data/lib/github_api/users/followers.rb +5 -5
- data/lib/github_api/users/keys.rb +7 -7
- data/lib/github_api/users.rb +3 -3
- data/lib/github_api/validations/presence.rb +1 -0
- data/lib/github_api/version.rb +1 -1
- data/lib/github_api.rb +26 -25
- data/spec/github/api_spec.rb +4 -4
- data/spec/github/normalizer_spec.rb +20 -0
- data/spec/github/parameter_filter_spec.rb +71 -0
- metadata +42 -40
- data/lib/github_api/filter.rb +0 -57
- data/spec/github/filter_spec.rb +0 -82
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# GithubAPI
|
2
|
-
[![Build Status](https://secure.travis-ci.org/peter-murach/github.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/peter-murach/github.png?travis)][gemnasium]
|
2
|
+
[![Build Status](https://secure.travis-ci.org/peter-murach/github.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/peter-murach/github.png?travis)][gemnasium] [![Code Climate](https://codeclimate.com/badge.png)][codeclimate]
|
3
3
|
|
4
4
|
[travis]: http://travis-ci.org/peter-murach/github
|
5
5
|
[gemnasium]: https://gemnasium.com/peter-murach/github
|
6
|
+
[codeclimate]: https://codeclimate.com/github/peter-murach/github
|
6
7
|
|
7
8
|
[Wiki](https://github.com/peter-murach/github/wiki) | [RDocs](http://rubydoc.info/github/peter-murach/github/master/frames)
|
8
9
|
|
data/lib/github_api/api.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# encoding: utf-8
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
require 'github_api/configuration'
|
4
4
|
require 'github_api/connection'
|
@@ -17,9 +17,11 @@ module Github
|
|
17
17
|
include MimeType
|
18
18
|
include Connection
|
19
19
|
include Request
|
20
|
-
|
20
|
+
|
21
|
+
# TODO consider these optional in a stack
|
21
22
|
include Validations
|
22
|
-
include
|
23
|
+
include ParameterFilter
|
24
|
+
include Normalizer
|
23
25
|
|
24
26
|
attr_reader *Configuration::VALID_OPTIONS_KEYS
|
25
27
|
attr_accessor *VALID_API_KEYS
|
@@ -23,7 +23,7 @@ module Github
|
|
23
23
|
#
|
24
24
|
def list(params={})
|
25
25
|
_check_if_authenticated
|
26
|
-
|
26
|
+
normalize! params
|
27
27
|
|
28
28
|
response = get_request("/authorizations", params)
|
29
29
|
return response unless block_given?
|
@@ -40,7 +40,7 @@ module Github
|
|
40
40
|
def get(authorization_id, params={})
|
41
41
|
_validate_presence_of(authorization_id)
|
42
42
|
_check_if_authenticated
|
43
|
-
|
43
|
+
normalize! params
|
44
44
|
|
45
45
|
get_request("/authorizations/#{authorization_id}", params)
|
46
46
|
end
|
@@ -60,8 +60,8 @@ module Github
|
|
60
60
|
#
|
61
61
|
def create(params={})
|
62
62
|
_check_if_authenticated
|
63
|
-
|
64
|
-
|
63
|
+
normalize! params
|
64
|
+
filter! VALID_AUTH_PARAM_NAMES, params
|
65
65
|
|
66
66
|
post_request("/authorizations", params)
|
67
67
|
end
|
@@ -83,8 +83,8 @@ module Github
|
|
83
83
|
_check_if_authenticated
|
84
84
|
_validate_presence_of(authorization_id)
|
85
85
|
|
86
|
-
|
87
|
-
|
86
|
+
normalize! params
|
87
|
+
filter! VALID_AUTH_PARAM_NAMES, params
|
88
88
|
|
89
89
|
patch_request("/authorizations/#{authorization_id}", params)
|
90
90
|
end
|
@@ -98,8 +98,8 @@ module Github
|
|
98
98
|
_check_if_authenticated
|
99
99
|
_validate_presence_of(authorization_id)
|
100
100
|
|
101
|
-
|
102
|
-
|
101
|
+
normalize! params
|
102
|
+
filter! VALID_AUTH_PARAM_NAMES, params
|
103
103
|
|
104
104
|
delete_request("/authorizations/#{authorization_id}", params)
|
105
105
|
end
|
@@ -45,7 +45,7 @@ module Github
|
|
45
45
|
|
46
46
|
def connection(options = {}) # :nodoc:
|
47
47
|
|
48
|
-
merged_options =
|
48
|
+
merged_options = filter! ALLOWED_OPTIONS, default_options.merge(options)
|
49
49
|
clear_cache unless options.empty?
|
50
50
|
|
51
51
|
@connection ||= begin
|
data/lib/github_api/events.rb
CHANGED
@@ -16,7 +16,7 @@ module Github
|
|
16
16
|
# github.events.public { |event| ... }
|
17
17
|
#
|
18
18
|
def public(params={})
|
19
|
-
|
19
|
+
normalize! params
|
20
20
|
|
21
21
|
response = get_request("/events", params)
|
22
22
|
return response unless block_given?
|
@@ -36,7 +36,7 @@ module Github
|
|
36
36
|
def repository(user_name, repo_name, params={})
|
37
37
|
_update_user_repo_params(user_name, repo_name)
|
38
38
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
39
|
-
|
39
|
+
normalize! params
|
40
40
|
|
41
41
|
response = get_request("/repos/#{user}/#{repo}/events", params)
|
42
42
|
return response unless block_given?
|
@@ -57,7 +57,7 @@ module Github
|
|
57
57
|
def issue(user_name, repo_name, params={})
|
58
58
|
_update_user_repo_params(user_name, repo_name)
|
59
59
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
60
|
-
|
60
|
+
normalize! params
|
61
61
|
|
62
62
|
response = get_request("/repos/#{user}/#{repo}/issues/events", params)
|
63
63
|
return response unless block_given?
|
@@ -77,7 +77,7 @@ module Github
|
|
77
77
|
def network(user_name, repo_name, params={})
|
78
78
|
_update_user_repo_params(user_name, repo_name)
|
79
79
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
80
|
-
|
80
|
+
normalize! params
|
81
81
|
|
82
82
|
response = get_request("/networks/#{user}/#{repo}/events", params)
|
83
83
|
return response unless block_given?
|
@@ -97,7 +97,7 @@ module Github
|
|
97
97
|
#
|
98
98
|
def org(org_name, params={})
|
99
99
|
_validate_presence_of org_name
|
100
|
-
|
100
|
+
normalize! params
|
101
101
|
|
102
102
|
response = get_request("/orgs/#{org_name}/events", params)
|
103
103
|
return response unless block_given?
|
@@ -128,7 +128,7 @@ module Github
|
|
128
128
|
#
|
129
129
|
def received(user_name, params={})
|
130
130
|
_validate_presence_of user_name
|
131
|
-
|
131
|
+
normalize! params
|
132
132
|
|
133
133
|
public_events = if params['public']
|
134
134
|
params.delete('public')
|
@@ -161,7 +161,7 @@ module Github
|
|
161
161
|
#
|
162
162
|
def performed(user_name, params={})
|
163
163
|
_validate_presence_of user_name
|
164
|
-
|
164
|
+
normalize! params
|
165
165
|
|
166
166
|
public_events = if params['public']
|
167
167
|
params.delete('public')
|
@@ -187,7 +187,7 @@ module Github
|
|
187
187
|
#
|
188
188
|
def user_org(user_name, org_name, params={})
|
189
189
|
_validate_presence_of user_name, org_name
|
190
|
-
|
190
|
+
normalize! params
|
191
191
|
|
192
192
|
response = get_request("/users/#{user_name}/events/orgs/#{org_name}", params)
|
193
193
|
return response unless block_given?
|
@@ -20,7 +20,7 @@ module Github
|
|
20
20
|
# github.gists.comments.list 'gist-id'
|
21
21
|
#
|
22
22
|
def list(gist_id, params={})
|
23
|
-
|
23
|
+
normalize! params
|
24
24
|
_validate_presence_of(gist_id)
|
25
25
|
# _merge_mime_type(:gist_comment, params)
|
26
26
|
|
@@ -37,7 +37,7 @@ module Github
|
|
37
37
|
# github.gists.comments.get 'comment-id'
|
38
38
|
#
|
39
39
|
def get(comment_id, params={})
|
40
|
-
|
40
|
+
normalize! params
|
41
41
|
_validate_presence_of(comment_id)
|
42
42
|
# _merge_mime_type(:gist_comment, params)
|
43
43
|
|
@@ -52,9 +52,9 @@ module Github
|
|
52
52
|
# github.gists.comments.create 'gist-id'
|
53
53
|
#
|
54
54
|
def create(gist_id, params={})
|
55
|
-
|
55
|
+
normalize! params
|
56
56
|
# _merge_mime_type(:gist_comment, params)
|
57
|
-
|
57
|
+
filter! ALLOWED_GIST_COMMENT_INPUTS, params
|
58
58
|
assert_required_keys(REQUIRED_GIST_COMMENT_INPUTS, params)
|
59
59
|
|
60
60
|
post_request("/gists/#{gist_id}/comments", params)
|
@@ -67,10 +67,10 @@ module Github
|
|
67
67
|
# github.gists.comments.edit 'comment-id'
|
68
68
|
#
|
69
69
|
def edit(comment_id, params={})
|
70
|
-
|
70
|
+
normalize! params
|
71
71
|
_validate_presence_of(comment_id)
|
72
72
|
# _merge_mime_type(:gist_comment, params)
|
73
|
-
|
73
|
+
filter! ALLOWED_GIST_COMMENT_INPUTS, params
|
74
74
|
assert_required_keys(REQUIRED_GIST_COMMENT_INPUTS, params)
|
75
75
|
|
76
76
|
patch_request("/gists/comments/#{comment_id}", params)
|
@@ -83,7 +83,7 @@ module Github
|
|
83
83
|
# github.gists.comments.delete 'comment-id'
|
84
84
|
#
|
85
85
|
def delete(comment_id, params={})
|
86
|
-
|
86
|
+
normalize! params
|
87
87
|
_validate_presence_of(comment_id)
|
88
88
|
# _merge_mime_type(:gist_comment, params)
|
89
89
|
|
data/lib/github_api/gists.rb
CHANGED
@@ -38,7 +38,7 @@ module Github
|
|
38
38
|
# github.gists.list
|
39
39
|
#
|
40
40
|
def list(params={})
|
41
|
-
|
41
|
+
normalize! params
|
42
42
|
|
43
43
|
user = params.delete('user')
|
44
44
|
|
@@ -61,7 +61,7 @@ module Github
|
|
61
61
|
# github.gists.starred
|
62
62
|
#
|
63
63
|
def starred(params={})
|
64
|
-
|
64
|
+
normalize! params
|
65
65
|
|
66
66
|
response = get_request("/gists/starred", params)
|
67
67
|
return response unless block_given?
|
@@ -75,7 +75,7 @@ module Github
|
|
75
75
|
# github.gists.get 'gist-id'
|
76
76
|
#
|
77
77
|
def get(gist_id, params={})
|
78
|
-
|
78
|
+
normalize! params
|
79
79
|
_validate_presence_of(gist_id)
|
80
80
|
|
81
81
|
get_request("/gists/#{gist_id}", params)
|
@@ -104,7 +104,7 @@ module Github
|
|
104
104
|
# }
|
105
105
|
#
|
106
106
|
def create(params={})
|
107
|
-
|
107
|
+
normalize! params
|
108
108
|
assert_required_keys(REQUIRED_GIST_INPUTS, params)
|
109
109
|
|
110
110
|
post_request("/gists", params)
|
@@ -140,7 +140,7 @@ module Github
|
|
140
140
|
#
|
141
141
|
def edit(gist_id, params={})
|
142
142
|
_validate_presence_of(gist_id)
|
143
|
-
|
143
|
+
normalize! params
|
144
144
|
|
145
145
|
patch_request("/gists/#{gist_id}", params)
|
146
146
|
end
|
@@ -153,7 +153,7 @@ module Github
|
|
153
153
|
#
|
154
154
|
def star(gist_id, params={})
|
155
155
|
_validate_presence_of(gist_id)
|
156
|
-
|
156
|
+
normalize! params
|
157
157
|
|
158
158
|
put_request("/gists/#{gist_id}/star", params)
|
159
159
|
end
|
@@ -166,7 +166,7 @@ module Github
|
|
166
166
|
#
|
167
167
|
def unstar(gist_id, params={})
|
168
168
|
_validate_presence_of(gist_id)
|
169
|
-
|
169
|
+
normalize! params
|
170
170
|
|
171
171
|
delete_request("/gists/#{gist_id}/star", params)
|
172
172
|
end
|
@@ -179,7 +179,7 @@ module Github
|
|
179
179
|
#
|
180
180
|
def starred?(gist_id, params={})
|
181
181
|
_validate_presence_of(gist_id)
|
182
|
-
|
182
|
+
normalize! params
|
183
183
|
|
184
184
|
get_request("/gists/#{gist_id}/star", params)
|
185
185
|
true
|
@@ -195,7 +195,7 @@ module Github
|
|
195
195
|
#
|
196
196
|
def fork(gist_id, params={})
|
197
197
|
_validate_presence_of(gist_id)
|
198
|
-
|
198
|
+
normalize! params
|
199
199
|
|
200
200
|
post_request("/gists/#{gist_id}/fork", params)
|
201
201
|
end
|
@@ -208,7 +208,7 @@ module Github
|
|
208
208
|
#
|
209
209
|
def delete(gist_id, params={})
|
210
210
|
_validate_presence_of(gist_id)
|
211
|
-
|
211
|
+
normalize! params
|
212
212
|
|
213
213
|
delete_request("/gists/#{gist_id}", params)
|
214
214
|
end
|
@@ -23,7 +23,7 @@ module Github
|
|
23
23
|
_update_user_repo_params(user_name, repo_name)
|
24
24
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
25
25
|
_validate_presence_of sha
|
26
|
-
|
26
|
+
normalize! params
|
27
27
|
|
28
28
|
get_request("/repos/#{user}/#{repo}/git/blobs/#{sha}", params)
|
29
29
|
end
|
@@ -44,8 +44,8 @@ module Github
|
|
44
44
|
_update_user_repo_params(user_name, repo_name)
|
45
45
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
46
46
|
|
47
|
-
|
48
|
-
|
47
|
+
normalize! params
|
48
|
+
filter! VALID_BLOB_PARAM_NAMES, params
|
49
49
|
assert_required_keys(VALID_BLOB_PARAM_NAMES, params)
|
50
50
|
|
51
51
|
post_request("/repos/#{user}/#{repo}/git/blobs", params)
|
@@ -35,7 +35,7 @@ module Github
|
|
35
35
|
_update_user_repo_params(user_name, repo_name)
|
36
36
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
37
37
|
_validate_presence_of sha
|
38
|
-
|
38
|
+
normalize! params
|
39
39
|
|
40
40
|
get_request("/repos/#{user}/#{repo}/git/commits/#{sha}", params)
|
41
41
|
end
|
@@ -76,8 +76,8 @@ module Github
|
|
76
76
|
def create(user_name, repo_name, params={})
|
77
77
|
_update_user_repo_params(user_name, repo_name)
|
78
78
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
79
|
-
|
80
|
-
|
79
|
+
normalize! params
|
80
|
+
filter! VALID_COMMIT_PARAM_NAMES, params
|
81
81
|
assert_required_keys(REQUIRED_COMMIT_PARAMS, params)
|
82
82
|
|
83
83
|
post_request("/repos/#{user}/#{repo}/git/commits", params)
|
@@ -30,7 +30,7 @@ module Github
|
|
30
30
|
def list(user_name, repo_name, params={})
|
31
31
|
_update_user_repo_params(user_name, repo_name)
|
32
32
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
33
|
-
|
33
|
+
normalize! params
|
34
34
|
|
35
35
|
response = if params['ref']
|
36
36
|
ref = params.delete('ref')
|
@@ -61,7 +61,7 @@ module Github
|
|
61
61
|
|
62
62
|
_validate_presence_of ref
|
63
63
|
_validate_reference ref
|
64
|
-
|
64
|
+
normalize! params
|
65
65
|
|
66
66
|
get_request("/repos/#{user}/#{repo}/git/refs/#{ref}", params)
|
67
67
|
end
|
@@ -84,8 +84,8 @@ module Github
|
|
84
84
|
_update_user_repo_params(user_name, repo_name)
|
85
85
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
86
86
|
|
87
|
-
|
88
|
-
|
87
|
+
normalize! params
|
88
|
+
filter! VALID_REF_PARAM_NAMES, params
|
89
89
|
_validate_presence_of params['ref']
|
90
90
|
_validate_reference params['ref']
|
91
91
|
assert_required_keys(%w[ ref sha ], params)
|
@@ -111,8 +111,8 @@ module Github
|
|
111
111
|
|
112
112
|
_validate_presence_of ref
|
113
113
|
_validate_reference ref
|
114
|
-
|
115
|
-
|
114
|
+
normalize! params
|
115
|
+
filter! VALID_REF_PARAM_NAMES, params
|
116
116
|
assert_required_keys(%w[ sha ], params)
|
117
117
|
|
118
118
|
patch_request("/repos/#{user}/#{repo}/git/refs/#{ref}", params)
|
@@ -128,7 +128,7 @@ module Github
|
|
128
128
|
def delete(user_name, repo_name, ref, params={})
|
129
129
|
_update_user_repo_params(user_name, repo_name)
|
130
130
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
131
|
-
|
131
|
+
normalize! params
|
132
132
|
_validate_presence_of ref
|
133
133
|
|
134
134
|
delete_request("/repos/#{user}/#{repo}/git/refs/#{ref}", params)
|
@@ -37,7 +37,7 @@ module Github
|
|
37
37
|
_update_user_repo_params(user_name, repo_name)
|
38
38
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
39
39
|
_validate_presence_of sha
|
40
|
-
|
40
|
+
normalize! params
|
41
41
|
|
42
42
|
get_request("/repos/#{user}/#{repo}/git/tags/#{sha}", params)
|
43
43
|
end
|
@@ -74,9 +74,9 @@ module Github
|
|
74
74
|
def create(user_name, repo_name, params={})
|
75
75
|
_update_user_repo_params(user_name, repo_name)
|
76
76
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
77
|
-
|
77
|
+
normalize! params
|
78
78
|
|
79
|
-
|
79
|
+
filter! VALID_TAG_PARAM_NAMES, params
|
80
80
|
assert_valid_values(VALID_TAG_PARAM_VALUES, params)
|
81
81
|
|
82
82
|
post_request("/repos/#{user}/#{repo}/git/tags", params)
|
@@ -43,7 +43,7 @@ module Github
|
|
43
43
|
_update_user_repo_params(user_name, repo_name)
|
44
44
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
45
45
|
_validate_presence_of sha
|
46
|
-
|
46
|
+
normalize! params
|
47
47
|
|
48
48
|
response = if params['recursive']
|
49
49
|
params['recursive'] = 1
|
@@ -88,10 +88,10 @@ module Github
|
|
88
88
|
def create(user_name, repo_name, params={})
|
89
89
|
_update_user_repo_params(user_name, repo_name)
|
90
90
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
91
|
-
|
91
|
+
normalize! params
|
92
92
|
assert_required_keys(%w[ tree ], params)
|
93
93
|
|
94
|
-
|
94
|
+
filter! VALID_TREE_PARAM_NAMES, params['tree']
|
95
95
|
assert_valid_values(VALID_TREE_PARAM_VALUES, params['tree'])
|
96
96
|
|
97
97
|
post_request("/repos/#{user}/#{repo}/git/trees", params)
|
@@ -26,7 +26,7 @@ module Github
|
|
26
26
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
27
27
|
_validate_presence_of issue_id
|
28
28
|
|
29
|
-
|
29
|
+
normalize! params
|
30
30
|
# _merge_mime_type(:issue_comment, params)
|
31
31
|
|
32
32
|
response = get_request("/repos/#{user}/#{repo}/issues/#{issue_id}/comments", params)
|
@@ -46,7 +46,7 @@ module Github
|
|
46
46
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
47
47
|
_validate_presence_of comment_id
|
48
48
|
|
49
|
-
|
49
|
+
normalize! params
|
50
50
|
# _merge_mime_type(:issue_comment, params)
|
51
51
|
|
52
52
|
get_request("/repos/#{user}/#{repo}/issues/comments/#{comment_id}", params)
|
@@ -68,9 +68,9 @@ module Github
|
|
68
68
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
69
69
|
_validate_presence_of issue_id
|
70
70
|
|
71
|
-
|
71
|
+
normalize! params
|
72
72
|
# _merge_mime_type(:issue_comment, params)
|
73
|
-
|
73
|
+
filter! VALID_ISSUE_COMMENT_PARAM_NAME, params
|
74
74
|
assert_required_keys(%w[ body ], params)
|
75
75
|
|
76
76
|
post_request("/repos/#{user}/#{repo}/issues/#{issue_id}/comments", params)
|
@@ -91,9 +91,9 @@ module Github
|
|
91
91
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
92
92
|
_validate_presence_of comment_id
|
93
93
|
|
94
|
-
|
94
|
+
normalize! params
|
95
95
|
# _merge_mime_type(:issue_comment, params)
|
96
|
-
|
96
|
+
filter! VALID_ISSUE_COMMENT_PARAM_NAME, params
|
97
97
|
assert_required_keys(%w[ body ], params)
|
98
98
|
|
99
99
|
patch_request("/repos/#{user}/#{repo}/issues/comments/#{comment_id}")
|
@@ -110,7 +110,7 @@ module Github
|
|
110
110
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
111
111
|
_validate_presence_of comment_id
|
112
112
|
|
113
|
-
|
113
|
+
normalize! params
|
114
114
|
# _merge_mime_type(:issue_comment, params)
|
115
115
|
|
116
116
|
delete_request("/repos/#{user}/#{repo}/issues/comments/#{comment_id}", params)
|
@@ -23,7 +23,7 @@ module Github
|
|
23
23
|
def list(user_name, repo_name, issue_id=nil, params={})
|
24
24
|
_update_user_repo_params(user_name, repo_name)
|
25
25
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
26
|
-
|
26
|
+
normalize! params
|
27
27
|
|
28
28
|
response = if issue_id
|
29
29
|
get_request("/repos/#{user}/#{repo}/issues/#{issue_id}/events", params)
|
@@ -45,7 +45,7 @@ module Github
|
|
45
45
|
_update_user_repo_params(user_name, repo_name)
|
46
46
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
47
47
|
_validate_presence_of event_id
|
48
|
-
|
48
|
+
normalize! params
|
49
49
|
|
50
50
|
get_request("/repos/#{user}/#{repo}/issues/events/#{event_id}")
|
51
51
|
end
|
@@ -22,7 +22,7 @@ module Github
|
|
22
22
|
def list(user_name, repo_name, params={})
|
23
23
|
_update_user_repo_params(user_name, repo_name)
|
24
24
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
25
|
-
|
25
|
+
normalize! params
|
26
26
|
|
27
27
|
response = get_request("/repos/#{user}/#{repo}/labels", params)
|
28
28
|
return response unless block_given?
|
@@ -40,7 +40,7 @@ module Github
|
|
40
40
|
_update_user_repo_params(user_name, repo_name)
|
41
41
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
42
42
|
_validate_presence_of label_id
|
43
|
-
|
43
|
+
normalize! params
|
44
44
|
|
45
45
|
get_request("/repos/#{user}/#{repo}/labels/#{label_id}", params)
|
46
46
|
end
|
@@ -60,8 +60,8 @@ module Github
|
|
60
60
|
_update_user_repo_params(user_name, repo_name)
|
61
61
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
62
62
|
|
63
|
-
|
64
|
-
|
63
|
+
normalize! params
|
64
|
+
filter! VALID_LABEL_INPUTS, params
|
65
65
|
assert_required_keys(VALID_LABEL_INPUTS, params)
|
66
66
|
|
67
67
|
post_request("/repos/#{user}/#{repo}/labels", params)
|
@@ -83,8 +83,8 @@ module Github
|
|
83
83
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
84
84
|
_validate_presence_of label_id
|
85
85
|
|
86
|
-
|
87
|
-
|
86
|
+
normalize! params
|
87
|
+
filter! VALID_LABEL_INPUTS, params
|
88
88
|
assert_required_keys(VALID_LABEL_INPUTS, params)
|
89
89
|
|
90
90
|
patch_request("/repos/#{user}/#{repo}/labels/#{label_id}", params)
|
@@ -102,7 +102,7 @@ module Github
|
|
102
102
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
103
103
|
|
104
104
|
_validate_presence_of label_id
|
105
|
-
|
105
|
+
normalize! params
|
106
106
|
|
107
107
|
delete_request("/repos/#{user}/#{repo}/labels/#{label_id}", params)
|
108
108
|
end
|
@@ -117,7 +117,7 @@ module Github
|
|
117
117
|
_update_user_repo_params(user_name, repo_name)
|
118
118
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
119
119
|
_validate_presence_of(issue_id)
|
120
|
-
|
120
|
+
normalize! params
|
121
121
|
|
122
122
|
get_request("/repos/#{user}/#{repo}/issues/#{issue_id}/labels", params)
|
123
123
|
end
|
@@ -135,7 +135,7 @@ module Github
|
|
135
135
|
_update_user_repo_params(user_name, repo_name)
|
136
136
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
137
137
|
_validate_presence_of(issue_id)
|
138
|
-
|
138
|
+
normalize! params
|
139
139
|
|
140
140
|
post_request("/repos/#{user}/#{repo}/issues/#{issue_id}/labels", params)
|
141
141
|
end
|
@@ -156,7 +156,7 @@ module Github
|
|
156
156
|
_update_user_repo_params(user_name, repo_name)
|
157
157
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
158
158
|
_validate_presence_of issue_id
|
159
|
-
|
159
|
+
normalize! params
|
160
160
|
|
161
161
|
if label_id
|
162
162
|
delete_request("/repos/#{user}/#{repo}/issues/#{issue_id}/labels/#{label_id}", params)
|
@@ -180,7 +180,7 @@ module Github
|
|
180
180
|
_update_user_repo_params(user_name, repo_name)
|
181
181
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
182
182
|
_validate_presence_of issue_id
|
183
|
-
|
183
|
+
normalize! params
|
184
184
|
|
185
185
|
put_request("/repos/#{user}/#{repo}/issues/#{issue_id}/labels", params)
|
186
186
|
end
|
@@ -195,6 +195,7 @@ module Github
|
|
195
195
|
_update_user_repo_params(user_name, repo_name)
|
196
196
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
197
197
|
_validate_presence_of milestone_id
|
198
|
+
normalize! params
|
198
199
|
|
199
200
|
response = get_request("/repos/#{user}/#{repo}/milestones/#{milestone_id}/labels", params)
|
200
201
|
return response unless block_given?
|
@@ -42,8 +42,8 @@ module Github
|
|
42
42
|
_update_user_repo_params(user_name, repo_name)
|
43
43
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
44
44
|
|
45
|
-
|
46
|
-
|
45
|
+
normalize! params
|
46
|
+
filter! VALID_MILESTONE_OPTIONS.keys, params
|
47
47
|
assert_valid_values(VALID_MILESTONE_OPTIONS, params)
|
48
48
|
|
49
49
|
response = get_request("/repos/#{user}/#{repo}/milestones", params)
|
@@ -62,7 +62,7 @@ module Github
|
|
62
62
|
_update_user_repo_params(user_name, repo_name)
|
63
63
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
64
64
|
_validate_presence_of milestone_id
|
65
|
-
|
65
|
+
normalize! params
|
66
66
|
|
67
67
|
get_request("/repos/#{user}/#{repo}/milestones/#{milestone_id}", params)
|
68
68
|
end
|
@@ -87,8 +87,8 @@ module Github
|
|
87
87
|
_update_user_repo_params(user_name, repo_name)
|
88
88
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
89
89
|
|
90
|
-
|
91
|
-
|
90
|
+
normalize! params
|
91
|
+
filter! VALID_MILESTONE_INPUTS, params
|
92
92
|
assert_required_keys(%w[ title ], params)
|
93
93
|
|
94
94
|
post_request("/repos/#{user}/#{repo}/milestones", params)
|
@@ -115,8 +115,8 @@ module Github
|
|
115
115
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
116
116
|
_validate_presence_of milestone_id
|
117
117
|
|
118
|
-
|
119
|
-
|
118
|
+
normalize! params
|
119
|
+
filter! VALID_MILESTONE_INPUTS, params
|
120
120
|
assert_required_keys(%w[ title ], params)
|
121
121
|
|
122
122
|
patch_request("/repos/#{user}/#{repo}/milestones/#{milestone_id}", params)
|
@@ -132,7 +132,7 @@ module Github
|
|
132
132
|
_update_user_repo_params(user_name, repo_name)
|
133
133
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
134
134
|
_validate_presence_of milestone_id
|
135
|
-
|
135
|
+
normalize! params
|
136
136
|
|
137
137
|
delete_request("/repos/#{user}/#{repo}/milestones/#{milestone_id}", params)
|
138
138
|
end
|