Making the Clickatell gem do your bidding
For a project which will be released to the public next weekend and should start appearing on blogs in the next week (and which could be _huge_), we needed the Clickatell gem from Luke Redpath to pass some other parameters to Clickatell to handle our custom sender ID and callback options. I’m not quite sure why, but the original gem filters out all but two of the configuration options you can pass it.
Fortunately, thanks to Ruby we could work around it with a nasty monkeypatch- namely, overriding the method in it’s entirety in environment.rb:
# Monkeypatch for Clickatell gem to allow callback param
module Clickatell
class API
def send_message(recipient, message_text, opts={})
response = execute_command('sendmsg', 'http',
{:to => recipient, :text => message_text}.merge(opts)
)
parse_response(response)['ID']
end
end
end
Not pretty, but it does the job. You can now pass in all the options you need:
api.send_message(mobile_number, content, :from => 'SenderID', :callback => 3)
Again, entirely confused as to why the gem filters all options out. I’ll prod Luke Redpath and see if there’s some reason to it, and if there’s not perhaps this can get fixed to avoid the monkeypatching.
No related posts.


Ooh is this for eve metrics 2.0 ? I’m looking forward to seeing what you have done as I have some ideas for some development I would like to base from it.
Afraid EVE Metrics 2 will probably not be coming for a month or so; this app will provide some features to EM2 but is not directly connected.
This is the first EVE project I’ve really collaborated on, and the same team will be tackling EM2 with the same ruthless efficiency that has allowed us to make this app so well in so little time
Thanks for the response, I look forward to further developments. Ruthless efficiency eh?… sounds dangerous