I am coming from c#/.net/asp.net mvc/nancyfx and I am considering Rails for an upcoming project.
The project involves the creation of a unified/abstract api that pulls a couple of similar web services together, allowing the developer to provide implementations of each services while also interacting with them through a single api. Much like Ruby DBI does for databases.
In c# I would create a interface to define the contract all service implementations would have to adhere to (i am using online file storage services as an example to explain the issue):
public interface IStorageProvider
{
ICollection<string> ListFilenames(string folder);
}
Then I would create implementations for each service, e.g. dropbox:
public DropboxStorageProvider : IStorageProvider
{
public ICollection<string> ListFilenames(string folder)
{
var filenames = service.SomeCodeToGetFilenames(folder);
return filenames;
}
}
What would be the Ruby approach to create such an abstraction? Thanks!