What should be in the module?
The module must contain code that is divided by different classes or can be added to one class.
Do I need a module?
No, you can achieve the same with inheritance. If there is no code to share, then you probably don't need a module.
How can I use these methods in my models and controllers, where necessary?
Access to them is carried out using a class from the controller:
SalesForceAPI.get_data
"Module or class?" this is an old question in Ruby and any other language that supports both.
I would encapsulate the functionality for each API in the class. For example, you can have the SalesForceAPI class. Then, if you need to split functionality between classes for authentication, creating a folder, checking files, or uploading files, you can create an API class.
Each of the classes that need access to the API class inherits it:
SalesForceAPI < API
You can achieve the same by creating an API module and mixing it with other classes. In this case, it largely depends on preference, because any solution is good.
FWIW, I donβt know if there will be many common functions for authentication, creating a folder, checking files or downloading files, because each API can work in a completely different way. However, if they are a REST API, you can create some helper REST methods and put them in an API class.
An excellent, understandable, and complete resource on the topic Practical Object Oriented Ruby Design .