使用Ruby通过GithubAPI对用户进行身份验证?

使用Ruby通过GithubAPI对用户进行身份验证?,ruby,github,Ruby,Github,我必须通过Ruby中的GithubAPI对用户进行身份验证,才能创建私有存储库 演示了如何使用curl执行此操作 有人能告诉我如何使用红宝石或类似的东西吗 client = Octokit::Client.new(:login => 'someguy', :token => 'sometoken123b1i3') client.create(:name=>'foobar', :description=>'Foo Bar', :homepage=> 'http://e

我必须通过Ruby中的GithubAPI对用户进行身份验证,才能创建私有存储库

演示了如何使用curl执行此操作

有人能告诉我如何使用红宝石或类似的东西吗

client = Octokit::Client.new(:login => 'someguy', :token => 'sometoken123b1i3')
client.create(:name=>'foobar', :description=>'Foo Bar', :homepage=> 'http://example.com', :public=>false)
像这样的事

client = Octokit::Client.new(:login => 'someguy', :token => 'sometoken123b1i3')
client.create(:name=>'foobar', :description=>'Foo Bar', :homepage=> 'http://example.com', :public=>false)

使用RestClient,首先需要创建一个资源,然后使用该资源发布定义repo元数据的JSON数据:

my_resource = RestClient::Resource.new( "https://api.github.com", :user => "username", :password => "123456" )
my_resource["/user/repos"].post( { :name => "new-repo", :description => "this is a new repo", :public => true }.to_json )

有关使用RestClient的API的详细信息,请参见,首先需要创建一个资源,然后使用该资源发布定义repo元数据的JSON数据:

my_resource = RestClient::Resource.new( "https://api.github.com", :user => "username", :password => "123456" )
my_resource["/user/repos"].post( { :name => "new-repo", :description => "this is a new repo", :public => true }.to_json )
有关API的详细信息,请参阅