Class: SmsOnRails::ServiceProviders::Clickatell

Inherits:
Base
  • Object
show all
Defined in:
lib/sms_on_rails/service_providers/clickatell.rb

Constant Summary collapse

FATAL_ERROR_CODES =
%w(105 114)

Instance Method Summary collapse

Methods inherited from Base

#deliver, get_service_provider, human_name, max_characters, name, provider_by_id, provider_by_name, provider_list, provider_map, #requires_carrier?, #send_sms, #send_to_phone, set_default_service_provider

Constructor Details

#initializeClickatell

Returns a new instance of Clickatell.



10
11
12
13
14
15
16
17
# File 'lib/sms_on_rails/service_providers/clickatell.rb', line 10

def initialize
  begin
    require 'clickatell'
  rescue LoadError => exc
    raise LoadError.new(exc.to_s + " Please make sure the clickatell gem is installed.")
  end
  super
end

Instance Method Details

#authenticateObject



24
25
26
# File 'lib/sms_on_rails/service_providers/clickatell.rb', line 24

def authenticate
  invoke_clickatell{ api }
end

#pingObject



19
20
21
22
# File 'lib/sms_on_rails/service_providers/clickatell.rb', line 19

def ping
  result = invoke_clickatell{ api.ping(nil) }
  result.is_a?(Net::HTTPOK)
end

#send_message(phone_number, message, options = {}) ⇒ Object

Send a message without validation

  • phone_number - phone number string digits

  • message - the message text

  • options - anything else



32
33
34
35
# File 'lib/sms_on_rails/service_providers/clickatell.rb', line 32

def send_message(phone_number, message, options={})
  unique_id = invoke_clickatell{  api.send_message(phone_number, message) }
  {:unique_id => unique_id}
end