Skip to content

Instantly share code, notes, and snippets.

@edipofederle
Created July 24, 2010 22:09
Show Gist options
  • Select an option

  • Save edipofederle/489023 to your computer and use it in GitHub Desktop.

Select an option

Save edipofederle/489023 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'httparty'
class Github
include HTTParty
base_uri "http://github.com/api/v2/yaml"
API_METHODS = {
:repos => '/repos/show/',
:fork => '/repos/fork/'
}
def initialize(user)
@user = user
end
def all_repos
repos = self.class.get(API_METHODS[:repos]+@user)["repositories"]
repos.each do |r|
puts "#{r[:url]} - #{r[:name]}"
end
end
def fork_projeto(name)
puts self.class.get(API_METHODS[:fork]+"tpope/#{name}", auth_params)
end
private
def auth_params
{ :login => "edipofederle", :token => "3d91b7e4a23643d51e9490ef596f3089" }
end
end
github = Github.new("edipofederle")
github.fork_projeto("vim-haml")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment