Skip to content

Instantly share code, notes, and snippets.

@lukeredpath
Created September 15, 2010 11:36
Show Gist options
  • Save lukeredpath/7ae65630cce67f5081cf to your computer and use it in GitHub Desktop.
Save lukeredpath/7ae65630cce67f5081cf to your computer and use it in GitHub Desktop.
This patch allows passing the 'unicode' flag to the Clicktell HTTP API. If set,
it will be passed verbatim to Clickatell as an HTTP request parameter. It is
expected that it's set to either 0 or 1. If set to 1, the message text must be
a hexstring of the UCS-2 representation of the string, as with the following
Ruby snippet:
ucs2 = Iconv.conv('UCS-2', 'UTF-8', text)
hexstring = ucs2.unpack("H*")
100830 Marc Haisenko
Index: lib/clickatell/api.rb
===================================================================
--- lib/clickatell/api.rb (revision 1010)
+++ lib/clickatell/api.rb (working copy)
@@ -75,7 +75,7 @@
# :client_message_id - user specified message id that can be used in place of Clickatell issued API message ID for querying message
# Returns a new message ID if successful.
def send_message(recipient, message_text, opts={})
- valid_options = opts.only(:from, :mo, :callback, :climsgid)
+ valid_options = opts.only(:from, :mo, :callback, :climsgid, :unicode)
valid_options.merge!(:req_feat => '48') if valid_options[:from]
valid_options.merge!(:mo => '1') if opts[:set_mobile_originated]
valid_options.merge!(:climsgid => opts[:client_message_id]) if opts[:client_message_id]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment