-
This lab begins where the Rails Github API lab leaves off. You're provided with a solution to that lab.
-
Create a new model
GithubRepo
inapp/models/github_repo.rb
. Since you're not storingGithubRepo
in a database, this class does not need to inherit from Active Record. Create the file manually – usingrails g model
will automatically inherit from Active Record and create a migration. Build out theGithubRepo
class to pass the model tests. -
Move authentication from your controller to your service objects.
-
Implement the
#initialize
method for yourGithubService
objects. -
Move the rest of your API calls into the
GithubService
object. Follow the path laid out in the tests, and get the application refactored and working. You will have to change the ERB file as well as your#logged_in?
method.
View Working with APIs on Learn.co and start learning to code for free.