Class: Smess::Clickatell
- Inherits:
-
Object
- Object
- Smess::Clickatell
- Includes:
- Logging
- Defined in:
- lib/smess/outputs/clickatell.rb
Instance Method Summary collapse
- #deliver ⇒ Object
-
#initialize(sms) ⇒ Clickatell
constructor
A new instance of Clickatell.
Methods included from Logging
Constructor Details
#initialize(sms) ⇒ Clickatell
Returns a new instance of Clickatell.
29 30 31 32 33 |
# File 'lib/smess/outputs/clickatell.rb', line 29 def initialize(sms) @sms = sms ::Clickatell::API.debug_mode = true ::Clickatell::API.secure_mode = true end |
Instance Method Details
#deliver ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/smess/outputs/clickatell.rb', line 35 def deliver begin responses = [] .each do |msg| rsp = api.(sms.to, msg.encode('ISO-8859-1'), {from: from, concat: 3, callback: 7}) responses << rsp end result = normal_result(responses.first) rescue => e # connection problem or some error result = result_for_error(e) end result end |