class PublicKeys::Github
Constants
Public Class Methods
new(*args)
click to toggle source
# File lib/public_keys/github.rb, line 7 def initialize(*args) @client = Octokit::Client.new(*args) end
Public Instance Methods
organization_keys(organization)
click to toggle source
# File lib/public_keys/github.rb, line 22 def organization_keys(organization) @client.organization_members(organization).flat_map { |member| user_keys(member['login']) } end
team_keys(organization, team_name)
click to toggle source
# File lib/public_keys/github.rb, line 15 def team_keys(organization, team_name) team_id = @client.organization_teams(organization).find { |team| team['name'] == team_name }['id'] @client.team_members(team_id).flat_map { |member| user_keys(member['login']) } rescue Octokit::Unauthorized raise UnauthorizedError.new('You have to authenticate to get team keys.') end
user_keys(user)
click to toggle source
# File lib/public_keys/github.rb, line 11 def user_keys(user) @client.user_keys(user).map { |user| user['key'] } end