I'm attempting to list details of a Github accounts repos using Octokit.rb, but can't seem to find the associated URLs.
In the first instance all I need to do is authenticate with the Github API using OAuth and output the details to the console. Here's a basic example so far:
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
I'm sure I've overlooked something obvious, but what do you need to do to find the html_url
, clone_url
etc (as per the API) for each repository?
Turns out it was obvious after all:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With