Get user events with Github API and Octokit

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.

  • git error while deploying through chef
  • How to “prepend” repo history in git
  • fatal: could not read Username for 'https://github.com': No such file or directory
  • Creating CocoaPod for existing GitHub repo
  • Github: routing different project messages to different emails on my account
  • GitHub recover deleted blocks of code
  • 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 from there?
    Here is the official doc https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user

  • Pull request without forking?
  • deploying to a test server before production on heroku
  • copy file content to the clipboard in linux terminal
  • git stash not working after windows reinstall
  • Standard way of marking a github organization or repository as deprecated?
  • merging the changes from two repositories in github
  • 2 Solutions collect form web for “Get user events with Github API and Octokit”

    I think what you want is

    client = Octokit::Client.new(access_token: my_token)
    user = client.user
    events = client.user_events user.login
    

    It isn’t exactly intuitive and I had to read the source. I haven’t had a chance to test this yet but there doesn’t appear to be a better way.

    You have a typo:

    client = Octokit::Client::new(access_token: my_token)
                            ^^
    

    Should be:

    client = Octokit::Client.new(access_token: my_token)
                            ^
    
    Git Baby is a git and github fan, let's start git clone.