While peppermint oil does deter rats, it does not repel them completely. Repelling them for any length of time requires a lot of oil and frequent replacement of stale oil with fresh oil.
The consensus among experts is that the only real way to get rid of rats is to make some changes around the home. Some of the suggestions for assuring that rats do not return are to locate and seal holes, ensure that food is sealed, take out trash on a regular basis and rinse recyclable containers before placing them in the recycling bin. Make sure that items which rats like to build nests, such newspapers and books, are organized and removed from areas that rats frequent.