octokit

redirect_to is not working into rescue block

試著忘記壹切 提交于 2019-12-12 03:04:50
问题 I am using Octokit so as to login. helper_method :user def show end def user client = Octokit::Client.new(access_token: session[:access_token]) begin @user = client.user rescue => e redirect_to root_path return end end The root_path is in the config root to: 'home#new' The rescue es executed, however the redirect_to isn't working, it return to the same view as the main method. Note: I read in many post that putting return fix it, nevertheless it didn't 回答1: Your code is calling the redirect

Get user events with Github API and Octokit

冷暖自知 提交于 2019-12-11 19:53:15
问题 I'm trying to make a simple call to retrieve user events on github through octokit. According to the docs I create new client and visit the user events endpoint. client = Octokit::Client.new(access_token: my_token) user = client.user Up to here it works fine, now I continue with events = user.events => nil Alternatively, when I do client = Octokit::Client.new(access_token: my_token, api_endpoint: 'users/:user/events') I get #<Octokit::Client:0x007f9a78ac04f8... but how to get list of events

Can I get the diff data for one file between two commits via the GH API?

ε祈祈猫儿з 提交于 2019-12-08 01:17:59
问题 I know how to get the commit for a file via the API, along with the SHA and all that nice stuff. But, suppose I just want the diff of a file in 1 commit or the diff of the same file across two commits. For instance, in this commit, say I wanted just the , :counter_sql in the activerecord/lib/active_record/associations.rb . How do I get at that diff data via the API? I am using Octokit.rb. Edit 1 It seems that this is possible per this blog post, but I am just not sure how to do it with