Working with APIs

Instructions

  1. Refer to this tutorial and the Github OAuth documentation to implement authentication with the GitHub API. Display the current user's username on the index page in a heading.

  2. On the repositories index page, display a list of the current user's repositories. Displaying only the first page of results is fine; feel free to tackle pagination as a bonus.

  3. Implement the create action in your RepositoriesController so that the form on index.html.erb successfully creates a new repository for the current user. The form input should be the name of the new repository. Redirect back to '/'.

  • Note: The Github API requires the body of the POST be valid JSON.
  1. Your solution will "make it work", but we want to move the API calls out of the controllers. Once the tests pass, learn how to refactor your code in the next lab. This is important – don't skip it!

View Working with APIs on Learn.co and start learning to code for free.