class Github::Client::Users::Keys
Constants
- VALID_KEY_PARAM_NAMES
Public Instance Methods
create(*args)
click to toggle source
Create a public key for the authenticated user
@param [Hash] params @option [String] :title
Required string
@option [String] :key
Required string. sha key
@example
github = Github.new oauth_token: '...' github.users.keys.create "title": "octocat@octomac", "key": "ssh-rsa AAA..."
@api public
# File lib/github_api/client/users/keys.rb, line 61 def create(*args) arguments(args) do permit VALID_KEY_PARAM_NAMES end post_request("/user/keys", arguments.params) end
delete(*args)
click to toggle source
Delete a public key for the authenticated user
@example
github = Github.new oauth_token: '...' github.users.keys.delete 'key-id'
@api public
# File lib/github_api/client/users/keys.rb, line 96 def delete(*args) arguments(args, required: [:id]) delete_request("/user/keys/#{arguments.id}", arguments.params) end
get(*args)
click to toggle source
Get a single pulic key for the authenticated user
@example
github = Github.new oauth_token: '...' github.users.keys.get 'key-id'
@api public
# File lib/github_api/client/users/keys.rb, line 42 def get(*args) arguments(args, required: [:id]) get_request("/user/keys/#{arguments.id}", arguments.params) end
Also aliased as: find
list(*args) { |el| ... }
click to toggle source
List public keys for the authenticated user
@example
github = Github.new oauth_token: '...' github.users.keys.list github.users.keys.list { |key| ... }
List public keys for the specified user
@example
github.users.keys.list user: 'user-name' github.users.keys.list user: 'user-name' { |key| ... }
@return [Hash]
@api public
# File lib/github_api/client/users/keys.rb, line 23 def list(*args) params = arguments(args).params response = if (user = params.delete('user')) get_request("/users/#{user}/keys", params) else get_request("/user/keys", params) end return response unless block_given? response.each { |el| yield el } end
Also aliased as: all
update(*args)
click to toggle source
Update a public key for the authenticated user
@param [Hash] params @option [String] :title
Required string
@option [String] :key
Required string. sha key
@example
github = Github.new oauth_token: '...' github.users.keys.update 'key-id', "title": "octocat@octomac", "key": "ssh-rsa AAA..."
@api public
# File lib/github_api/client/users/keys.rb, line 82 def update(*args) arguments(args, required: [:id]) do permit VALID_KEY_PARAM_NAMES end patch_request("/user/keys/#{arguments.id}", arguments.params) end