github_api 0.4.11 → 0.5.0.rc1
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 +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
data/lib/github_api/issues.rb
CHANGED
|
@@ -10,11 +10,6 @@ module Github
|
|
|
10
10
|
:Labels => 'labels',
|
|
11
11
|
:Milestones => 'milestones'
|
|
12
12
|
|
|
13
|
-
include Github::Issues::Comments
|
|
14
|
-
include Github::Issues::Events
|
|
15
|
-
include Github::Issues::Labels
|
|
16
|
-
include Github::Issues::Milestones
|
|
17
|
-
|
|
18
13
|
VALID_ISSUE_PARAM_NAMES = %w[
|
|
19
14
|
filter
|
|
20
15
|
state
|
|
@@ -44,6 +39,26 @@ module Github
|
|
|
44
39
|
super(options)
|
|
45
40
|
end
|
|
46
41
|
|
|
42
|
+
# Access to Issues::Comments API
|
|
43
|
+
def comments
|
|
44
|
+
@comments ||= ApiFactory.new 'Issues::Comments'
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Access to Issues::Events API
|
|
48
|
+
def events
|
|
49
|
+
@events ||= ApiFactory.new 'Issues::Events'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Access to Issues::Comments API
|
|
53
|
+
def labels
|
|
54
|
+
@labels ||= ApiFactory.new 'Issues::Labels'
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Access to Issues::Comments API
|
|
58
|
+
def milestones
|
|
59
|
+
@milestones ||= ApiFactory.new 'Issues::Milestones'
|
|
60
|
+
end
|
|
61
|
+
|
|
47
62
|
# List your issues
|
|
48
63
|
#
|
|
49
64
|
# = Parameters
|
|
@@ -59,25 +74,25 @@ module Github
|
|
|
59
74
|
# <tt>:since</tt> - Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
|
|
60
75
|
#
|
|
61
76
|
# = Examples
|
|
62
|
-
#
|
|
63
|
-
#
|
|
77
|
+
# github = Github.new :oauth_token => '...'
|
|
78
|
+
# github.issues.list :since => '2011-04-12312:12:121',
|
|
64
79
|
# :filter => 'created',
|
|
65
80
|
# :state => 'open',
|
|
66
81
|
# :labels => "bug,ui,bla",
|
|
67
82
|
# :sort => 'comments',
|
|
68
83
|
# :direction => 'asc'
|
|
69
84
|
#
|
|
70
|
-
def
|
|
85
|
+
def list(params={})
|
|
71
86
|
_normalize_params_keys(params)
|
|
72
87
|
_filter_params_keys(VALID_ISSUE_PARAM_NAMES, params)
|
|
73
88
|
# _merge_mime_type(:issue, params)
|
|
74
89
|
_validate_params_values(VALID_ISSUE_PARAM_VALUES, params)
|
|
75
90
|
|
|
76
|
-
response =
|
|
91
|
+
response = get_request("/issues", params)
|
|
77
92
|
return response unless block_given?
|
|
78
93
|
response.each { |el| yield el }
|
|
79
94
|
end
|
|
80
|
-
alias :
|
|
95
|
+
alias :all :list
|
|
81
96
|
|
|
82
97
|
# List issues for a repository
|
|
83
98
|
#
|
|
@@ -100,8 +115,8 @@ module Github
|
|
|
100
115
|
# <tt>:direction</tt> - <tt>asc</tt>, <tt>desc</tt>, default: <tt>desc</tt>
|
|
101
116
|
#
|
|
102
117
|
# = Examples
|
|
103
|
-
#
|
|
104
|
-
#
|
|
118
|
+
# github = Github.new :user => 'user-name', :repo => 'repo-name'
|
|
119
|
+
# github.issues.list_repo :milestone => 1,
|
|
105
120
|
# :state => 'open',
|
|
106
121
|
# :assignee => '*',
|
|
107
122
|
# :mentioned => 'octocat',
|
|
@@ -109,7 +124,7 @@ module Github
|
|
|
109
124
|
# :sort => 'comments',
|
|
110
125
|
# :direction => 'asc'
|
|
111
126
|
#
|
|
112
|
-
def
|
|
127
|
+
def list_repo(user_name=nil, repo_name=nil, params={})
|
|
113
128
|
_update_user_repo_params(user_name, repo_name)
|
|
114
129
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
115
130
|
|
|
@@ -118,21 +133,19 @@ module Github
|
|
|
118
133
|
# _merge_mime_type(:issue, params)
|
|
119
134
|
_validate_params_values(VALID_ISSUE_PARAM_VALUES, params)
|
|
120
135
|
|
|
121
|
-
response =
|
|
136
|
+
response = get_request("/repos/#{user}/#{repo}/issues", params)
|
|
122
137
|
return response unless block_given?
|
|
123
138
|
response.each { |el| yield el }
|
|
124
139
|
end
|
|
125
|
-
alias :
|
|
126
|
-
alias :list_repo_issues :repo_issues
|
|
127
|
-
alias :list_repository_issues :repo_issues
|
|
140
|
+
alias :list_repository :list_repo
|
|
128
141
|
|
|
129
142
|
# Get a single issue
|
|
130
143
|
#
|
|
131
144
|
# = Examples
|
|
132
|
-
#
|
|
133
|
-
#
|
|
145
|
+
# github = Github.new
|
|
146
|
+
# github.issues.find 'user-name', 'repo-name', 'issue-id'
|
|
134
147
|
#
|
|
135
|
-
def
|
|
148
|
+
def find(user_name, repo_name, issue_id, params={})
|
|
136
149
|
_update_user_repo_params(user_name, repo_name)
|
|
137
150
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
138
151
|
_validate_presence_of issue_id
|
|
@@ -140,9 +153,8 @@ module Github
|
|
|
140
153
|
_normalize_params_keys(params)
|
|
141
154
|
# _merge_mime_type(:issue, params)
|
|
142
155
|
|
|
143
|
-
|
|
156
|
+
get_request("/repos/#{user}/#{repo}/issues/#{issue_id}", params)
|
|
144
157
|
end
|
|
145
|
-
alias :get_issue :issue
|
|
146
158
|
|
|
147
159
|
# Create an issue
|
|
148
160
|
#
|
|
@@ -153,8 +165,8 @@ module Github
|
|
|
153
165
|
# <tt>:milestone</tt> - Optional number - Milestone to associate this issue with
|
|
154
166
|
# <tt>:labels</tt> - Optional array of strings - Labels to associate with this issue
|
|
155
167
|
# = Examples
|
|
156
|
-
#
|
|
157
|
-
#
|
|
168
|
+
# github = Github.new :user => 'user-name', :repo => 'repo-name'
|
|
169
|
+
# github.issues.create
|
|
158
170
|
# "title" => "Found a bug",
|
|
159
171
|
# "body" => "I'm having a problem with this.",
|
|
160
172
|
# "assignee" => "octocat",
|
|
@@ -164,7 +176,7 @@ module Github
|
|
|
164
176
|
# "Label2"
|
|
165
177
|
# ]
|
|
166
178
|
#
|
|
167
|
-
def
|
|
179
|
+
def create(user_name, repo_name, params={})
|
|
168
180
|
_update_user_repo_params(user_name, repo_name)
|
|
169
181
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
170
182
|
|
|
@@ -173,7 +185,7 @@ module Github
|
|
|
173
185
|
_filter_params_keys(VALID_ISSUE_PARAM_NAMES, params)
|
|
174
186
|
_validate_inputs(%w[ title ], params)
|
|
175
187
|
|
|
176
|
-
|
|
188
|
+
post_request("/repos/#{user}/#{repo}/issues", params)
|
|
177
189
|
end
|
|
178
190
|
|
|
179
191
|
# Edit an issue
|
|
@@ -187,8 +199,8 @@ module Github
|
|
|
187
199
|
# <tt>:labels</tt> - Optional array of strings - Labels to associate with this issue. Pass one or more Labels to replace the set of Labels on this Issue. Send an empty array ([]) to clear all Labels from the Issue.
|
|
188
200
|
#
|
|
189
201
|
# = Examples
|
|
190
|
-
#
|
|
191
|
-
#
|
|
202
|
+
# github = Github.new
|
|
203
|
+
# github.issues.edit 'user-name', 'repo-name', 'issue-id'
|
|
192
204
|
# "title" => "Found a bug",
|
|
193
205
|
# "body" => "I'm having a problem with this.",
|
|
194
206
|
# "assignee" => "octocat",
|
|
@@ -198,16 +210,16 @@ module Github
|
|
|
198
210
|
# "Label2"
|
|
199
211
|
# ]
|
|
200
212
|
#
|
|
201
|
-
def
|
|
213
|
+
def edit(user_name, repo_name, issue_id, params={})
|
|
202
214
|
_update_user_repo_params(user_name, repo_name)
|
|
203
215
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
204
216
|
_validate_presence_of issue_id
|
|
205
217
|
|
|
206
218
|
_normalize_params_keys(params)
|
|
207
219
|
# _merge_mime_type(:issue, params)
|
|
208
|
-
_filter_params_keys(
|
|
220
|
+
_filter_params_keys(VALID_ISSUE_PARAM_NAMES, params)
|
|
209
221
|
|
|
210
|
-
|
|
222
|
+
patch_request("/repos/#{user}/#{repo}/issues/#{issue_id}", params)
|
|
211
223
|
end
|
|
212
224
|
|
|
213
225
|
end # Issues
|
|
@@ -1,123 +1,120 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
module Github
|
|
4
|
-
class Issues
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
end # Comments
|
|
122
|
-
end # Issues
|
|
4
|
+
class Issues::Comments < API
|
|
5
|
+
|
|
6
|
+
VALID_ISSUE_COMMENT_PARAM_NAME = %w[
|
|
7
|
+
body
|
|
8
|
+
resource
|
|
9
|
+
mime_type
|
|
10
|
+
].freeze
|
|
11
|
+
|
|
12
|
+
# Creates new Issues::Comments API
|
|
13
|
+
def initialize(options = {})
|
|
14
|
+
super(options)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# List comments on an issue
|
|
18
|
+
#
|
|
19
|
+
# = Examples
|
|
20
|
+
# github = Github.new
|
|
21
|
+
# github.issues.comments.all 'user-name', 'repo-name', 'issue-id'
|
|
22
|
+
# github.issues.comments.all 'user-name', 'repo-name', 'issue-id' {|com| .. }
|
|
23
|
+
#
|
|
24
|
+
def list(user_name, repo_name, issue_id, params={})
|
|
25
|
+
_update_user_repo_params(user_name, repo_name)
|
|
26
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
27
|
+
_validate_presence_of issue_id
|
|
28
|
+
|
|
29
|
+
_normalize_params_keys(params)
|
|
30
|
+
# _merge_mime_type(:issue_comment, params)
|
|
31
|
+
|
|
32
|
+
response = get_request("/repos/#{user}/#{repo}/issues/#{issue_id}/comments", params)
|
|
33
|
+
return response unless block_given?
|
|
34
|
+
response.each { |el| yield el }
|
|
35
|
+
end
|
|
36
|
+
alias :all :list
|
|
37
|
+
|
|
38
|
+
# Get a single comment
|
|
39
|
+
#
|
|
40
|
+
# = Examples
|
|
41
|
+
# github = Github.new
|
|
42
|
+
# github.issues.comments.find 'user-name', 'repo-name', 'comment-id'
|
|
43
|
+
#
|
|
44
|
+
def get(user_name, repo_name, comment_id, params={})
|
|
45
|
+
_update_user_repo_params(user_name, repo_name)
|
|
46
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
47
|
+
_validate_presence_of comment_id
|
|
48
|
+
|
|
49
|
+
_normalize_params_keys(params)
|
|
50
|
+
# _merge_mime_type(:issue_comment, params)
|
|
51
|
+
|
|
52
|
+
get_request("/repos/#{user}/#{repo}/issues/comments/#{comment_id}", params)
|
|
53
|
+
end
|
|
54
|
+
alias :find :get
|
|
55
|
+
|
|
56
|
+
# Create a comment
|
|
57
|
+
#
|
|
58
|
+
# = Inputs
|
|
59
|
+
# <tt>:body</tt> Required string
|
|
60
|
+
#
|
|
61
|
+
# = Examples
|
|
62
|
+
# github = Github.new
|
|
63
|
+
# github.issues.comments.create 'user-name', 'repo-name', 'issue-id',
|
|
64
|
+
# "body" => 'a new comment'
|
|
65
|
+
#
|
|
66
|
+
def create(user_name, repo_name, issue_id, params={})
|
|
67
|
+
_update_user_repo_params(user_name, repo_name)
|
|
68
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
69
|
+
_validate_presence_of issue_id
|
|
70
|
+
|
|
71
|
+
_normalize_params_keys(params)
|
|
72
|
+
# _merge_mime_type(:issue_comment, params)
|
|
73
|
+
_filter_params_keys(VALID_ISSUE_COMMENT_PARAM_NAME, params)
|
|
74
|
+
_validate_inputs(%w[ body ], params)
|
|
75
|
+
|
|
76
|
+
post_request("/repos/#{user}/#{repo}/issues/#{issue_id}/comments", params)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Edit a comment
|
|
80
|
+
#
|
|
81
|
+
# = Inputs
|
|
82
|
+
# <tt>:body</tt> Required string
|
|
83
|
+
#
|
|
84
|
+
# = Examples
|
|
85
|
+
# github = Github.new
|
|
86
|
+
# github.issues.comments.edit 'user-name', 'repo-name', 'comment-id',
|
|
87
|
+
# "body" => 'a new comment'
|
|
88
|
+
#
|
|
89
|
+
def edit(user_name, repo_name, comment_id, params={})
|
|
90
|
+
_update_user_repo_params(user_name, repo_name)
|
|
91
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
92
|
+
_validate_presence_of comment_id
|
|
93
|
+
|
|
94
|
+
_normalize_params_keys(params)
|
|
95
|
+
# _merge_mime_type(:issue_comment, params)
|
|
96
|
+
_filter_params_keys(VALID_ISSUE_COMMENT_PARAM_NAME, params)
|
|
97
|
+
_validate_inputs(%w[ body ], params)
|
|
98
|
+
|
|
99
|
+
patch_request("/repos/#{user}/#{repo}/issues/comments/#{comment_id}")
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Delete a comment
|
|
103
|
+
#
|
|
104
|
+
# = Examples
|
|
105
|
+
# github = Github.new
|
|
106
|
+
# github.issues.comments.delete 'user-name', 'repo-name', 'comment-id'
|
|
107
|
+
#
|
|
108
|
+
def delete(user_name, repo_name, comment_id, params={})
|
|
109
|
+
_update_user_repo_params(user_name, repo_name)
|
|
110
|
+
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
111
|
+
_validate_presence_of comment_id
|
|
112
|
+
|
|
113
|
+
_normalize_params_keys(params)
|
|
114
|
+
# _merge_mime_type(:issue_comment, params)
|
|
115
|
+
|
|
116
|
+
delete_request("/repos/#{user}/#{repo}/issues/comments/#{comment_id}", params)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
end # Issues::Comments
|
|
123
120
|
end # Github
|
|
@@ -1,54 +1,55 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
|
|
3
3
|
module Github
|
|
4
|
-
class Issues
|
|
5
|
-
|
|
4
|
+
class Issues::Events < API
|
|
5
|
+
|
|
6
|
+
# Creates new Issues::Events API
|
|
7
|
+
def initialize(options = {})
|
|
8
|
+
super(options)
|
|
9
|
+
end
|
|
6
10
|
|
|
7
11
|
# List events for an issue
|
|
8
12
|
#
|
|
9
13
|
# = Examples
|
|
10
|
-
#
|
|
11
|
-
#
|
|
14
|
+
# github = Github.new
|
|
15
|
+
# github.issues.events.list 'user-name', 'repo-name', 'issue-id'
|
|
12
16
|
#
|
|
13
17
|
# List events for a repository
|
|
14
18
|
#
|
|
15
19
|
# = Examples
|
|
16
|
-
#
|
|
17
|
-
#
|
|
20
|
+
# github = Github.new
|
|
21
|
+
# github.issues.events.list 'user-name', 'repo-name'
|
|
18
22
|
#
|
|
19
|
-
def
|
|
23
|
+
def list(user_name, repo_name, issue_id=nil, params={})
|
|
20
24
|
_update_user_repo_params(user_name, repo_name)
|
|
21
25
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
22
26
|
_normalize_params_keys(params)
|
|
23
27
|
|
|
24
28
|
response = if issue_id
|
|
25
|
-
|
|
29
|
+
get_request("/repos/#{user}/#{repo}/issues/#{issue_id}/events", params)
|
|
26
30
|
else
|
|
27
|
-
|
|
31
|
+
get_request("/repos/#{user}/#{repo}/issues/events", params)
|
|
28
32
|
end
|
|
29
33
|
return response unless block_given?
|
|
30
34
|
response.each { |el| yield el }
|
|
31
35
|
end
|
|
32
|
-
alias :
|
|
33
|
-
alias :issue_events :events
|
|
34
|
-
alias :repo_events :events
|
|
36
|
+
alias :all :list
|
|
35
37
|
|
|
36
38
|
# Get a single event
|
|
37
39
|
#
|
|
38
40
|
# = Examples
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
+
# github = Github.new
|
|
42
|
+
# github.issues.events.get 'user-name', 'repo-name', 'event-id'
|
|
41
43
|
#
|
|
42
|
-
def
|
|
44
|
+
def get(user_name, repo_name, event_id, params={})
|
|
43
45
|
_update_user_repo_params(user_name, repo_name)
|
|
44
46
|
_validate_user_repo_params(user, repo) unless user? && repo?
|
|
45
47
|
_validate_presence_of event_id
|
|
46
48
|
_normalize_params_keys(params)
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
get_request("/repos/#{user}/#{repo}/issues/events/#{event_id}")
|
|
49
51
|
end
|
|
50
|
-
alias :
|
|
52
|
+
alias :find :get
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
end # Issues
|
|
54
|
+
end # Issues::Events
|
|
54
55
|
end # Github
|