I have a controller dealing with sending SMS Messages, and it's set up as a default resource. Now, business requirements have changed and we want to offer the user three different ways of sending the message:
- To everybody on their contact list
- To a segmented portion of their contact list (predefined)
- To individual contacts that they can choose
In addition, there are two ways they can send an SMS Message: Premium (via an sms gateway) or Standard (via SMTP). So there are essentially six different ways to send a message (three for premium, three for standard).
The requirements state that the three options above need to be presented in a "wizard-like" format, as three radio button choices and then a submit button which displays the appropriate form and list:
- If option 1 (send to everyone) then just display a textbox for sending the SMS
- If option 2 (send to a segment) then display a list of segments as radio buttons
- If option 3 (send to specific) then display a searchable/sortable list of all contacts with checkboxes next to their names, and on submit select everyone checked to send.
The issue I'm running into is how to make this fit the RESTful conventions imposed by the resource. Each of these use cases is technically only one action (well, two since it would correspond to new/create) but it looks like there needs to be an inordinate amount of logic in the action then, and rather messy as well (switch statement or similar).
Is there a better way do to this?