github_api_v3 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -6
  3. data/lib/github_api_v3/client/feeds.rb +1 -1
  4. data/lib/github_api_v3/client/gists.rb +10 -10
  5. data/lib/github_api_v3/client/issues.rb +8 -8
  6. data/lib/github_api_v3/client/markdown.rb +1 -1
  7. data/lib/github_api_v3/client/oauth.rb +101 -0
  8. data/lib/github_api_v3/client/orgs.rb +22 -22
  9. data/lib/github_api_v3/client/pull_requests.rb +14 -14
  10. data/lib/github_api_v3/client/repos.rb +23 -23
  11. data/lib/github_api_v3/client/stats.rb +5 -5
  12. data/lib/github_api_v3/client/users.rb +30 -20
  13. data/lib/github_api_v3/client.rb +73 -64
  14. data/lib/github_api_v3/error.rb +20 -2
  15. data/lib/github_api_v3/version.rb +1 -1
  16. data/lib/github_api_v3.rb +2 -2
  17. data/spec/cassettes/GitHub_Client_Gists/_create_gist/creates_a_gist.json +1 -1
  18. data/spec/cassettes/GitHub_Client_Gists/_create_gist_comment/creates_the_comment.json +1 -1
  19. data/spec/cassettes/GitHub_Client_Gists/_create_gist_comment/returns_comment_information_after_creation.json +1 -1
  20. data/spec/cassettes/GitHub_Client_Gists/_delete_gist/deletes_a_gist.json +1 -1
  21. data/spec/cassettes/GitHub_Client_Gists/_delete_gist_comment/deletes_the_comment.json +1 -1
  22. data/spec/cassettes/GitHub_Client_Gists/_delete_gist_comment/returns_true_or_false.json +1 -1
  23. data/spec/cassettes/GitHub_Client_Gists/_edit_gist/edits_a_gist.json +1 -1
  24. data/spec/cassettes/GitHub_Client_Gists/_edit_gist_comment/edits_the_comment.json +1 -1
  25. data/spec/cassettes/GitHub_Client_Gists/_edit_gist_comment/returns_comment_information_after_editing.json +1 -1
  26. data/spec/cassettes/GitHub_Client_Gists/_fork_gist/forks_a_gist.json +1 -1
  27. data/spec/cassettes/GitHub_Client_Gists/_fork_gist/returns_false_when_not_found.json +1 -1
  28. data/spec/cassettes/GitHub_Client_Gists/_gist/returns_a_404_when_not_found.json +1 -1
  29. data/spec/cassettes/GitHub_Client_Gists/_gist/returns_gist_information.json +1 -1
  30. data/spec/cassettes/GitHub_Client_Gists/_gist_comment/returns_a_404_when_not_found.json +1 -1
  31. data/spec/cassettes/GitHub_Client_Gists/_gist_comment/returns_a_comment.json +1 -1
  32. data/spec/cassettes/GitHub_Client_Gists/_gist_comments/returns_a_404_when_not_found.json +1 -1
  33. data/spec/cassettes/GitHub_Client_Gists/_gist_comments/returns_a_list_of_comments.json +1 -1
  34. data/spec/cassettes/GitHub_Client_Gists/_gist_starred_/returns_false_when_not_found.json +1 -1
  35. data/spec/cassettes/GitHub_Client_Gists/_gist_starred_/should_return_true_or_false.json +1 -1
  36. data/spec/cassettes/GitHub_Client_Gists/_gists/returns_an_array_of_gists.json +1 -1
  37. data/spec/cassettes/GitHub_Client_Gists/_gists/returns_an_array_of_gists_for_authenticated_user.json +1 -1
  38. data/spec/cassettes/GitHub_Client_Gists/_gists/returns_public_gists_for_unauthenticated_user.json +1 -1
  39. data/spec/cassettes/GitHub_Client_Gists/_star_gist/returns_false_when_not_found.json +1 -1
  40. data/spec/cassettes/GitHub_Client_Gists/_star_gist/stars_a_gist.json +1 -1
  41. data/spec/cassettes/GitHub_Client_Gists/_unstar_gist/returns_false_when_not_found.json +1 -1
  42. data/spec/cassettes/GitHub_Client_Gists/_unstar_gist/unstars_a_gist.json +1 -1
  43. data/spec/cassettes/GitHub_Client_Issues/_issues/returns_an_array_of_issues.json +1 -1
  44. data/spec/cassettes/GitHub_Client_Issues/_issues/returns_the_correct_information.json +1 -1
  45. data/spec/cassettes/GitHub_Client_OAuth/_authorization/returns_a_404_if_using_access_token_authentication.json +1 -0
  46. data/spec/cassettes/GitHub_Client_OAuth/_authorization/returns_a_404_if_using_no_authentication.json +1 -0
  47. data/spec/cassettes/GitHub_Client_OAuth/_authorization/returns_a_404_when_not_found.json +1 -0
  48. data/spec/cassettes/GitHub_Client_OAuth/_authorization/returns_authorization_information.json +1 -0
  49. data/spec/cassettes/GitHub_Client_OAuth/_authorization/returns_the_correct_information.json +1 -0
  50. data/spec/cassettes/GitHub_Client_OAuth/_authorizations/returns_a_404_if_using_access_token_authentication.json +1 -0
  51. data/spec/cassettes/GitHub_Client_OAuth/_authorizations/returns_a_404_if_using_no_authentication.json +1 -0
  52. data/spec/cassettes/GitHub_Client_OAuth/_authorizations/returns_a_list_of_authorizations.json +1 -0
  53. data/spec/cassettes/GitHub_Client_OAuth/_authorizations/returns_the_correct_array.json +1 -0
  54. data/spec/cassettes/GitHub_Client_OAuth/_create_authorization/creates_the_correct_authorization.json +1 -0
  55. data/spec/cassettes/GitHub_Client_OAuth/_create_authorization/returns_authorization_information_hash.json +1 -0
  56. data/spec/cassettes/GitHub_Client_OAuth/_delete_authorization/deletes_the_authorization.json +1 -0
  57. data/spec/cassettes/GitHub_Client_OAuth/_delete_authorization/returns_true.json +1 -0
  58. data/spec/cassettes/GitHub_Client_OAuth/_update_authorization/returns_authorization_information_hash.json +1 -0
  59. data/spec/cassettes/GitHub_Client_OAuth/_update_authorization/updates_the_authorization.json +1 -0
  60. data/spec/cassettes/GitHub_Client_Users/_follows_/returns_false_when_not_following.json +1 -1
  61. data/spec/cassettes/GitHub_Client_Users/_follows_/returns_true_when_following.json +1 -1
  62. data/spec/cassettes/GitHub_Client_Users/_rate_limit/returns_authenticated_rate_limit_information.json +1 -0
  63. data/spec/cassettes/GitHub_Client_Users/_rate_limit/returns_unauthenticated_rate_limit_information.json +1 -0
  64. data/spec/config.sample.yml +3 -1
  65. data/spec/github_api_v3/client/gists_spec.rb +25 -25
  66. data/spec/github_api_v3/client/oauth_spec.rb +87 -0
  67. data/spec/github_api_v3/client/users_spec.rb +16 -0
  68. data/spec/spec_helper.rb +21 -11
  69. metadata +38 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0193a85554d500cd6905e14f3b3d97262b50de5
4
- data.tar.gz: 8416fae09ec48b08163df81b3789352f38f66329
3
+ metadata.gz: 628f1717207bf3404efc1ebee6d34bbb7a135e6b
4
+ data.tar.gz: 060b04ffedc0db2cb8fbe750bfef26e72c6dc417
5
5
  SHA512:
6
- metadata.gz: d6fa08d4bf5c32ce3a86d5435c3b103040ac29804e03409c3af27671918a58311d669fc9fec8230b6a6bd50b24ec07710421ae001b2dc8edaa178ae0946049e7
7
- data.tar.gz: ea2f5b85f8d29fd3c0c0824e1dcbb2c2b513ec68931e2162b15846b26bc4530179d7ac7684654a90ec423fd8dfb44ca5be545fe8cd0f6fe9b316b43c4a9fd7c9
6
+ metadata.gz: ba7ac164b2f4d491ce4473c4ad69f7a3a3d5b29b05141d35793b216b7db74ecb5af28a5ed05cd62a9ea311453e19df7a8e31c41eddd336daffa665e5ce205ad1
7
+ data.tar.gz: c91803123c73b990fa26cb9d5ef69b38a4594a546788f4386dbab19f03b759dc5adfd1139250549e884467e3e5109ae06855668cf2c8cf6794d51b0acbfc7294
data/README.md CHANGED
@@ -24,7 +24,7 @@ require 'github_api_v3'
24
24
 
25
25
  ### Unauthenticated Requests
26
26
 
27
- There are multiple different unauthenticated requests to the API. These are performed when no credentials are given, and usually start with `GitHub`.
27
+ There are multiple different unauthenticated requests to the API. These are performed when no credentials are given, and are shown below starting with `GitHub`. Unauthenticated methods can certainly be called from an authenticated client, and this is recommended as to not reach the hourly [rate limit](http://developer.github.com/v3/#rate-limiting).
28
28
 
29
29
 
30
30
  ### Authenticated Requests
@@ -32,7 +32,13 @@ There are multiple different unauthenticated requests to the API. These are perf
32
32
  Some methods, such as retrieving private repos or emails, require authentication. To create one of these requests, you'll need to pass in your login and access token. You can create a personal access token on your [account page](https://github.com/settings/applications).
33
33
 
34
34
  ```ruby
35
- client = GitHub::Client.new(login: 'username', access_token: 'abcdefghijklmnopqrstuvwxyz12345')
35
+ # Create a new client using username and access token.
36
+ client = GitHub.client(
37
+ :login => 'username',
38
+ :access_token => 'bf215181b5140522137b3d4f6b73544a'
39
+ )
40
+
41
+ # Authenticated methods
36
42
  client.emails # => ["email@example.com", "email2@example.com"]
37
43
  client.repos # => #<Array:0x007fb8aa0d1a00>
38
44
  client.follow('matz') # => true
@@ -90,6 +96,10 @@ client.notifications
90
96
  client.watching
91
97
  client.starring
92
98
 
99
+ # Get a client's rate limit
100
+ GitHub.rate_limit
101
+ client.rate_limit
102
+
93
103
  # etc...
94
104
  ```
95
105
  You can find the available attributes [here](http://developer.github.com/v3/users/#get-a-single-user). Check the [Users documentation](http://rdoc.info/gems/github_api_v3/GitHub/Client/Users) for the gem for a complete list and more examples.
@@ -179,9 +189,9 @@ GitHub.gist(1234567)
179
189
 
180
190
  # Create a gist
181
191
  client.create_gist(
182
- files: {"file1.txt" => { content: "File contents" }},
183
- description: "Gist description",
184
- public: "false"
192
+ :files => { "file1.txt" => { content: "File contents" } },
193
+ :description => "Gist description",
194
+ :public => "false"
185
195
  )
186
196
 
187
197
  # Check if a gist is starred
@@ -241,7 +251,7 @@ $ rspec spec/
241
251
 
242
252
  ## To Do
243
253
 
244
- The better question is... What's not to do? Any functionality of the API listed at [developer.github.com](http://developer.github.com/) that isn't currently in effect.
254
+ Any functionality of the API listed at [developer.github.com](http://developer.github.com/) that hasn't currently been implemented.
245
255
 
246
256
  Some main missing functionality:
247
257
  * A good bit of the [Repos API](http://developer.github.com/v3/repos/), such as:
@@ -12,7 +12,7 @@ module GitHub
12
12
  # @return [Hash] Feed information.
13
13
  # @see http://developer.github.com/v3/activity/feeds/#list-feeds
14
14
  def feeds
15
- get "/feeds", auth_params
15
+ get "/feeds"
16
16
  end
17
17
 
18
18
  end
@@ -52,7 +52,7 @@ module GitHub
52
52
  # client.create_gist(files: {"file1.txt" => { content: "File contents" }}, description: "Gist description", public: "false")
53
53
  def create_gist(files={}, options={:public => true})
54
54
  options.merge!(files)
55
- post "/gists", auth_params, options
55
+ post "/gists", body: options
56
56
  end
57
57
 
58
58
  # Edit a gist
@@ -67,7 +67,7 @@ module GitHub
67
67
  # @return [Hash] Gist information.
68
68
  def edit_gist(id, files={}, options={:public => true})
69
69
  options.merge!(files)
70
- patch "/gists/#{id}", auth_params, options
70
+ patch "/gists/#{id}", body: options
71
71
  end
72
72
 
73
73
  # Check if a gist is starred.
@@ -78,7 +78,7 @@ module GitHub
78
78
  # @return [Boolean] True if it is starred, false if not.
79
79
  # @see http://developer.github.com/v3/gists/#check-if-a-gist-is-starred
80
80
  def gist_starred?(id)
81
- boolean_get "/gists/#{id}/star", auth_params
81
+ boolean_request :get, "/gists/#{id}/star"
82
82
  end
83
83
 
84
84
  # Star a gist.
@@ -91,7 +91,7 @@ module GitHub
91
91
  # @example
92
92
  # client.star_gist(5928712)
93
93
  def star_gist(id)
94
- boolean_put "/gists/#{id}/star", auth_params
94
+ boolean_request :put, "/gists/#{id}/star"
95
95
  end
96
96
 
97
97
  # Unstar a gist.
@@ -104,7 +104,7 @@ module GitHub
104
104
  # @example
105
105
  # client.unstar_gist(5928712)
106
106
  def unstar_gist(id)
107
- boolean_delete "/gists/#{id}/star", auth_params
107
+ boolean_request :delete, "/gists/#{id}/star"
108
108
  end
109
109
 
110
110
  # Fork a gist.
@@ -117,7 +117,7 @@ module GitHub
117
117
  # @example
118
118
  # client.fork_gist(5928712)
119
119
  def fork_gist(id)
120
- boolean_post "/gists/#{id}/fork", auth_params, {}
120
+ boolean_request :post, "/gists/#{id}/fork"
121
121
  end
122
122
 
123
123
  # Delete a gist.
@@ -129,7 +129,7 @@ module GitHub
129
129
  # @example
130
130
  # client.delete_gist(5928712)
131
131
  def delete_gist(id)
132
- boolean_delete "/gists/#{id}", auth_params
132
+ boolean_request :delete, "/gists/#{id}"
133
133
  end
134
134
 
135
135
  # List comments on a gist.
@@ -166,7 +166,7 @@ module GitHub
166
166
  # @example
167
167
  # client.create_gist_comment(5928712, 'Awesome!')
168
168
  def create_gist_comment(id, comment)
169
- post "/gists/#{id}/comments", auth_params, { body: comment }
169
+ post "/gists/#{id}/comments", body: { body: comment }
170
170
  end
171
171
 
172
172
  # Edit an existing gist comment.
@@ -181,7 +181,7 @@ module GitHub
181
181
  # @example
182
182
  # client.edit_gist_comment(5928712, 889239, 'Even more awesome!')
183
183
  def edit_gist_comment(id, comment_id, comment)
184
- patch "/gists/#{id}/comments/#{comment_id}", auth_params, { body: comment }
184
+ patch "/gists/#{id}/comments/#{comment_id}", body: { body: comment }
185
185
  end
186
186
 
187
187
  # Delete a gist comment.
@@ -195,7 +195,7 @@ module GitHub
195
195
  # @example
196
196
  # client.delete_gist_comment(5928712, 889239)
197
197
  def delete_gist_comment(id, comment_id)
198
- boolean_delete "/gists/#{id}/comments/#{comment_id}", auth_params
198
+ boolean_request :delete, "/gists/#{id}/comments/#{comment_id}"
199
199
  end
200
200
 
201
201
  end
@@ -22,7 +22,7 @@ module GitHub
22
22
  # @example
23
23
  # client.issues(:filter => 'created', :state => 'closed', :sort => 'updated')
24
24
  def issues(options={})
25
- get '/issues', auth_params.merge(options)
25
+ get '/issues', params: options
26
26
  end
27
27
 
28
28
  # List all issues across owned and member repositories for the authenticated user.
@@ -41,7 +41,7 @@ module GitHub
41
41
  # @example
42
42
  # client.user_issues(:filter => 'created')
43
43
  def user_issues(options={})
44
- get '/user/issues', auth_params.merge(options)
44
+ get '/user/issues', params: options
45
45
  end
46
46
 
47
47
  # List all issues for a given organization for the authenticated user.
@@ -61,7 +61,7 @@ module GitHub
61
61
  # @example
62
62
  # client.org_issues('facebook', :filter => 'mentioned', :state => 'closed')
63
63
  def org_issues(org, options={})
64
- get "/orgs/#{org}/issues", auth_params.merge(options)
64
+ get "/orgs/#{org}/issues", params: options
65
65
  end
66
66
 
67
67
  # List issues for a repository.
@@ -88,7 +88,7 @@ module GitHub
88
88
  # :since => '2013-08-09T19:00:00-05:00'
89
89
  # )
90
90
  def repo_issues(owner, repo, options={})
91
- get "/repos/#{owner}/#{repo}/issues", auth_params
91
+ get "/repos/#{owner}/#{repo}/issues"
92
92
  end
93
93
 
94
94
  # Get a single issue.
@@ -101,7 +101,7 @@ module GitHub
101
101
  # @example
102
102
  # client.issue('caseyscarborough', 'github', 123)
103
103
  def issue(owner, repo, number)
104
- get "/repos/#{owner}/#{repo}/issues/#{number}", auth_params
104
+ get "/repos/#{owner}/#{repo}/issues/#{number}"
105
105
  end
106
106
 
107
107
  # Create an issue.
@@ -122,7 +122,7 @@ module GitHub
122
122
  # client.create_issue('caseyscarborough', 'github', 'Found a bug', :assignee => 'caseyscarborough', :labels => ['label1', 'label2', 'label3'])
123
123
  def create_issue(owner, repo, title, options={})
124
124
  options.merge!(title: title)
125
- post "/repos/#{owner}/#{repo}/issues", auth_params, options
125
+ post "/repos/#{owner}/#{repo}/issues", body: options
126
126
  end
127
127
 
128
128
  # Edit an issue.
@@ -143,9 +143,9 @@ module GitHub
143
143
  # @example
144
144
  # client.edit_issue('caseyscarborough', 'github', 3, body: 'This is the body.', state: 'closed')
145
145
  def edit_issue(owner, repo, number, options={})
146
- patch "/repos/#{owner}/#{repo}/issues/#{number}", auth_params, options
146
+ patch "/repos/#{owner}/#{repo}/issues/#{number}", body: options
147
147
  end
148
-
148
+
149
149
  end
150
150
  end
151
151
  end
@@ -20,7 +20,7 @@ module GitHub
20
20
  # GitHub.markdown('# GitHub', mode: 'gfm', context: 'caseyscarborough/github')
21
21
  def markdown(text, options={mode: 'markdown'})
22
22
  options.merge!(text: text)
23
- post "/markdown", {}, options
23
+ post "/markdown", body: options
24
24
  end
25
25
 
26
26
  end
@@ -0,0 +1,101 @@
1
+ module GitHub
2
+ class Client
3
+
4
+ # Methods for the Authorizations API.
5
+ #
6
+ # These methods require the user to use basic authentication.
7
+ #
8
+ # @see http://developer.github.com/v3/oauth/#oauth-authorizations-api
9
+ module OAuth
10
+
11
+ # List your authorizations.
12
+ #
13
+ # Requires basic authentication.
14
+ #
15
+ # @return [Array] List of authorizations.
16
+ # @see http://developer.github.com/v3/oauth/#list-your-authorizations
17
+ # @example
18
+ # client = GitHub.client(:login => 'username', :password => 'password')
19
+ # client.authorizations
20
+ def authorizations
21
+ get "/authorizations"
22
+ end
23
+
24
+ # Get a single authorization.
25
+ #
26
+ # Requires basic authentication.
27
+ #
28
+ # @param id [Integer] The ID of the authorization to retrieve.
29
+ # @return [Hash] The authorization information.
30
+ # @see http://developer.github.com/v3/oauth/#get-a-single-authorization
31
+ # @example
32
+ # client = GitHub.client(:login => 'username', :password => 'password')
33
+ # client.authorization(12345)
34
+ def authorization(id)
35
+ get "/authorizations/#{id}"
36
+ end
37
+
38
+ # Create a new authorization.
39
+ #
40
+ # Requires basic authentication.
41
+ #
42
+ # @param options [Hash] Optional parameters.
43
+ # @option options [Array] :scopes A list of scopes to create the authorization using.
44
+ # @option options [String] :note Note to remind what the OAuth token is for.
45
+ # @option options [String] :note_url URL to remind you what the OAuth token is for.
46
+ # @option options [String] :client_id The 20 character OAuth app client key for which to create the token.
47
+ # @option options [String] :client_secret The 40 character OAuth app client secret for which to create the token.
48
+ # @return [Hash] The new OAuth token information.
49
+ # @see http://developer.github.com/v3/oauth/#create-a-new-authorization
50
+ # @example
51
+ # client = GitHub.client(:login => 'username', :password => 'password')
52
+ # client.create_authorization(
53
+ # :note => 'New authorization',
54
+ # :client_id => 'ab0487b031b18f9286a6',
55
+ # :client_secret => '9d667c2b7fae7a329f32b6df17926154'
56
+ # )
57
+ def create_authorization(options={})
58
+ post "/authorizations", body: options
59
+ end
60
+
61
+ # Update an existing authorization.
62
+ #
63
+ # Requires basic authentication.
64
+ #
65
+ # @param id [Integer] The ID of the authorization to update.
66
+ # @param options [Hash] Optional parameters.
67
+ # @option options [Array] :scopes Replaces the authorization scopes with these.
68
+ # @option options [Array] :add_scopes A list of scopes to add to this authorization.
69
+ # @option options [Array] :remove_scopes A list of scopes to remove from this authorization.
70
+ # @option options [String] :note Note to remind what the OAuth token is for.
71
+ # @option options [String] :note_url URL to remind you what the OAuth token is for.
72
+ # @return [Hash] The updated OAuth token information.
73
+ # @see http://developer.github.com/v3/oauth/#update-an-existing-authorization
74
+ # @example
75
+ # client = GitHub.client(:login => 'username', :password => 'password')
76
+ # client.update_authorization(1324, :note => 'Updated authorization')
77
+ def update_authorization(id, options={})
78
+ patch "/authorizations/#{id}", body: options
79
+ end
80
+
81
+ # Delete an authorization
82
+ #
83
+ # Requires basic authentication.
84
+ #
85
+ # @param id [Integer] The ID of the authorization to delete.
86
+ # @return [Boolean] True if successful, false if not.
87
+ # @see http://developer.github.com/v3/oauth/#delete-an-authorization
88
+ # @example
89
+ # client = GitHub.client(:login => 'username', :password => 'password')
90
+ # client.delete_authorization(1324)
91
+ def delete_authorization(id)
92
+ boolean_request :delete, "/authorizations/#{id}"
93
+ end
94
+
95
+ # def check_authorization(client_id, client_secret, access_token)
96
+ # get "/applications/#{client_id}/tokens/#{access_token}", {}, basic_auth_headers(client_id, client_secret)
97
+ # end
98
+ end
99
+
100
+ end
101
+ end
@@ -14,7 +14,7 @@ module GitHub
14
14
  # @example
15
15
  # GitHub.organization('github')
16
16
  def organization(org)
17
- get "/orgs/#{org}", auth_params
17
+ get "/orgs/#{org}"
18
18
  end
19
19
 
20
20
  # Edit an organization.
@@ -33,7 +33,7 @@ module GitHub
33
33
  # @example
34
34
  # client.edit_organization('facebook',name:'faceeebooook',location:'California')
35
35
  def edit_organization(org, options={})
36
- patch "/orgs/#{org}", auth_params, options
36
+ patch "/orgs/#{org}", body: options
37
37
  end
38
38
 
39
39
  # List all users who are members of an organization.
@@ -42,7 +42,7 @@ module GitHub
42
42
  # @return [Array] Array of members.
43
43
  # @see http://developer.github.com/v3/orgs/members/#members-list
44
44
  def organization_members(org)
45
- get "/orgs/#{org}/members", auth_params
45
+ get "/orgs/#{org}/members"
46
46
  end
47
47
 
48
48
  # Check if a user is, publicly or privately, a member of the organization.
@@ -52,7 +52,7 @@ module GitHub
52
52
  # @return [Boolean] True if user is a member, false if not.
53
53
  # @see http://developer.github.com/v3/orgs/members/#check-membership
54
54
  def organization_member?(org, username)
55
- boolean_get "/orgs/#{org}/members/#{username}", auth_params
55
+ boolean_request :get, "/orgs/#{org}/members/#{username}"
56
56
  end
57
57
 
58
58
  # Retrieve public members of an organization.
@@ -61,7 +61,7 @@ module GitHub
61
61
  # @return [Array] Array of members.
62
62
  # @see http://developer.github.com/v3/orgs/members/#public-members-list
63
63
  def organization_public_members(org)
64
- get "/orgs/#{org}/public_members", auth_params
64
+ get "/orgs/#{org}/public_members"
65
65
  end
66
66
 
67
67
  # Remove member from an organization.
@@ -73,7 +73,7 @@ module GitHub
73
73
  # @return [Boolean] True if user is a member, false if not.
74
74
  # @see http://developer.github.com/v3/orgs/members/#remove-a-member
75
75
  def remove_organization_member(org, username)
76
- boolean_delete "/orgs/#{org}/members/#{username}", auth_params
76
+ boolean_request :delete, "/orgs/#{org}/members/#{username}"
77
77
  end
78
78
 
79
79
  # Check if a user is publicly a member of the organization.
@@ -82,7 +82,7 @@ module GitHub
82
82
  # @return [Array] Array of members.
83
83
  # @see http://developer.github.com/v3/orgs/members/#check-public-membership
84
84
  def organization_public_member?(org, username)
85
- boolean_get "/orgs/#{org}/public_members/#{username}", auth_params
85
+ boolean_request :get, "/orgs/#{org}/public_members/#{username}"
86
86
  end
87
87
 
88
88
  # Make a user's organization membership public.
@@ -94,7 +94,7 @@ module GitHub
94
94
  # @return [Boolean] True if successful, false if not.
95
95
  # @see http://developer.github.com/v3/orgs/members/#publicize-a-users-membership
96
96
  def publicize_membership(org, username)
97
- boolean_put "/orgs/#{org}/public_members/#{username}", auth_params
97
+ boolean_request :put, "/orgs/#{org}/public_members/#{username}"
98
98
  end
99
99
 
100
100
  # Conceal a user's organization membership.
@@ -106,7 +106,7 @@ module GitHub
106
106
  # @return [Boolean] True if successful, false if not.
107
107
  # @see http://developer.github.com/v3/orgs/members/#conceal-a-users-membership
108
108
  def unpublicize_membership(org, username)
109
- boolean_delete "/orgs/#{org}/public_members/#{username}", auth_params
109
+ boolean_request :delete, "/orgs/#{org}/public_members/#{username}"
110
110
  end
111
111
 
112
112
  # List an organizations teams.
@@ -117,7 +117,7 @@ module GitHub
117
117
  # @return [Array] Array of teams.
118
118
  # @see http://developer.github.com/v3/orgs/teams/#list-teams
119
119
  def teams(org)
120
- get "/orgs/#{org}/teams", auth_params
120
+ get "/orgs/#{org}/teams"
121
121
  end
122
122
 
123
123
  # Get a team by its ID.
@@ -128,7 +128,7 @@ module GitHub
128
128
  # @return [Hash] Team information.
129
129
  # @see http://developer.github.com/v3/orgs/teams/#get-team
130
130
  def team(id)
131
- get "/teams/#{id}", auth_params
131
+ get "/teams/#{id}"
132
132
  end
133
133
 
134
134
  # Create a team for an organization.
@@ -146,7 +146,7 @@ module GitHub
146
146
  # @see http://developer.github.com/v3/orgs/teams/#create-team
147
147
  def create_team(org, team_name, options={})
148
148
  options.merge!(name: team_name)
149
- post "/orgs/#{org}/teams", auth_params, options
149
+ post "/orgs/#{org}/teams", body: options
150
150
  end
151
151
 
152
152
  # Edit a team.
@@ -162,7 +162,7 @@ module GitHub
162
162
  # @see http://developer.github.com/v3/orgs/teams/#edit-team
163
163
  def edit_team(id, team_name, options={})
164
164
  options.merge!(name: team_name)
165
- patch "/teams/#{id}", auth_params, options
165
+ patch "/teams/#{id}", body: options
166
166
  end
167
167
 
168
168
  # Delete a team.
@@ -174,7 +174,7 @@ module GitHub
174
174
  # @return [Boolean] True if successful, false if not.
175
175
  # @see http://developer.github.com/v3/orgs/teams/#delete-team
176
176
  def delete_team(id)
177
- boolean_delete "/teams/#{id}", auth_params
177
+ boolean_request :delete, "/teams/#{id}"
178
178
  end
179
179
 
180
180
  # List team members
@@ -186,7 +186,7 @@ module GitHub
186
186
  # @return [Array] Array of members.
187
187
  # @see http://developer.github.com/v3/orgs/teams/#list-team-members
188
188
  def team_members(id)
189
- get "/teams/#{id}/members", auth_params
189
+ get "/teams/#{id}/members"
190
190
  end
191
191
 
192
192
  # Determine if a user is a team member.
@@ -199,7 +199,7 @@ module GitHub
199
199
  # @return [Boolean] True if member, false if not.
200
200
  # @see http://developer.github.com/v3/orgs/teams/#get-team-member
201
201
  def team_member?(id, username)
202
- boolean_get "/teams/#{id}/members/#{username}", auth_params
202
+ boolean_request :get, "/teams/#{id}/members/#{username}"
203
203
  end
204
204
 
205
205
  # Add a member to a team.
@@ -213,7 +213,7 @@ module GitHub
213
213
  # @return [Boolean] True if successful, false if not.
214
214
  # @see http://developer.github.com/v3/orgs/teams/#add-team-member
215
215
  def add_team_member(id, username)
216
- boolean_put "/teams/#{id}/members/#{username}", auth_params
216
+ boolean_request :put, "/teams/#{id}/members/#{username}"
217
217
  end
218
218
  alias :add_organization_member :add_team_member
219
219
 
@@ -227,7 +227,7 @@ module GitHub
227
227
  # @return [Boolean] True if successful, false if not.
228
228
  # @see http://developer.github.com/v3/orgs/teams/#remove-team-member
229
229
  def remove_team_member(id, username)
230
- boolean_delete "/teams/#{id}/members/#{username}", auth_params
230
+ boolean_request :delete, "/teams/#{id}/members/#{username}"
231
231
  end
232
232
 
233
233
  # List all repositories for a team.
@@ -238,7 +238,7 @@ module GitHub
238
238
  # @return [Boolean] True if successful, false if not.
239
239
  # @see http://developer.github.com/v3/orgs/teams/#list-team-repos
240
240
  def team_repos(id)
241
- get "/teams/#{id}/repos", auth_params
241
+ get "/teams/#{id}/repos"
242
242
  end
243
243
 
244
244
  # Determine if a repo is managed by a team.
@@ -251,7 +251,7 @@ module GitHub
251
251
  # @return [Boolean] True if it is managed by the team, false if not.
252
252
  # @see http://developer.github.com/v3/orgs/teams/#get-team-repo
253
253
  def team_repo?(id, owner, repo)
254
- boolean_get "/teams/#{id}/repos/#{owner}/#{repo}", auth_params
254
+ boolean_request :get, "/teams/#{id}/repos/#{owner}/#{repo}"
255
255
  end
256
256
 
257
257
  # Add a team repository.
@@ -267,7 +267,7 @@ module GitHub
267
267
  # @return [Boolean] True if successful, false if not.
268
268
  # @see http://developer.github.com/v3/orgs/teams/#add-team-repo
269
269
  def add_team_repo(id, org, repo)
270
- boolean_put "/teams/#{id}/repos/#{org}/#{repo}", auth_params
270
+ boolean_request :put, "/teams/#{id}/repos/#{org}/#{repo}"
271
271
  end
272
272
 
273
273
  # Remove a team repository.
@@ -281,7 +281,7 @@ module GitHub
281
281
  # @return [Boolean] True if successful, false if not.
282
282
  # @see http://developer.github.com/v3/orgs/teams/#remove-team-repo
283
283
  def remove_team_repo(id, owner, repo)
284
- boolean_delete "/teams/#{id}/repos/#{owner}/#{repo}", auth_params
284
+ boolean_request :delete, "/teams/#{id}/repos/#{owner}/#{repo}"
285
285
  end
286
286
 
287
287
  end
@@ -14,7 +14,7 @@ module GitHub
14
14
  # @example
15
15
  # GitHub.pull_requests('caseyscarborough','github')
16
16
  def pull_requests(owner, repo)
17
- get "/repos/#{owner}/#{repo}/pulls", auth_params
17
+ get "/repos/#{owner}/#{repo}/pulls"
18
18
  end
19
19
 
20
20
  # Get a single pull request.
@@ -27,7 +27,7 @@ module GitHub
27
27
  # @example
28
28
  # GitHub.pull_request('caseyscarborough','github', 1)
29
29
  def pull_request(owner, repo, number)
30
- get "/repos/#{owner}/#{repo}/pulls/#{number}", auth_params
30
+ get "/repos/#{owner}/#{repo}/pulls/#{number}"
31
31
  end
32
32
 
33
33
  # Create a new pull request.
@@ -56,7 +56,7 @@ module GitHub
56
56
  # base: 'master'
57
57
  # )
58
58
  def create_pull_request(owner, repo, options={})
59
- post "/repos/#{owner}/#{repo}/pulls", auth_params, options
59
+ post "/repos/#{owner}/#{repo}/pulls", body: options
60
60
  end
61
61
 
62
62
  # Update a pull request.
@@ -73,7 +73,7 @@ module GitHub
73
73
  # @return [Hash] The pull request information.
74
74
  # @see http://developer.github.com/v3/pulls/#update-a-pull-request
75
75
  def update_pull_request(owner, repo, number, options={})
76
- patch "/repos/#{owner}/#{repo}/pulls/#{number}", auth_params, options
76
+ patch "/repos/#{owner}/#{repo}/pulls/#{number}", body: options
77
77
  end
78
78
 
79
79
  # List commits on a pull request.
@@ -84,7 +84,7 @@ module GitHub
84
84
  # @return [Array] Array of commits as hashes.
85
85
  # @see http://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
86
86
  def pull_request_commits(owner, repo, number)
87
- get "/repos/#{owner}/#{repo}/pulls/#{number}/commits", auth_params
87
+ get "/repos/#{owner}/#{repo}/pulls/#{number}/commits"
88
88
  end
89
89
 
90
90
  # List pull requests files.
@@ -95,7 +95,7 @@ module GitHub
95
95
  # @return [Array] Array of files as hashes.
96
96
  # @see http://developer.github.com/v3/pulls/#list-pull-requests-files
97
97
  def pull_request_files(owner, repo, number)
98
- get "/repos/#{owner}/#{repo}/pulls/#{number}/files", auth_params
98
+ get "/repos/#{owner}/#{repo}/pulls/#{number}/files"
99
99
  end
100
100
 
101
101
  # Check if a pull request has been merged.
@@ -106,7 +106,7 @@ module GitHub
106
106
  # @return [Boolean] True if it has been merged, false if not.
107
107
  # @see http://developer.github.com/v3/pulls/#get-if-a-pull-request-has-been-merged
108
108
  def pull_request_merged?(owner, repo, number)
109
- boolean_get "/repos/#{owner}/#{repo}/pulls/#{number}/merge", auth_params
109
+ boolean_request :get, "/repos/#{owner}/#{repo}/pulls/#{number}/merge"
110
110
  end
111
111
 
112
112
  # Merge a pull request.
@@ -119,7 +119,7 @@ module GitHub
119
119
  # @return [Hash] Merge information.
120
120
  # @see http://developer.github.com/v3/pulls/#merge-a-pull-request-merge-buttontrade
121
121
  def merge_pull_request(owner, repo, number)
122
- put "/repos/#{owner}/#{repo}/pulls/#{number}/merge", auth_params
122
+ put "/repos/#{owner}/#{repo}/pulls/#{number}/merge"
123
123
  end
124
124
 
125
125
  # List comments on a pull request.
@@ -130,7 +130,7 @@ module GitHub
130
130
  # @return [Array] Array of comments as hashes.
131
131
  # @see http://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
132
132
  def pull_request_comments(owner, repo, number)
133
- get "/repos/#{owner}/#{repo}/pulls/#{number}/comments", auth_params
133
+ get "/repos/#{owner}/#{repo}/pulls/#{number}/comments"
134
134
  end
135
135
 
136
136
  # List comments in a repository.
@@ -140,7 +140,7 @@ module GitHub
140
140
  # @return [Array] Array of comments as hashes.
141
141
  # @see http://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository
142
142
  def repo_pull_request_comments(owner, repo)
143
- get "/repos/#{owner}/#{repo}/pulls/comments", auth_params
143
+ get "/repos/#{owner}/#{repo}/pulls/comments"
144
144
  end
145
145
 
146
146
  # Get a single pull request comment.
@@ -153,7 +153,7 @@ module GitHub
153
153
  # @example
154
154
  # GitHub.pull_request_comment('caseyscarborough', 'github', 1242348)
155
155
  def pull_request_comment(owner, repo, number)
156
- get "/repos/#{owner}/#{repo}/pulls/comments/#{number}", auth_params
156
+ get "/repos/#{owner}/#{repo}/pulls/comments/#{number}"
157
157
  end
158
158
 
159
159
  # Create a pull request comment.
@@ -181,7 +181,7 @@ module GitHub
181
181
  # position: 2
182
182
  # )
183
183
  def create_pull_request_comment(owner, repo, number, options={})
184
- post "/repos/#{owner}/#{repo}/pulls/#{number}/comments", auth_params, options
184
+ post "/repos/#{owner}/#{repo}/pulls/#{number}/comments", body: options
185
185
  end
186
186
 
187
187
  # Edit a pull request comment.
@@ -198,7 +198,7 @@ module GitHub
198
198
  # client.edit_pull_request_comment('caseyscarborough', 'github', 1242348, 'What up, girl?')
199
199
  def edit_pull_request_comment(owner, repo, number, body)
200
200
  options = { body: body }
201
- patch "/repos/#{owner}/#{repo}/pulls/comments/#{number}", auth_params, options
201
+ patch "/repos/#{owner}/#{repo}/pulls/comments/#{number}", body: options
202
202
  end
203
203
 
204
204
  # Delete a pull request comment.
@@ -212,7 +212,7 @@ module GitHub
212
212
  # @example
213
213
  # client.delete_pull_request_comment('caseyscarborough', 'github', 1242348)
214
214
  def delete_pull_request_comment(owner, repo, number)
215
- boolean_delete "/repos/#{owner}/#{repo}/pulls/comments/#{number}", auth_params
215
+ boolean_request :delete, "/repos/#{owner}/#{repo}/pulls/comments/#{number}"
216
216
  end
217
217
  end
218
218