class Dbagger
The main Dbagger
driver
Public Class Methods
collect_data(options)
click to toggle source
# File lib/dbagger.rb, line 14 def self.collect_data(options) begin response = RestClient.get("#{options[:github_api]}/users/#{options[:gh_username]}") rescue => e return false end gituser = JSON.parse(response.body) return false if gituser['message'] == 'Not Found' begin response = RestClient.get("#{options[:github_api]}/users/#{options[:gh_username]}/keys") rescue => e return false end keys = [] return false if response.body == 'Not Found' JSON.parse(response.body).each do |key| keys.push(key['key']) end return false if keys.empty? return { id: options[:username], ssh_keys: keys, groups: options[:groups].split(','), shell: options[:shell], comment: gituser['name'] } end