-
-
Save zotherstupidguy/31a80d531e2c9170ebd2a97ebb3035bd to your computer and use it in GitHub Desktop.
Ruby script to get gist lists by octokit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'octokit' | |
# API 呼び出し回数 | |
ratelimit = Octokit.ratelimit | |
ratelimit_remaining = Octokit.ratelimit_remaining | |
puts "Rate Limit Remaining: #{ratelimit_remaining} / #{ratelimit}" | |
puts | |
# インスタンス化 | |
# ==== 認証無しの場合 | |
gists = Octokit.gists("komasaru") | |
# ==== OAuth 認証の場合 | |
# cl = Octokit::Client.new(login: "komasaru", oauth_token: "token_string") | |
# gists = cl.gists("komasaru") | |
# 値取得 | |
gists.each do |gist| | |
file = Hash.new | |
gist.files.each {|k, v| file = v} | |
puts "[ #{file.filename} ]" | |
puts "\tUser : #{gist.user.login}" | |
puts "\tDescription : #{gist.description}" | |
puts "\tURL : #{gist.html_url}" | |
puts "\tPublic : #{gist.public}" | |
puts "\tLanguage : #{file.language}" | |
puts "\tID : #{gist.id}" | |
puts "\tCreated at : #{gist.created_at}" | |
puts | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment