开发者

Best practices for integrating Rails app with external APIs?

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 integra开发者_运维百科tion, 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)?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜