Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
Split messages over 153 characters into multiple messages. The API ne…
Browse files Browse the repository at this point in the history
…eds an explicit parameter for this
  • Loading branch information
jsierles2 authored and Luke Redpath committed Oct 12, 2010
1 parent 56d3976 commit 50cad85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/clickatell/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def ping(session_id)
# Sends a message +message_text+ to +recipient+. Recipient
# number should have an international dialing prefix and
# no leading zeros (unless you have set a default prefix
# in your clickatell account centre).
# in your clickatell account centre). Messages over 153 characters
# are split into multiple messages.
#
# Additional options:
# :from - the from number/name
Expand All @@ -80,6 +81,9 @@ def send_message(recipient, message_text, opts={})
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]
if message_text.length > 153
valid_options.merge!(:concat => (message_text.length.to_f / 153).ceil)
end
recipient = recipient.join(",")if recipient.is_a?(Array)
response = execute_command('sendmsg', 'http',
{:to => recipient, :text => message_text}.merge(valid_options)
Expand Down
2 changes: 1 addition & 1 deletion lib/clickatell/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Clickatell #:nodoc:
module VERSION #:nodoc:
MAJOR = 0
MINOR = 8
TINY = 2
TINY = 1

STRING = [MAJOR, MINOR, TINY].join('.')

Expand Down

0 comments on commit 50cad85

Please sign in to comment.