Listing repository URLs using Octokit.rb

I am trying to list the details of the Github account repositories using Octokit.rb but cannot find the corresponding URLs.

In the first case, all I need to do is authenticate using the Github API using OAuth and output the information to the console. Here is an example:

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 missed something obvious, but what you need to do to find html_url , clone_url , etc. (according to API ) for each repository?

+6
source share
1 answer

It turns out everything was obvious:

 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 
+9
source

Source: https://habr.com/ru/post/957251/


All Articles