Where in my Rails application are classes responsible for making third-party API calls?

My applications interact with several internal APIs to periodically import data, and I was wondering where is the right place to put this code.

Some of the usual places I've seen are /app/models/third_party_api.rbOR /lib/apis/third_party_api.rb, but I don't know what the general convention is.

thanks

+4
source share
1 answer

You can place this code in many places. app/models, app/api_clients/<api_name>,lib/api_clients/<api_name>

, , api, Gemfile, , vendor/gems/<gem_name>

gem 'gem_name', path: 'vendor/gems/gem_name'

api, , . , .

+3

All Articles