I’m starting to think through a webapp that allows multiple connection
types (HTTP/web, email, SMS, Twitter, etc), and I’d like to combine as
much functionality as possible. To that end, I’ve been thinking about
how to integrate the other media with Rails’ MVC. For each one, I’d
like the input to be the same as the output (that is, if I send an SMS
to the server, I get an SMS response).
I imagine creating fake MIME types for each one, and then having
foo_view.html.erb, foo_view.sms.erb, foo_view.twitter.erb, etc.
Some problems:
-
I can’t figure out how to dispatch to a controller. For example,
if I have a daemon thread polling for email, how do I take the
extracted email text and use it to set up the request for the
controller? How do I then call the controller’s handle method? -
Are Rails controllers really abstract enough for this? They seem
quite tied to the AbstractRequest object, which is certainly HTTP.
(Email has no concept of GET vs PUT or a URL, and HTTP has no concept
of a Subject.) -
Would I be better off choosing a different framework? I love
Rails, but am I trying to cut a cucumber with my golden hammer?
-Gaius