Method: Github::Users::Keys#list

Defined in:
lib/github_api/users/keys.rb

#list(*args) ⇒ Object Also known as: all

List public keys for the authenticated user

Examples

github = Github.new oauth_token: '...'
github.users.keys.list
github.users.keys.list { |key| ... }

List public keys for the specified user

Examples

github.users.keys.list user: 'user-name'
github.users.keys.list user: 'user-name' { |key| ... }


21
22
23
24
25
26
27
28
29
30
# File 'lib/github_api/users/keys.rb', line 21

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