Anything you don't own wrap in a class or adapter

upcase.com Weekly iteration on testing APIs

Ideally if you are interacting with the outside world either through APIs or outside gems you should be putting your connection to it into a wrapper or adapter class. This creates an internal API for the outside source you can control. So if you want to substitute the what is in the wrapper or if the outside API changes you have a central place to change or fix.