ruby – 使用Octokit.rb输出回购URL

我正在尝试使用 Octokit.rb列出Github帐户存储库的详细信息,但似乎无法找到关联的URL.

在第一个实例中,我需要做的就是使用OAuth对Github API进行身份验证,并将详细信息输出到控制台.到目前为止,这是一个基本的例子:@H_404_3@

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_url,clone_url等(根据API)?@H_404_3@

解决方法

事实证明,这显然是显而易见的:
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

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...