Skip to content

Instantly share code, notes, and snippets.

Created July 11, 2014 21:22
Show Gist options
  • Save anonymous/2e59f773f9c335d146ee to your computer and use it in GitHub Desktop.
Save anonymous/2e59f773f9c335d146ee to your computer and use it in GitHub Desktop.
def get_repos
parsed_response = JSON.parse(open("https://api.github.com/users/xxxxxx/repos").read)
parsed_response.select! { |hash| hash["fork"] == false }
parsed_response.map do |hash|
hash.select! do |key, value|
["name", "url", "description"].include? key
end
end
@results = parsed_response
@options = @results.collect {|p| [ p['name'] ] }
end
def create
@response = project_params
repo_hash = @results.select { |a| a["name"] == @response["name"] }
test = repo_hash[0]
@project = Project.new(test)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment