github_api 0.3.5 → 0.3.6

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.
Files changed (147) hide show
  1. data/LICENSE.txt +20 -0
  2. data/README.rdoc +228 -0
  3. data/Rakefile +52 -0
  4. data/features/github_api.feature +50 -0
  5. data/features/options.feature +4 -0
  6. data/features/pagination.feature +4 -0
  7. data/features/step_definitions/github_api_steps.rb +11 -0
  8. data/features/support/env.rb +13 -0
  9. data/lib/github_api.rb +73 -0
  10. data/lib/github_api/api.rb +175 -0
  11. data/lib/github_api/api/utils.rb +9 -0
  12. data/lib/github_api/authorization.rb +73 -0
  13. data/lib/github_api/authorizations.rb +119 -0
  14. data/lib/github_api/cache_control.rb +19 -0
  15. data/lib/github_api/client.rb +55 -0
  16. data/lib/github_api/compatibility.rb +23 -0
  17. data/lib/github_api/configuration.rb +96 -0
  18. data/lib/github_api/connection.rb +75 -0
  19. data/lib/github_api/core_ext/array.rb +14 -0
  20. data/lib/github_api/core_ext/hash.rb +42 -0
  21. data/lib/github_api/error.rb +35 -0
  22. data/lib/github_api/events.rb +202 -0
  23. data/lib/github_api/gists.rb +200 -0
  24. data/lib/github_api/gists/comments.rb +86 -0
  25. data/lib/github_api/git_data.rb +26 -0
  26. data/lib/github_api/git_data/blobs.rb +51 -0
  27. data/lib/github_api/git_data/commits.rb +78 -0
  28. data/lib/github_api/git_data/references.rb +113 -0
  29. data/lib/github_api/git_data/tags.rb +78 -0
  30. data/lib/github_api/git_data/trees.rb +89 -0
  31. data/lib/github_api/issues.rb +215 -0
  32. data/lib/github_api/issues/comments.rb +123 -0
  33. data/lib/github_api/issues/events.rb +54 -0
  34. data/lib/github_api/issues/labels.rb +191 -0
  35. data/lib/github_api/issues/milestones.rb +140 -0
  36. data/lib/github_api/mime_type.rb +55 -0
  37. data/lib/github_api/orgs.rb +95 -0
  38. data/lib/github_api/orgs/members.rb +120 -0
  39. data/lib/github_api/orgs/teams.rb +245 -0
  40. data/lib/github_api/pull_requests.rb +224 -0
  41. data/lib/github_api/pull_requests/comments.rb +144 -0
  42. data/lib/github_api/repos.rb +286 -0
  43. data/lib/github_api/repos/collaborators.rb +81 -0
  44. data/lib/github_api/repos/commits.rb +180 -0
  45. data/lib/github_api/repos/downloads.rb +155 -0
  46. data/lib/github_api/repos/forks.rb +48 -0
  47. data/lib/github_api/repos/hooks.rb +174 -0
  48. data/lib/github_api/repos/keys.rb +104 -0
  49. data/lib/github_api/repos/pub_sub_hubbub.rb +102 -0
  50. data/lib/github_api/repos/watching.rb +94 -0
  51. data/lib/github_api/request.rb +84 -0
  52. data/lib/github_api/request/basic_auth.rb +31 -0
  53. data/lib/github_api/request/caching.rb +33 -0
  54. data/lib/github_api/request/oauth2.rb +33 -0
  55. data/lib/github_api/response.rb +28 -0
  56. data/lib/github_api/response/helpers.rb +14 -0
  57. data/lib/github_api/response/jsonize.rb +26 -0
  58. data/lib/github_api/response/mashify.rb +24 -0
  59. data/lib/github_api/response/raise_error.rb +33 -0
  60. data/lib/github_api/result.rb +42 -0
  61. data/lib/github_api/users.rb +84 -0
  62. data/lib/github_api/users/emails.rb +49 -0
  63. data/lib/github_api/users/followers.rb +98 -0
  64. data/lib/github_api/users/keys.rb +84 -0
  65. data/lib/github_api/version.rb +12 -0
  66. data/spec/README.rdoc +22 -0
  67. data/spec/coverage_adapter.rb +15 -0
  68. data/spec/fixtures/auths/authorization.json +14 -0
  69. data/spec/fixtures/auths/authorizations.json +16 -0
  70. data/spec/fixtures/events/events.json +29 -0
  71. data/spec/fixtures/issues/comment.json +13 -0
  72. data/spec/fixtures/issues/comments.json +15 -0
  73. data/spec/fixtures/issues/event.json +13 -0
  74. data/spec/fixtures/issues/events.json +15 -0
  75. data/spec/fixtures/issues/issue.json +56 -0
  76. data/spec/fixtures/issues/issues.json +58 -0
  77. data/spec/fixtures/issues/milestone.json +18 -0
  78. data/spec/fixtures/issues/milestones.json +20 -0
  79. data/spec/fixtures/orgs/members.json +9 -0
  80. data/spec/fixtures/orgs/org.json +18 -0
  81. data/spec/fixtures/orgs/orgs.json +8 -0
  82. data/spec/fixtures/orgs/team.json +8 -0
  83. data/spec/fixtures/orgs/team_repos.json +29 -0
  84. data/spec/fixtures/orgs/teams.json +7 -0
  85. data/spec/fixtures/repos/branches.json +9 -0
  86. data/spec/fixtures/repos/collaborators.json +8 -0
  87. data/spec/fixtures/repos/commit.json +53 -0
  88. data/spec/fixtures/repos/commit_comment.json +16 -0
  89. data/spec/fixtures/repos/commit_comments.json +18 -0
  90. data/spec/fixtures/repos/commits.json +27 -0
  91. data/spec/fixtures/repos/contributors.json +8 -0
  92. data/spec/fixtures/repos/download.json +10 -0
  93. data/spec/fixtures/repos/download_s3.json +21 -0
  94. data/spec/fixtures/repos/downloads.json +12 -0
  95. data/spec/fixtures/repos/fork.json +27 -0
  96. data/spec/fixtures/repos/forks.json +29 -0
  97. data/spec/fixtures/repos/hook.json +15 -0
  98. data/spec/fixtures/repos/hooks.json +10 -0
  99. data/spec/fixtures/repos/key.json +6 -0
  100. data/spec/fixtures/repos/keys.json +8 -0
  101. data/spec/fixtures/repos/languages.json +4 -0
  102. data/spec/fixtures/repos/repo.json +90 -0
  103. data/spec/fixtures/repos/repo_comments.json +18 -0
  104. data/spec/fixtures/repos/repos.json +29 -0
  105. data/spec/fixtures/repos/tags.json +11 -0
  106. data/spec/fixtures/repos/teams.json +7 -0
  107. data/spec/fixtures/repos/watched.json +29 -0
  108. data/spec/fixtures/repos/watchers.json +8 -0
  109. data/spec/fixtures/users/user.json +32 -0
  110. data/spec/github/api_spec.rb +25 -0
  111. data/spec/github/authorization_spec.rb +176 -0
  112. data/spec/github/authorizations_spec.rb +242 -0
  113. data/spec/github/client_spec.rb +50 -0
  114. data/spec/github/core_ext/hash_spec.rb +44 -0
  115. data/spec/github/events_spec.rb +491 -0
  116. data/spec/github/gists/comments_spec.rb +5 -0
  117. data/spec/github/gists_spec.rb +5 -0
  118. data/spec/github/git_data/blobs_spec.rb +5 -0
  119. data/spec/github/git_data/commits_spec.rb +5 -0
  120. data/spec/github/git_data/references_spec.rb +5 -0
  121. data/spec/github/git_data/tags_spec.rb +5 -0
  122. data/spec/github/git_data/trees_spec.rb +5 -0
  123. data/spec/github/git_data_spec.rb +5 -0
  124. data/spec/github/issues/comments_spec.rb +254 -0
  125. data/spec/github/issues/events_spec.rb +153 -0
  126. data/spec/github/issues/labels_spec.rb +5 -0
  127. data/spec/github/issues/milestones_spec.rb +260 -0
  128. data/spec/github/issues_spec.rb +287 -0
  129. data/spec/github/mime_type_spec.rb +70 -0
  130. data/spec/github/orgs/members_spec.rb +275 -0
  131. data/spec/github/orgs/teams_spec.rb +563 -0
  132. data/spec/github/orgs_spec.rb +160 -0
  133. data/spec/github/repos/collaborators_spec.rb +169 -0
  134. data/spec/github/repos/commits_spec.rb +424 -0
  135. data/spec/github/repos/downloads_spec.rb +247 -0
  136. data/spec/github/repos/forks_spec.rb +108 -0
  137. data/spec/github/repos/hooks_spec.rb +333 -0
  138. data/spec/github/repos/keys_spec.rb +217 -0
  139. data/spec/github/repos/pub_sub_hubbub_spec.rb +83 -0
  140. data/spec/github/repos/watching_spec.rb +222 -0
  141. data/spec/github/repos_spec.rb +571 -0
  142. data/spec/github/result_spec.rb +43 -0
  143. data/spec/github/users_spec.rb +140 -0
  144. data/spec/github_spec.rb +109 -0
  145. data/spec/spec_helper.rb +86 -0
  146. data/spec/support/base.rb +13 -0
  147. metadata +149 -4
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ require 'faraday'
4
+
5
+ module Github
6
+ module Request
7
+ class OAuth2 < Faraday::Middleware
8
+ dependency 'oauth2'
9
+
10
+ def call(env)
11
+ # puts "ENV: #{env.inspect}"
12
+ # puts "TOKEN : #{@token}"
13
+ # puts "APP: #{@app}"
14
+
15
+ # Extract parameters from the query
16
+ params = env[:url].query_values || {}
17
+
18
+ env[:url].query_values = { 'access_token' => @token }.merge(params)
19
+
20
+ token = env[:url].query_values['access_token']
21
+
22
+ env[:request_headers].merge!('Authorization' => "Token token=\"#{token}\"")
23
+
24
+ @app.call env
25
+ end
26
+
27
+ def initialize(app, *args)
28
+ @app = app
29
+ @token = args.shift
30
+ end
31
+ end # OAuth2
32
+ end # Request
33
+ end # Github
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ require 'faraday'
4
+
5
+ module Github
6
+ # Contains methods and attributes that act on the response returned from the
7
+ # request
8
+ class Response < Faraday::Response::Middleware
9
+ CONTENT_TYPE = 'Content-Type'.freeze
10
+
11
+ class << self
12
+ attr_accessor :parser
13
+ end
14
+
15
+ def self.define_parser(&block)
16
+ @parser = block
17
+ end
18
+
19
+ def response_type(env)
20
+ env[:response_headers][CONTENT_TYPE].to_s
21
+ end
22
+
23
+ def parse_response?(env)
24
+ env[:body].respond_to? :to_str
25
+ end
26
+
27
+ end # Response
28
+ end # Github
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+
3
+ require 'faraday'
4
+
5
+ module Github
6
+ class Response::Helpers < Response
7
+
8
+ def on_complete(env)
9
+ env[:body].extend(Github::Result)
10
+ env[:body].instance_eval { @env = env }
11
+ end
12
+
13
+ end # Response::Helpers
14
+ end # Github
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ require 'faraday'
4
+
5
+ module Github
6
+ class Response::Jsonize < Response
7
+ dependency 'multi_json'
8
+
9
+ define_parser do |body|
10
+ ::MultiJson.decode body
11
+ end
12
+
13
+ def parse(body)
14
+ case body
15
+ when ''
16
+ nil
17
+ when 'true'
18
+ true
19
+ when 'false'
20
+ false
21
+ else
22
+ self.class.parser.call body
23
+ end
24
+ end
25
+ end # Response::Jsonize
26
+ end # Github
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ require 'faraday'
4
+
5
+ module Github
6
+ class Response::Mashify < Response
7
+ dependency 'hashie/mash'
8
+
9
+ define_parser do |body|
10
+ ::Hashie::Mash.new body
11
+ end
12
+
13
+ def parse(body)
14
+ case body
15
+ when Hash
16
+ self.class.parser.call body
17
+ when Array
18
+ body.map { |item| item.is_a?(Hash) ? self.class.parser.call(item) : item }
19
+ else
20
+ body
21
+ end
22
+ end
23
+ end # Response::Mashify
24
+ end # Github
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+
3
+ require 'faraday'
4
+ require 'github_api/error'
5
+
6
+ module Github
7
+ class Response::RaiseError < Faraday::Response::Middleware
8
+
9
+ def on_complete(env)
10
+ case env[:status].to_i
11
+ when 400
12
+ raise Github::BadRequest.new(response_message(env), env[:response_headers])
13
+ when 401
14
+ raise Github::Unauthorised.new(response_message(env), env[:response_headers])
15
+ when 403
16
+ raise Github::Forbidden.new(response_message(env), env[:response_headers])
17
+ when 404
18
+ raise Github::ResourceNotFound.new(response_message(env), env[:response_headers])
19
+ when 500
20
+ raise Github::InternalServerError.new(response_message(env), env[:response_headers])
21
+ when 503
22
+ raise Github::ServiceUnavailable.new(response_message(env), env[:response_headers])
23
+ when 400...600
24
+ raise Github::Error.new(response_message(env), env[:response_headers])
25
+ end
26
+ end
27
+
28
+ def response_message(env)
29
+ "#{env[:method].to_s.upcase} #{env[:url].to_s}: #{env[:status]}#{env[:body]}"
30
+ end
31
+
32
+ end # Response::RaiseError
33
+ end # Github
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ module Result
5
+
6
+ RATELIMIT = 'X-RateLimit-Remaining'.freeze
7
+ CONTENT_TYPE = 'Content-Type'.freeze
8
+ CONTENT_LENGTH = 'content-length'.freeze
9
+
10
+ attr_reader :env
11
+
12
+ # Requests are limited to API v3 to 5000 per hour.
13
+ def ratelimit
14
+ loaded? ? @env[:response_headers][RATELIMIT] : nil
15
+ end
16
+
17
+ def content_type
18
+ loaded? ? @env[:response_headers][CONTENT_TYPE] : nil
19
+ end
20
+
21
+ def content_length
22
+ loaded? ? @env[:response_headers][CONTENT_LENGTH] : nil
23
+ end
24
+
25
+ def status
26
+ loaded? ? @env[:status] : nil
27
+ end
28
+
29
+ def success?
30
+ (200..299).include? status
31
+ end
32
+
33
+ def body
34
+ loaded? ? @env[:body] : nil
35
+ end
36
+
37
+ def loaded?
38
+ !!env
39
+ end
40
+
41
+ end # Result
42
+ end # Github
@@ -0,0 +1,84 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ class Users < API
5
+ extend AutoloadHelper
6
+
7
+ # Load all the modules after initializing Repos to avoid superclass mismatch
8
+ autoload_all 'github_api/users',
9
+ :Emails => 'emails',
10
+ :Followers => 'followers',
11
+ :Keys => 'keys'
12
+
13
+ include Github::Users::Emails
14
+ include Github::Users::Followers
15
+ include Github::Users::Keys
16
+
17
+ VALID_USER_PARAMS_NAMES = %w[
18
+ name
19
+ email
20
+ blog
21
+ company
22
+ location
23
+ hireable
24
+ bio
25
+ ].freeze
26
+
27
+ # Creates new Repos API
28
+ def initialize(options = {})
29
+ super(options)
30
+ end
31
+
32
+ # Get a single unauthenticated user
33
+ #
34
+ # = Examples
35
+ # @github = Github.new
36
+ # @github.users.get_user 'user-name'
37
+ #
38
+ # Get the authenticated user
39
+ #
40
+ # = Examples
41
+ # @github = Github.new :oauth_token => '...'
42
+ # @github.users.get_user
43
+ #
44
+ def get_user(user_name=nil, params={})
45
+ _normalize_params_keys(params)
46
+ if user_name
47
+ get("/users/#{user_name}", params)
48
+ else
49
+ get("/user", params)
50
+ end
51
+ end
52
+ alias :get_auth_user :get_user
53
+
54
+ # Update the authenticated user
55
+ #
56
+ # = Inputs
57
+ # * <tt>:name</tt> - Optional string
58
+ # * <tt>:email</tt> - Optional string - publically visible email address
59
+ # * <tt>:blog</tt> - Optional string
60
+ # * <tt>:company</tt> - Optional string
61
+ # * <tt>:location</tt> - Optional string
62
+ # * <tt>:hireable</tt> - Optional boolean
63
+ # * <tt>:bio</tt> - Optional string
64
+ #
65
+ # = Examples
66
+ # @github = Github.new :oauth_token => '..'
67
+ # @github.users.update_user
68
+ # "name" => "monalisa octocat",
69
+ # "email" => "octocat@github.com",
70
+ # "blog" => "https://github.com/blog",
71
+ # "company" => "GitHub",
72
+ # "location" => "San Francisco",
73
+ # "hireable" => true,
74
+ # "bio" => "There once..."
75
+ #
76
+ def update_user(params={})
77
+ _normalize_params_keys(params)
78
+ _filter_params_keys(VALID_USER_PARAMS_NAMES, params)
79
+ patch("/user", params)
80
+ end
81
+ alias :update_authenticated_user :update_user
82
+
83
+ end # Users
84
+ end # Github
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ class Users
5
+ module Emails
6
+
7
+ # List email addresses for the authenticated user
8
+ #
9
+ # = Examples
10
+ # @github = Github.new :oauth_token => '...'
11
+ # @github.users.emails
12
+ #
13
+ def emails(params={})
14
+ get("/user/emails", params)
15
+ end
16
+
17
+ # Add email address(es) for the authenticated user
18
+ #
19
+ # = Inputs
20
+ # You can include a single email address or an array of addresses
21
+ #
22
+ # = Examples
23
+ # @github = Github.new :oauth_token => '...'
24
+ # @github.users.add_email "octocat@github.com", "support@github.com"
25
+ #
26
+ def add_email(*args)
27
+ params = _extract_parameters(args)
28
+ params['data'] = [args].flatten
29
+ post("/user/emails", params)
30
+ end
31
+
32
+ # Delete email address(es) for the authenticated user
33
+ #
34
+ # = Inputs
35
+ # You can include a single email address or an array of addresses
36
+ #
37
+ # = Examples
38
+ # @github = Github.new :oauth_token => '...'
39
+ # @github.users.delete_email "octocat@github.com", "support@github.com"
40
+ #
41
+ def add_email(*args)
42
+ params = _extract_parameters(args)
43
+ params['data'] = [args].flatten
44
+ delete("/user/emails", params)
45
+ end
46
+
47
+ end # Emails
48
+ end # Users
49
+ end # Github
@@ -0,0 +1,98 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ class Users
5
+ module Followers
6
+
7
+ # List a user's followers
8
+ #
9
+ # = Examples
10
+ # @github = Github.new
11
+ # @github.users.followers 'user-name'
12
+ # @github.users.followers 'user-name' { |user| ... }
13
+ #
14
+ # List the authenticated user's followers
15
+ #
16
+ # = Examples
17
+ # @github = Github.new :oauth_token => '...'
18
+ # @github.users.following
19
+ # @github.users.following { |user| ... }
20
+ #
21
+ def followers(user_name=nil, params={})
22
+ _normalize_params_keys(params)
23
+ response = if user_name
24
+ get("/users/#{user_name}/followers", params)
25
+ else
26
+ get("/user/followers", params)
27
+ end
28
+ return response unless block_given?
29
+ response.each { |el| yield el }
30
+ end
31
+
32
+ # List who a user is following
33
+ #
34
+ # = Examples
35
+ # @github = Github.new
36
+ # @github.users.following 'user-name'
37
+ # @github.users.following 'user-name' { |user| ... }
38
+ #
39
+ # List who the authenicated user is following
40
+ #
41
+ # = Examples
42
+ #
43
+ # @github = Github.new :oauth_token => '...'
44
+ # @github.users.following
45
+ #
46
+ def following(user_name=nil, params={})
47
+ _normalize_params_keys(params)
48
+ response = if user_name
49
+ get("/users/#{user_name}/following", params)
50
+ else
51
+ get("/user/following", params)
52
+ end
53
+ return response unless block_given?
54
+ response.each { |el| yield el }
55
+ end
56
+
57
+ # Check if you are following a user
58
+ #
59
+ # = Examples
60
+ # @github = Github.new :oauth_token => '...'
61
+ # @github.users.following? 'user-name'
62
+ #
63
+ def following?(user_name, params={})
64
+ _validate_presence_of user_name
65
+ _normalize_params_keys(params)
66
+ get("/user/following/#{user_name}", params)
67
+ true
68
+ rescue Github::ResourceNotFound
69
+ false
70
+ end
71
+
72
+ # Follow a user
73
+ #
74
+ # = Examples
75
+ # @github = Github.new :oauth_token => '...'
76
+ # @github.users.follow 'user-name'
77
+ #
78
+ def follow(user_name, params={})
79
+ _validate_presence_of user_name
80
+ _normalize_params_keys(params)
81
+ put("/user/following/#{user_name}", params)
82
+ end
83
+
84
+ # Unfollow a user
85
+ #
86
+ # = Examples
87
+ # @github = Github.new :oauth_token => '...'
88
+ # @github.users.unfollow 'user-name'
89
+ #
90
+ def unfollow(user_name, params={})
91
+ _validate_presence_of user_name
92
+ _normalize_params_keys(params)
93
+ delete("/user/following/#{user_name}", params)
94
+ end
95
+
96
+ end # Followers
97
+ end # Users
98
+ end # Github
@@ -0,0 +1,84 @@
1
+ # encoding: utf-8
2
+
3
+ module Github
4
+ class Users
5
+ module Keys
6
+
7
+ VALID_KEY_PARAM_NAMES = %w[ title key ].freeze
8
+
9
+ # List public keys for the authenticated user
10
+ #
11
+ # = Examples
12
+ # @github = Github.new :oauth_token => '...'
13
+ # @github.users.public_keys
14
+ # @github.users.public_keys { |key| ... }
15
+ #
16
+ def public_keys(params={})
17
+ _normalize_params_keys(params)
18
+ response = get("/user/keys", params)
19
+ return response unless block_given?
20
+ response.each { |el| yield el }
21
+ end
22
+
23
+ # Get a single pulic key for the authenticated user
24
+ #
25
+ # = Examples
26
+ # @github = Github.new :oauth_token => '...'
27
+ # @github.users.public_key 'key-id'
28
+ #
29
+ def public_key(key_id, params={})
30
+ _validate_presence_of key_id
31
+ _normalize_params_keys(params)
32
+ get("/user/keys/#{key_id}", params)
33
+ end
34
+
35
+ # Create a public key for the authenticated user
36
+ #
37
+ # = Inputs
38
+ # * <tt>:title</tt> - Required string
39
+ # * <tt>:key</tt> - Required string. sha key
40
+ #
41
+ # = Examples
42
+ # @github = Github.new :oauth_token => '...'
43
+ # @github.users.create_key "title" => "octocat@octomac",
44
+ # "key" => "ssh-rsa AAA..."
45
+ #
46
+ def create_key(params={})
47
+ _normalize_params_keys(params)
48
+ _filter_params_keys(VALID_KEY_PARAM_NAMES, params)
49
+ post("/user/keys", params)
50
+ end
51
+
52
+ # Update a public key for the authenticated user
53
+ #
54
+ # = Inputs
55
+ # * <tt>:title</tt> - Required string
56
+ # * <tt>:key</tt> - Required string. sha key
57
+ #
58
+ # = Examples
59
+ # @github = Github.new :oauth_token => '...'
60
+ # @github.users.update_key 'key-id', "title" => "octocat@octomac",
61
+ # "key" => "ssh-rsa AAA..."
62
+ #
63
+ def update_key(key_id, params={})
64
+ _validate_presence_of key_id
65
+ _normalize_params_keys(params)
66
+ _filter_params_keys(VALID_KEY_PARAM_NAMES, params)
67
+ patch("/user/keys/#{key_id}", params)
68
+ end
69
+
70
+ # Delete a public key for the authenticated user
71
+ #
72
+ # = Examples
73
+ # @github = Github.new :oauth_token => '...'
74
+ # @github.users.delete_key 'key-id'
75
+ #
76
+ def delete_key(key_id, params={})
77
+ _validate_presence_of key_id
78
+ _normalize_params_keys(params)
79
+ delete("/user/keys/#{key_id}", params)
80
+ end
81
+
82
+ end # Keys
83
+ end # Users
84
+ end # Github