octokit 1.18.0 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. data/.document +1 -1
  2. data/.rspec +1 -0
  3. data/CHANGELOG.md +25 -0
  4. data/{LICENSE → LICENSE.md} +0 -0
  5. data/README.md +25 -8
  6. data/lib/faraday/response/raise_octokit_error.rb +4 -1
  7. data/lib/octokit/client.rb +6 -0
  8. data/lib/octokit/client/authorizations.rb +20 -7
  9. data/lib/octokit/client/commits.rb +120 -13
  10. data/lib/octokit/client/contents.rb +3 -4
  11. data/lib/octokit/client/downloads.rb +4 -3
  12. data/lib/octokit/client/emojis.rb +1 -1
  13. data/lib/octokit/client/events.rb +4 -4
  14. data/lib/octokit/client/gists.rb +33 -31
  15. data/lib/octokit/client/issues.rb +15 -15
  16. data/lib/octokit/client/labels.rb +13 -13
  17. data/lib/octokit/client/markdown.rb +2 -1
  18. data/lib/octokit/client/milestones.rb +6 -6
  19. data/lib/octokit/client/notifications.rb +222 -0
  20. data/lib/octokit/client/objects.rb +4 -4
  21. data/lib/octokit/client/organizations.rb +65 -20
  22. data/lib/octokit/client/pub_sub_hubbub.rb +2 -2
  23. data/lib/octokit/client/pulls.rb +91 -3
  24. data/lib/octokit/client/rate_limit.rb +20 -0
  25. data/lib/octokit/client/refs.rb +4 -4
  26. data/lib/octokit/client/repositories.rb +106 -37
  27. data/lib/octokit/client/say.rb +14 -0
  28. data/lib/octokit/client/statuses.rb +2 -2
  29. data/lib/octokit/client/users.rb +92 -24
  30. data/lib/octokit/connection.rb +21 -21
  31. data/lib/octokit/request.rb +47 -36
  32. data/lib/octokit/version.rb +1 -1
  33. data/octokit.gemspec +25 -25
  34. data/spec/fixtures/{v3/authorization.json → authorization.json} +0 -0
  35. data/spec/fixtures/{v3/authorizations.json → authorizations.json} +0 -0
  36. data/spec/fixtures/{v3/blob.json → blob.json} +0 -0
  37. data/spec/fixtures/{v3/blob_create.json → blob_create.json} +0 -0
  38. data/spec/fixtures/{v3/branches.json → branches.json} +0 -0
  39. data/spec/fixtures/{v3/collaborators.json → collaborators.json} +0 -0
  40. data/spec/fixtures/{v3/comment.json → comment.json} +0 -0
  41. data/spec/fixtures/{v3/comments.json → comments.json} +0 -0
  42. data/spec/fixtures/{v3/commit.json → commit.json} +0 -0
  43. data/spec/fixtures/{v3/commit_comment.json → commit_comment.json} +0 -0
  44. data/spec/fixtures/{v3/commit_comment_create.json → commit_comment_create.json} +0 -0
  45. data/spec/fixtures/{v3/commit_comment_update.json → commit_comment_update.json} +0 -0
  46. data/spec/fixtures/{v3/commit_comments.json → commit_comments.json} +0 -0
  47. data/spec/fixtures/{v3/commit_create.json → commit_create.json} +0 -0
  48. data/spec/fixtures/{v3/commits.json → commits.json} +0 -0
  49. data/spec/fixtures/{v3/compare.json → compare.json} +0 -0
  50. data/spec/fixtures/{v3/contents.json → contents.json} +0 -0
  51. data/spec/fixtures/{v3/contributors.json → contributors.json} +0 -0
  52. data/spec/fixtures/{v3/download.json → download.json} +0 -0
  53. data/spec/fixtures/{v3/download_create.json → download_create.json} +0 -0
  54. data/spec/fixtures/{v3/downloads.json → downloads.json} +0 -0
  55. data/spec/fixtures/{v3/emails.json → emails.json} +0 -0
  56. data/spec/fixtures/{v3/emojis.json → emojis.json} +0 -0
  57. data/spec/fixtures/{v3/followers.json → followers.json} +0 -0
  58. data/spec/fixtures/{v3/following.json → following.json} +0 -0
  59. data/spec/fixtures/{v3/forks.json → forks.json} +0 -0
  60. data/spec/fixtures/{v3/gist.json → gist.json} +0 -0
  61. data/spec/fixtures/{v3/gist_comment.json → gist_comment.json} +0 -0
  62. data/spec/fixtures/{v3/gist_comment_create.json → gist_comment_create.json} +0 -0
  63. data/spec/fixtures/{v3/gist_comment_update.json → gist_comment_update.json} +0 -0
  64. data/spec/fixtures/{v3/gist_comments.json → gist_comments.json} +0 -0
  65. data/spec/fixtures/{v3/gists.json → gists.json} +0 -0
  66. data/spec/fixtures/{v3/hook.json → hook.json} +0 -0
  67. data/spec/fixtures/{v3/hooks.json → hooks.json} +0 -0
  68. data/spec/fixtures/{v3/issue.json → issue.json} +0 -0
  69. data/spec/fixtures/{v3/issue_closed.json → issue_closed.json} +0 -0
  70. data/spec/fixtures/{v3/issue_event.json → issue_event.json} +0 -0
  71. data/spec/fixtures/{v3/issue_events.json → issue_events.json} +0 -0
  72. data/spec/fixtures/issue_full.json +38 -0
  73. data/spec/fixtures/{v3/issues.json → issues.json} +0 -0
  74. data/spec/fixtures/{v3/label.json → label.json} +0 -0
  75. data/spec/fixtures/{v3/labels.json → labels.json} +0 -0
  76. data/spec/fixtures/{v3/languages.json → languages.json} +0 -0
  77. data/spec/fixtures/{v3/list_commit_comments.json → list_commit_comments.json} +0 -0
  78. data/spec/fixtures/{v3/markdown_gfm → markdown_gfm} +0 -0
  79. data/spec/fixtures/{v3/merge.json → merge.json} +0 -0
  80. data/spec/fixtures/{v3/milestone.json → milestone.json} +0 -0
  81. data/spec/fixtures/{v3/milestones.json → milestones.json} +0 -0
  82. data/spec/fixtures/{v3/not_found.json → not_found.json} +0 -0
  83. data/spec/fixtures/notification_thread.json +32 -0
  84. data/spec/fixtures/notifications.json +32 -0
  85. data/spec/fixtures/{v3/organization-repositories.json → organization-repositories.json} +0 -0
  86. data/spec/fixtures/{v3/organization-repository.json → organization-repository.json} +0 -0
  87. data/spec/fixtures/{v3/organization.json → organization.json} +0 -0
  88. data/spec/fixtures/{v3/organization_members.json → organization_members.json} +0 -0
  89. data/spec/fixtures/{v3/organization_team_members.json → organization_team_members.json} +0 -0
  90. data/spec/fixtures/{v3/organization_team_repos.json → organization_team_repos.json} +0 -0
  91. data/spec/fixtures/{v3/organizations.json → organizations.json} +0 -0
  92. data/spec/fixtures/{v3/public_events.json → public_events.json} +0 -0
  93. data/spec/fixtures/{v3/public_gists.json → public_gists.json} +0 -0
  94. data/spec/fixtures/{v3/public_key.json → public_key.json} +0 -0
  95. data/spec/fixtures/public_key_update.json +5 -0
  96. data/spec/fixtures/{v3/public_keys.json → public_keys.json} +0 -0
  97. data/spec/fixtures/{v3/pull_created.json → pull_created.json} +0 -0
  98. data/spec/fixtures/{v3/pull_request.json → pull_request.json} +0 -0
  99. data/spec/fixtures/pull_request_comment.json +35 -0
  100. data/spec/fixtures/pull_request_comment_create.json +35 -0
  101. data/spec/fixtures/pull_request_comment_reply.json +35 -0
  102. data/spec/fixtures/pull_request_comment_update.json +35 -0
  103. data/spec/fixtures/{v3/pull_request_comments.json → pull_request_comments.json} +0 -0
  104. data/spec/fixtures/{v3/pull_request_commits.json → pull_request_commits.json} +0 -0
  105. data/spec/fixtures/{v3/pull_request_files.json → pull_request_files.json} +0 -0
  106. data/spec/fixtures/{v3/pull_request_merged.json → pull_request_merged.json} +0 -0
  107. data/spec/fixtures/{v3/pull_requests.json → pull_requests.json} +0 -0
  108. data/spec/fixtures/{v3/pull_update.json → pull_update.json} +0 -0
  109. data/spec/fixtures/{v3/readme.json → readme.json} +0 -0
  110. data/spec/fixtures/{v3/ref.json → ref.json} +0 -0
  111. data/spec/fixtures/{v3/ref_create.json → ref_create.json} +0 -0
  112. data/spec/fixtures/{v3/ref_update.json → ref_update.json} +0 -0
  113. data/spec/fixtures/{v3/refs.json → refs.json} +0 -0
  114. data/spec/fixtures/{v3/refs_tags.json → refs_tags.json} +0 -0
  115. data/spec/fixtures/{v3/repo_assignees.json → repo_assignees.json} +0 -0
  116. data/spec/fixtures/{v3/repo_events.json → repo_events.json} +0 -0
  117. data/spec/fixtures/{v3/repo_issues_events.json → repo_issues_events.json} +0 -0
  118. data/spec/fixtures/{v3/repositories.json → repositories.json} +0 -0
  119. data/spec/fixtures/{v3/repository.json → repository.json} +0 -0
  120. data/spec/fixtures/repository_notifications.json +32 -0
  121. data/spec/fixtures/say.txt +22 -0
  122. data/spec/fixtures/say_custom.txt +22 -0
  123. data/spec/fixtures/{v3/stargazers.json → stargazers.json} +0 -0
  124. data/spec/fixtures/{v3/starred.json → starred.json} +0 -0
  125. data/spec/fixtures/{v3/starred_gists.json → starred_gists.json} +0 -0
  126. data/spec/fixtures/{v3/status.json → status.json} +0 -0
  127. data/spec/fixtures/{v3/statuses.json → statuses.json} +0 -0
  128. data/spec/fixtures/subscribers.json +9 -0
  129. data/spec/fixtures/subscription.json +8 -0
  130. data/spec/fixtures/subscription_update.json +8 -0
  131. data/spec/fixtures/subscriptions.json +39 -0
  132. data/spec/fixtures/{v3/tag.json → tag.json} +0 -0
  133. data/spec/fixtures/{v3/tag_create.json → tag_create.json} +0 -0
  134. data/spec/fixtures/{v3/tags.json → tags.json} +0 -0
  135. data/spec/fixtures/{v3/team.json → team.json} +0 -0
  136. data/spec/fixtures/{v3/teams.json → teams.json} +0 -0
  137. data/spec/fixtures/thread_subscription.json +8 -0
  138. data/spec/fixtures/thread_subscription_update.json +8 -0
  139. data/spec/fixtures/{v3/tree.json → tree.json} +0 -0
  140. data/spec/fixtures/{v3/tree_create.json → tree_create.json} +0 -0
  141. data/spec/fixtures/{v3/user.json → user.json} +0 -0
  142. data/spec/fixtures/{v3/user_events.json → user_events.json} +0 -0
  143. data/spec/fixtures/validation_failed.json +11 -0
  144. data/spec/fixtures/{v3/watched.json → watched.json} +0 -0
  145. data/spec/fixtures/{v3/watchers.json → watchers.json} +0 -0
  146. data/spec/helper.rb +13 -2
  147. data/spec/octokit/client/authorizations_spec.rb +44 -7
  148. data/spec/octokit/client/commits_spec.rb +136 -11
  149. data/spec/octokit/client/contents_spec.rb +6 -3
  150. data/spec/octokit/client/downloads_spec.rb +5 -6
  151. data/spec/octokit/client/emojis_spec.rb +1 -1
  152. data/spec/octokit/client/events_spec.rb +5 -5
  153. data/spec/octokit/client/gists_spec.rb +20 -20
  154. data/spec/octokit/client/issue_events_spec.rb +2 -2
  155. data/spec/octokit/client/issues_spec.rb +25 -14
  156. data/spec/octokit/client/labels_spec.rb +18 -22
  157. data/spec/octokit/client/markdown_spec.rb +1 -1
  158. data/spec/octokit/client/milestones_spec.rb +8 -8
  159. data/spec/octokit/client/notifications_spec.rb +141 -0
  160. data/spec/octokit/client/objects_spec.rb +6 -6
  161. data/spec/octokit/client/organizations_spec.rb +65 -13
  162. data/spec/octokit/client/pub_sub_hubbub/service_hooks_spec.rb +4 -4
  163. data/spec/octokit/client/pub_sub_hubbub_spec.rb +3 -3
  164. data/spec/octokit/client/pulls_spec.rb +81 -10
  165. data/spec/octokit/client/refs_spec.rb +7 -7
  166. data/spec/octokit/client/repositories_spec.rb +86 -34
  167. data/spec/octokit/client/say_spec.rb +37 -0
  168. data/spec/octokit/client/statuses_spec.rb +2 -2
  169. data/spec/octokit/client/users_spec.rb +65 -16
  170. data/spec/octokit/client_spec.rb +37 -11
  171. data/spec/{repository_spec.rb → octokit/repository_spec.rb} +0 -0
  172. data/spec/octokit_spec.rb +1 -1
  173. metadata +240 -196
@@ -10,7 +10,7 @@ module Octokit
10
10
  # @example List all downloads for Github/Hubot
11
11
  # Octokit.downloads("github/hubot")
12
12
  def downloads(repo, options={})
13
- get("repos/#{Repository.new(repo)}/downloads", options, 3)
13
+ get("repos/#{Repository.new(repo)}/downloads", options)
14
14
  end
15
15
  alias :list_downloads :downloads
16
16
 
@@ -23,7 +23,7 @@ module Octokit
23
23
  # @example Get the "Robawt" download from Github/Hubot
24
24
  # Octokit.download("github/hubot")
25
25
  def download(repo, id, options={})
26
- get("repos/#{Repository.new(repo)}/downloads/#{id}", options, 3)
26
+ get("repos/#{Repository.new(repo)}/downloads/#{id}", options)
27
27
  end
28
28
 
29
29
  # Create a download in a repository
@@ -68,10 +68,11 @@ module Octokit
68
68
  # @param repo [String, Repository, Hash] A GitHub repository
69
69
  # @param id [Integer] ID of the download
70
70
  # @see http://developer.github.com/v3/repos/downloads/#delete-a-single-download
71
+ # @return [Boolean] Status
71
72
  # @example Get the "Robawt" download from Github/Hubot
72
73
  # Octokit.delete_download("github/hubot", 1234)
73
74
  def delete_download(repo, id)
74
- delete("repos/#{Repository.new(repo)}/downloads/#{id}", {}, 3, true, true, true)
75
+ request(:delete, "repos/#{Repository.new(repo)}/downloads/#{id}").status == 204
75
76
  end
76
77
 
77
78
  private
@@ -7,7 +7,7 @@ module Octokit
7
7
  # @example List all emojis
8
8
  # Octokit.emojis
9
9
  def emojis
10
- get("emojis", {}, 3)
10
+ get "emojis"
11
11
  end
12
12
  end
13
13
  end
@@ -8,7 +8,7 @@ module Octokit
8
8
  # @example List all pubilc events
9
9
  # Octokit.public_events
10
10
  def public_events(options={})
11
- get("events", options, 3)
11
+ get("events", options)
12
12
  end
13
13
 
14
14
  # List all user events
@@ -18,7 +18,7 @@ module Octokit
18
18
  # @example List all user events
19
19
  # Octokit.user_events("sferik")
20
20
  def user_events(user, options={})
21
- get("users/#{user}/events", options, 3)
21
+ get("users/#{user}/events", options)
22
22
  end
23
23
 
24
24
  # List events that a user has received
@@ -28,7 +28,7 @@ module Octokit
28
28
  # @example List all user received events
29
29
  # Octokit.received_events("sferik")
30
30
  def received_events(user, options={})
31
- get("users/#{user}/received_events", options, 3)
31
+ get("users/#{user}/received_events", options)
32
32
  end
33
33
 
34
34
  # List events for a repository
@@ -39,7 +39,7 @@ module Octokit
39
39
  # @example List events for a repository
40
40
  # Octokit.repository_events("sferik/rails_admin")
41
41
  def repository_events(repo, options={})
42
- get("repos/#{Repository.new(repo)}/events", options, 3)
42
+ get("repos/#{Repository.new(repo)}/events", options)
43
43
  end
44
44
  end
45
45
  end
@@ -13,9 +13,9 @@ module Octokit
13
13
  # @see http://developer.github.com/v3/gists/#list-gists
14
14
  def gists(username=nil, options={})
15
15
  if username.nil?
16
- get 'gists', options, 3
16
+ get 'gists', options
17
17
  else
18
- get "users/#{username}/gists", options, 3
18
+ get "users/#{username}/gists", options
19
19
  end
20
20
  end
21
21
  alias :list_gists :gists
@@ -27,14 +27,14 @@ module Octokit
27
27
  # Octokit.public_gists
28
28
  # @see http://developer.github.com/v3/gists/#list-gists
29
29
  def public_gists(options={})
30
- get 'gists/public', options, 3
30
+ get 'gists/public', options
31
31
  end
32
32
 
33
33
  # List the authenticated user’s starred gists
34
34
  #
35
35
  # @return [Array<Hashie::Mash>] A list of gists
36
36
  def starred_gists(options={})
37
- get 'gists/starred', options, 3
37
+ get 'gists/starred', options
38
38
  end
39
39
 
40
40
  # Get a single gist
@@ -43,7 +43,7 @@ module Octokit
43
43
  # @return [Hash::Mash] Gist information
44
44
  # @see http://developer.github.com/v3/gists/#get-a-single-gist
45
45
  def gist(gist, options={})
46
- get "gists/#{Gist.new gist}", options, 3
46
+ get "gists/#{Gist.new gist}", options
47
47
  end
48
48
 
49
49
  # Create a gist
@@ -53,11 +53,11 @@ module Octokit
53
53
  # @option options [Boolean] :public Sets gist visibility
54
54
  # @option options [Array<Hash>] :files Files that make up this gist. Keys
55
55
  # should be the filename, the value a Hash with a :content key with text
56
- # conent of the Gist.
56
+ # content of the Gist.
57
57
  # @return [Hashie::Mash] Newly created gist info
58
58
  # @see http://developer.github.com/v3/gists/#create-a-gist
59
59
  def create_gist(options={})
60
- post 'gists', options, 3
60
+ post 'gists', options
61
61
  end
62
62
 
63
63
  # Edit a gist
@@ -67,7 +67,7 @@ module Octokit
67
67
  # @option options [Boolean] :public Sets gist visibility
68
68
  # @option options [Array<Hash>] :files Files that make up this gist. Keys
69
69
  # should be the filename, the value a Hash with a :content key with text
70
- # conent of the Gist.
70
+ # content of the Gist.
71
71
  #
72
72
  # NOTE: All files from the previous version of the
73
73
  # gist are carried over by default if not included in the hash. Deletes
@@ -76,8 +76,9 @@ module Octokit
76
76
  # [Hashie::Mash] Newly created gist info
77
77
  # @see http://developer.github.com/v3/gists/#edit-a-gist
78
78
  def edit_gist(gist, options={})
79
- patch "gists/#{Gist.new gist}", options, 3
79
+ patch "gists/#{Gist.new gist}", options
80
80
  end
81
+
81
82
  #
82
83
  # Star a gist
83
84
  #
@@ -85,8 +86,7 @@ module Octokit
85
86
  # @return [Boolean] Indicates if gist is starred successfully
86
87
  # @see http://developer.github.com/v3/gists/#star-a-gist
87
88
  def star_gist(gist, options={})
88
- response = put("gists/#{Gist.new gist}/star", options, 3, true, true)
89
- response.status == 204
89
+ request(:put, "gists/#{Gist.new gist}/star", options).status == 204
90
90
  end
91
91
 
92
92
  # Unstar a gist
@@ -95,8 +95,7 @@ module Octokit
95
95
  # @return [Boolean] Indicates if gist is unstarred successfully
96
96
  # @see http://developer.github.com/v3/gists/#unstar-a-gist
97
97
  def unstar_gist(gist, options={})
98
- response = delete("gists/#{Gist.new gist}/star", options, 3, true, true)
99
- response.status == 204
98
+ request(:delete, "gists/#{Gist.new gist}/star", options).status == 204
100
99
  end
101
100
 
102
101
  # Check if a gist is starred
@@ -106,7 +105,7 @@ module Octokit
106
105
  # @see http://developer.github.com/v3/gists/#check-if-a-gist-is-starred
107
106
  def gist_starred?(gist, options={})
108
107
  begin
109
- get("gists/#{Gist.new gist}/star", options, 3, true, true)
108
+ get("gists/#{Gist.new gist}/star", options)
110
109
  return true
111
110
  rescue Octokit::NotFound
112
111
  return false
@@ -119,7 +118,7 @@ module Octokit
119
118
  # @return [Hashie::Mash] Data for the new gist
120
119
  # @see http://developer.github.com/v3/gists/#fork-a-gist
121
120
  def fork_gist(gist, options={})
122
- post "gists/#{Gist.new gist}/fork", options, 3
121
+ post "gists/#{Gist.new gist}/fork", options
123
122
  end
124
123
 
125
124
  # Delete a gist
@@ -128,76 +127,79 @@ module Octokit
128
127
  # @return [Boolean] Indicating success of deletion
129
128
  # @see http://developer.github.com/v3/gists/#delete-a-gist
130
129
  def delete_gist(gist, options={})
131
- response = delete("gists/#{Gist.new gist}", options, 3, true, true)
130
+ response = request(:delete, "gists/#{Gist.new gist}", options)
132
131
  response.status == 204
133
132
  end
134
133
 
135
134
  # List gist comments
136
135
  #
137
- # @param gist_id [Integer] Gist Id.
136
+ # @param gist_id [String] Gist Id.
138
137
  # @return [Array<Hashie::Mash>] Array of hashes representing comments.
139
138
  # @see http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist
140
139
  # @example
141
- # Octokit.gist_comments(3528645)
140
+ # Octokit.gist_comments('3528ae645')
142
141
  def gist_comments(gist_id, options={})
143
- get "gists/#{gist_id}/comments", options, 3
142
+ get "gists/#{gist_id}/comments", options
144
143
  end
145
144
 
146
145
  # Get gist comment
147
146
  #
147
+ # @param gist_id [String] Id of the gist.
148
148
  # @param gist_comment_id [Integer] Id of the gist comment.
149
149
  # @return [Hashie::Mash] Hash representing gist comment.
150
150
  # @see http://developer.github.com/v3/gists/comments/#get-a-single-comment
151
151
  # @example
152
- # Octokit.gist_comment(451398)
153
- def gist_comment(gist_comment_id, options={})
154
- get "gists/comments/#{gist_comment_id}", options, 3
152
+ # Octokit.gist_comment('208sdaz3', 1451398)
153
+ def gist_comment(gist_id, gist_comment_id, options={})
154
+ get "gists/#{gist_id}/comments/#{gist_comment_id}", options
155
155
  end
156
156
 
157
157
  # Create gist comment
158
158
  #
159
159
  # Requires authenticated client.
160
160
  #
161
- # @param gist_id [Integer] Id of the gist.
161
+ # @param gist_id [String] Id of the gist.
162
162
  # @param comment [String] Comment contents.
163
163
  # @return [Hashie::Mash] Hash representing the new comment.
164
164
  # @see Octokit::Client
165
165
  # @see http://developer.github.com/v3/gists/comments/#create-a-comment
166
166
  # @example
167
- # @client.create_gist_comment(3528645, 'This is very helpful.')
167
+ # @client.create_gist_comment('3528645', 'This is very helpful.')
168
168
  def create_gist_comment(gist_id, comment, options={})
169
169
  options.merge!({:body => comment})
170
- post "gists/#{gist_id}/comments", options, 3
170
+ post "gists/#{gist_id}/comments", options
171
171
  end
172
172
 
173
173
  # Update gist comment
174
174
  #
175
175
  # Requires authenticated client
176
176
  #
177
+ # @param gist_id [String] Id of the gist.
177
178
  # @param gist_comment_id [Integer] Id of the gist comment to update.
178
179
  # @param comment [String] Updated comment contents.
179
180
  # @return [Hashie::Mash] Hash representing the updated comment.
180
181
  # @see Octokit::Client
181
182
  # @see http://developer.github.com/v3/gists/comments/#edit-a-comment
182
183
  # @example
183
- # @client.update_gist_comment(3528645, ':heart:')
184
- def update_gist_comment(gist_comment_id, comment, options={})
184
+ # @client.update_gist_comment('208sdaz3', '3528645', ':heart:')
185
+ def update_gist_comment(gist_id, gist_comment_id, comment, options={})
185
186
  options.merge!({:body => comment})
186
- patch "gists/comments/#{gist_comment_id}", options, 3
187
+ patch "gists/#{gist_id}/comments/#{gist_comment_id}", options
187
188
  end
188
189
 
189
190
  # Delete gist comment
190
191
  #
191
192
  # Requires authenticated client.
192
193
  #
194
+ # @param gist_id [String] Id of the gist.
193
195
  # @param gist_comment_id [Integer] Id of the gist comment to delete.
194
196
  # @return [Boolean] True if comment deleted, false otherwise.
195
197
  # @see Octokit::Client
196
198
  # @see http://developer.github.com/v3/gists/comments/#delete-a-comment
197
199
  # @example
198
- # @client.delete_gist_comment(586399)
199
- def delete_gist_comment(gist_comment_id, options={})
200
- delete("gists/comments/#{gist_comment_id}", options, 3, true, true).status == 204
200
+ # @client.delete_gist_comment('208sdaz3', '586399')
201
+ def delete_gist_comment(gist_id, gist_comment_id, options={})
202
+ request(:delete, "gists/#{gist_id}/comments/#{gist_comment_id}", options).status == 204
201
203
  end
202
204
 
203
205
  end
@@ -12,7 +12,7 @@ module Octokit
12
12
  # @example Search for 'test' in the open issues for sferik/rails_admin
13
13
  # Octokit.search_issues("sferik/rails_admin", 'test', 'open')
14
14
  def search_issues(repo, search_term, state='open', options={})
15
- get("legacy/issues/search/#{Repository.new(repo)}/#{state}/#{search_term}", options, 3)['issues']
15
+ get("legacy/issues/search/#{Repository.new(repo)}/#{state}/#{search_term}", options)['issues']
16
16
  end
17
17
 
18
18
  # List issues for a the authenticated user or repository
@@ -39,7 +39,7 @@ module Octokit
39
39
  path = ''
40
40
  path = "repos/#{Repository.new(repository)}" if repository
41
41
  path += "/issues"
42
- get(path, options, 3)
42
+ get(path, options)
43
43
  end
44
44
  alias :issues :list_issues
45
45
 
@@ -53,7 +53,7 @@ module Octokit
53
53
  # @example Create a new Issues for a repository
54
54
  # Octokit.create_issue("sferik/rails_admin")
55
55
  def create_issue(repo, title, body, options={})
56
- post("repos/#{Repository.new(repo)}/issues", options.merge({:title => title, :body => body}), 3)
56
+ post("repos/#{Repository.new(repo)}/issues", options.merge({:title => title, :body => body}))
57
57
  end
58
58
  alias :open_issue :create_issue
59
59
 
@@ -66,7 +66,7 @@ module Octokit
66
66
  # @example Get issue #25 from pengwynn/octokit
67
67
  # Octokit.issue("pengwynn/octokit", "25")
68
68
  def issue(repo, number, options={})
69
- get("repos/#{Repository.new(repo)}/issues/#{number}", options, 3)
69
+ get("repos/#{Repository.new(repo)}/issues/#{number}", options)
70
70
  end
71
71
 
72
72
  # Close an issue
@@ -80,7 +80,7 @@ module Octokit
80
80
  # @example Close Issue #25 from pengwynn/octokit
81
81
  # Octokit.close_issue("pengwynn/octokit", "25")
82
82
  def close_issue(repo, number, options={})
83
- post("repos/#{Repository.new(repo)}/issues/#{number}", options.merge({:state => "closed"}), 3)
83
+ post("repos/#{Repository.new(repo)}/issues/#{number}", options.merge({:state => "closed"}))
84
84
  end
85
85
 
86
86
  # Reopen an issue
@@ -94,7 +94,7 @@ module Octokit
94
94
  # @example Reopen Issue #25 from pengwynn/octokit
95
95
  # Octokit.reopen_issue("pengwynn/octokit", "25")
96
96
  def reopen_issue(repo, number, options={})
97
- post("repos/#{Repository.new(repo)}/issues/#{number}", options.merge({:state => "open"}), 3)
97
+ post("repos/#{Repository.new(repo)}/issues/#{number}", options.merge({:state => "open"}))
98
98
  end
99
99
 
100
100
  # Update an issue
@@ -110,7 +110,7 @@ module Octokit
110
110
  # @example Change the title of Issue #25
111
111
  # Octokit.update_issue("pengwynn/octokit", "25", "A new title", "the same body"")
112
112
  def update_issue(repo, number, title, body, options={})
113
- post("repos/#{Repository.new(repo)}/issues/#{number}", options.merge({:title => title, :body => body}), 3)
113
+ post("repos/#{Repository.new(repo)}/issues/#{number}", options.merge({:title => title, :body => body}))
114
114
  end
115
115
 
116
116
  # Get all comments attached to an issue
@@ -122,7 +122,7 @@ module Octokit
122
122
  # @example Get comments for issue #25 from pengwynn/octokit
123
123
  # Octokit.issue_comments("pengwynn/octokit", "25")
124
124
  def issue_comments(repo, number, options={})
125
- get("repos/#{Repository.new(repo)}/issues/#{number}/comments", options, 3)
125
+ get("repos/#{Repository.new(repo)}/issues/#{number}/comments", options)
126
126
  end
127
127
 
128
128
  # Get a single comment attached to an issue
@@ -134,7 +134,7 @@ module Octokit
134
134
  # @example Get comments for issue #25 from pengwynn/octokit
135
135
  # Octokit.issue_comments("pengwynn/octokit", "25")
136
136
  def issue_comment(repo, number, options={})
137
- get("repos/#{Repository.new(repo)}/issues/comments/#{number}", options, 3)
137
+ get("repos/#{Repository.new(repo)}/issues/comments/#{number}", options)
138
138
  end
139
139
 
140
140
  # Add a comment to an issue
@@ -147,7 +147,7 @@ module Octokit
147
147
  # @example Add the comment "Almost to v1" to Issue #23 on pengwynn/octokit
148
148
  # Octokit.add_comment("pengwynn/octokit", 23, "Almost to v1")
149
149
  def add_comment(repo, number, comment, options={})
150
- post("repos/#{Repository.new(repo)}/issues/#{number}/comments", options.merge({:body => comment}), 3)
150
+ post("repos/#{Repository.new(repo)}/issues/#{number}/comments", options.merge({:body => comment}))
151
151
  end
152
152
 
153
153
  # Update a single comment on an issue
@@ -160,19 +160,19 @@ module Octokit
160
160
  # @example Update the comment "I've started this on my 25-issue-comments-v3 fork" on Issue #25 on pengwynn/octokit
161
161
  # Octokit.update_comment("pengwynn/octokit", 25, "Almost to v1, added this on my fork")
162
162
  def update_comment(repo, number, comment, options={})
163
- post("repos/#{Repository.new(repo)}/issues/comments/#{number}", options.merge({:body => comment}), 3)
163
+ post("repos/#{Repository.new(repo)}/issues/comments/#{number}", options.merge({:body => comment}))
164
164
  end
165
165
 
166
166
  # Delete a single comment
167
167
  #
168
168
  # @param repo [String, Repository, Hash] A GitHub repository
169
169
  # @param number [Integer] Comment number
170
- # @return [Response] A response object with status
170
+ # @return [Boolean] Success
171
171
  # @see http://developer.github.com/v3/issues/comments/#delete-a-comment
172
172
  # @example Delete the comment "I've started this on my 25-issue-comments-v3 fork" on Issue #25 on pengwynn/octokit
173
173
  # Octokit.delete_comment("pengwynn/octokit", 1194549)
174
174
  def delete_comment(repo, number, options={})
175
- delete("repos/#{Repository.new(repo)}/issues/comments/#{number}", options, 3, true, true)
175
+ request(:delete, "repos/#{Repository.new(repo)}/issues/comments/#{number}", options).status == 204
176
176
  end
177
177
 
178
178
 
@@ -186,7 +186,7 @@ module Octokit
186
186
  # @example List all issues events for issue #38 on pengwynn/octokit
187
187
  # Octokit.issue_events("pengwynn/octokit", 38)
188
188
  def issue_events(repo, number, options={})
189
- get("repos/#{Repository.new(repo)}/issues/#{number}/events", options, 3)
189
+ get("repos/#{Repository.new(repo)}/issues/#{number}/events", options)
190
190
  end
191
191
 
192
192
  # Get information on a single Issue Event
@@ -199,7 +199,7 @@ module Octokit
199
199
  # @example Get Event information for ID 3094334 (a pull request was closed)
200
200
  # Octokit.issue_event("pengwynn/octokit", 3094334)
201
201
  def issue_event(repo, number, options={})
202
- get("repos/#{Repository.new(repo)}/issues/events/#{number}", options, 3)
202
+ get("repos/#{Repository.new(repo)}/issues/events/#{number}", options)
203
203
  end
204
204
 
205
205
  end
@@ -12,7 +12,7 @@ module Octokit
12
12
  # @example List labels for pengwynn/octokit
13
13
  # Octokit.labels("pengwynn/octokit")
14
14
  def labels(repo, options={})
15
- get("repos/#{Repository.new(repo)}/labels", options, 3)
15
+ get("repos/#{Repository.new(repo)}/labels", options)
16
16
  end
17
17
 
18
18
  # Get single label for a repository
@@ -24,7 +24,7 @@ module Octokit
24
24
  # @example Get the "V3 Addition" label from pengwynn/octokit
25
25
  # Octokit.labels("pengwynn/octokit")
26
26
  def label(repo, name, options={})
27
- get("repos/#{Repository.new(repo)}/labels/#{CGI.escape(name)}", options, 3)
27
+ get("repos/#{Repository.new(repo)}/labels/#{CGI.escape(name)}", options)
28
28
  end
29
29
 
30
30
  # Add a label to a repository
@@ -37,7 +37,7 @@ module Octokit
37
37
  # @example Add a new label "Version 1.0" with color "#cccccc"
38
38
  # Octokit.add_label("pengwynn/octokit", "Version 1.0", "cccccc")
39
39
  def add_label(repo, label, color="ffffff", options={})
40
- post("repos/#{Repository.new(repo)}/labels", options.merge({:name => label, :color => color}), 3)
40
+ post("repos/#{Repository.new(repo)}/labels", options.merge({:name => label, :color => color}))
41
41
  end
42
42
 
43
43
  # Update a label
@@ -52,7 +52,7 @@ module Octokit
52
52
  # @example Update the label "Version 1.0" with new color "#cceeaa"
53
53
  # Octokit.update_label("pengwynn/octokit", "Version 1.0", {:color => "cceeaa"})
54
54
  def update_label(repo, label, options={})
55
- post("repos/#{Repository.new(repo)}/labels/#{CGI.escape(label)}", options, 3)
55
+ post("repos/#{Repository.new(repo)}/labels/#{CGI.escape(label)}", options)
56
56
  end
57
57
 
58
58
  # Delete a label from a repository.
@@ -61,13 +61,13 @@ module Octokit
61
61
  #
62
62
  # @param repo [String, Repository, Hash] A GitHub repository
63
63
  # @param label [String] String name of the label
64
- # @return [Response] A Faraday Response object
64
+ # @return [Boolean] Success
65
65
  # @see http://developer.github.com/v3/issues/labels/#delete-a-label
66
66
  # @see http://rubydoc.info/gems/faraday/0.5.3/Faraday/Response
67
67
  # @example Delete the label "Version 1.0" from the repository.
68
68
  # Octokit.delete_label!("pengwynn/octokit", "Version 1.0")
69
69
  def delete_label!(repo, label, options={})
70
- delete("repos/#{Repository.new(repo)}/labels/#{CGI.escape(label)}", options, 3, true, true)
70
+ request(:delete, "repos/#{Repository.new(repo)}/labels/#{CGI.escape(label)}", options).status == 204
71
71
  end
72
72
 
73
73
  # Remove a label from an Issue
@@ -83,7 +83,7 @@ module Octokit
83
83
  # @example Remove the label "Version 1.0" from the repository.
84
84
  # Octokit.remove_label("pengwynn/octokit", 23, "Version 1.0")
85
85
  def remove_label(repo, number, label, options={})
86
- delete("repos/#{Repository.new(repo)}/issues/#{number}/labels/#{CGI.escape(label)}", options, 3, true)
86
+ delete("repos/#{Repository.new(repo)}/issues/#{number}/labels/#{CGI.escape(label)}", options)
87
87
  end
88
88
 
89
89
  # Remove all label from an Issue
@@ -92,12 +92,12 @@ module Octokit
92
92
  #
93
93
  # @param repo [String, Repository, Hash] A GitHub repository
94
94
  # @param number [String] Number ID of the issue
95
- # @return [Array] A list of the labels currently on the issue
95
+ # @return [Boolean] Success of operation
96
96
  # @see http://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue
97
97
  # @example Remove all labels from Issue #23
98
98
  # Octokit.remove_all_labels("pengwynn/octokit", 23)
99
99
  def remove_all_labels(repo, number, options={})
100
- delete("repos/#{Repository.new(repo)}/issues/#{number}/labels", options, 3, true, true)
100
+ request(:delete, "repos/#{Repository.new(repo)}/issues/#{number}/labels", options).status == 204
101
101
  end
102
102
 
103
103
  # List labels for a given issue
@@ -109,7 +109,7 @@ module Octokit
109
109
  # @example List labels for pengwynn/octokit
110
110
  # Octokit.labels("pengwynn/octokit")
111
111
  def labels_for_issue(repo, number, options={})
112
- get("repos/#{Repository.new(repo)}/issues/#{number}/labels", options, 3)
112
+ get("repos/#{Repository.new(repo)}/issues/#{number}/labels", options)
113
113
  end
114
114
 
115
115
  # Add label(s) to an Issue
@@ -122,7 +122,7 @@ module Octokit
122
122
  # @example Add two labels for pengwynn/octokit
123
123
  # Octokit.add_labels_to_an_issue("pengwynn/octokit", 10, ['V3 Transition', 'Improvement'])
124
124
  def add_labels_to_an_issue(repo, number, labels)
125
- post("repos/#{Repository.new(repo)}/issues/#{number}/labels", labels, 3)
125
+ post("repos/#{Repository.new(repo)}/issues/#{number}/labels", labels)
126
126
  end
127
127
 
128
128
  # Replace all labels on an Issue
@@ -135,7 +135,7 @@ module Octokit
135
135
  # @example Replace labels for pengwynn/octokit Issue #10
136
136
  # Octokit.replace_all_labels("pengwynn/octokit", 10, ['V3 Transition', 'Improvement'])
137
137
  def replace_all_labels(repo, number, labels, options={})
138
- put("repos/#{Repository.new(repo)}/issues/#{number}/labels", labels, 3)
138
+ put("repos/#{Repository.new(repo)}/issues/#{number}/labels", labels)
139
139
  end
140
140
 
141
141
  # Get labels for every issue in a milestone
@@ -147,7 +147,7 @@ module Octokit
147
147
  # @example List all labels for milestone #2 on pengwynn/octokit
148
148
  # Octokit.labels_for_milestone("pengwynn/octokit", 2)
149
149
  def labels_for_milestone(repo, number, options={})
150
- get("repos/#{Repository.new(repo)}/milestones/#{number}/labels", options, 3)
150
+ get("repos/#{Repository.new(repo)}/milestones/#{number}/labels", options)
151
151
  end
152
152
 
153
153
  end