views:

39

answers:

1

I'm starting to integrate our Rails-based app with other, external APIs. We're going to start with mailing list services (probably Mad Mimi or Campaign Monitor).

I'd just like to know if anyone has best/preferred practices for approaching simple integration, error checking and the like.

Do you put API functions in model callbacks? Is it best to have API functions run in the background (ala delayed_job)?

+1  A: 

I tend to go with the "skinny controller, fat model" approach, so I'd say model for everything.

As far as background goes, it depends if the process is asynchronous or not. Logging into Twitter via OAuth wouldn't fit in a background job, but fetching feeds from Google's AJAX Feed API would.

Steve Klabnik
Thanks for the tips. Yes, all processes are asynchronous (for now).
Callmeed