Ruby 使用Octokit.rb输出repos URL
我试图列出使用的Github帐户repos的详细信息,但似乎找不到相关的URL 在第一个实例中,我需要做的就是使用OAuth对GithubAPI进行身份验证,并将详细信息输出到控制台。以下是迄今为止的一个基本示例:Ruby 使用Octokit.rb输出repos URL,ruby,github-api,octokit,Ruby,Github Api,Octokit,我试图列出使用的Github帐户repos的详细信息,但似乎找不到相关的URL 在第一个实例中,我需要做的就是使用OAuth对GithubAPI进行身份验证,并将详细信息输出到控制台。以下是迄今为止的一个基本示例: client = Octokit::Client.new :access_token => 'my_token' client.repos.each do |repo| puts repo.name puts repo.description # ht
client = Octokit::Client.new :access_token => 'my_token'
client.repos.each do |repo|
puts repo.name
puts repo.description
# html_url & clone_url go here.
end
我确信我忽略了一些显而易见的东西,但是你需要做什么才能找到每个存储库的
html\u-url
,clone\u-url
等(根据)呢?事实证明,这是显而易见的:
client = Octokit::Client.new :access_token => 'my_token'
client.repos.each do |repo|
puts repo.name
puts repo.description
# find the urls
puts repo.rels[:html].href
puts repo.rels[:git].href
puts repo.rels[:clone].href
puts repo.rels[:ssh].href
end
您如何知道必须在末尾添加“.href”?是否在API文档中?