module Github::Users::Keys
def create_key(params={})
"key" => "ssh-rsa AAA..."
@github.users.create_key "title" => "octocat@octomac",
@github = Github.new :oauth_token => '...'
= Examples
* :key - Required string. sha key
* :title - Required string
= Inputs
Create a public key for the authenticated user
def create_key(params={}) _normalize_params_keys(params) _filter_params_keys(VALID_KEY_PARAM_NAMES, params) post("/user/keys", params) end
def delete_key(key_id, params={})
@github.users.delete_key 'key-id'
@github = Github.new :oauth_token => '...'
= Examples
Delete a public key for the authenticated user
def delete_key(key_id, params={}) _validate_presence_of key_id _normalize_params_keys(params) delete("/user/keys/#{key_id}", params) end
def public_key(key_id, params={})
@github.users.public_key 'key-id'
@github = Github.new :oauth_token => '...'
= Examples
Get a single pulic key for the authenticated user
def public_key(key_id, params={}) _validate_presence_of key_id _normalize_params_keys(params) get("/user/keys/#{key_id}", params) end
def public_keys(params={})
@github.users.public_keys { |key| ... }
@github.users.public_keys
@github = Github.new :oauth_token => '...'
= Examples
List public keys for the authenticated user
def public_keys(params={}) _normalize_params_keys(params) response = get("/user/keys", params) return response unless block_given? response.each { |el| yield el } end
def update_key(key_id, params={})
"key" => "ssh-rsa AAA..."
@github.users.update_key 'key-id', "title" => "octocat@octomac",
@github = Github.new :oauth_token => '...'
= Examples
* :key - Required string. sha key
* :title - Required string
= Inputs
Update a public key for the authenticated user
def update_key(key_id, params={}) _validate_presence_of key_id _normalize_params_keys(params) _filter_params_keys(VALID_KEY_PARAM_NAMES, params) patch("/user/keys/#{key_id}", params) end