Class: ActionSms::ConnectionAdapters::AbstractAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/action_sms/connection_adapters/abstract_adapter.rb

Overview

All the concrete gateway adapters follow the interface laid down in this class. You can use this interface directly by borrowing the gateway connection from the Base with Base.connection.

Direct Known Subclasses

SMSGlobalAdapter, TropoAdapter

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ AbstractAdapter

:nodoc:



11
12
13
# File 'lib/action_sms/connection_adapters/abstract_adapter.rb', line 11

def initialize(config = {}) #:nodoc:
  @config = config
end

Instance Method Details

#authenticate(params) ⇒ Object



15
16
17
18
# File 'lib/action_sms/connection_adapters/abstract_adapter.rb', line 15

def authenticate(params)
  params["authentication_key"] == @config[:authentication_key] ?
    params.delete("authentication_key") : nil
end

#authentication_keyObject



24
25
26
# File 'lib/action_sms/connection_adapters/abstract_adapter.rb', line 24

def authentication_key
  @config[:authentication_key]
end

#authentication_key=(value) ⇒ Object



20
21
22
# File 'lib/action_sms/connection_adapters/abstract_adapter.rb', line 20

def authentication_key=(value)
  @config[:authentication_key] = value
end

#configurationObject



28
29
30
# File 'lib/action_sms/connection_adapters/abstract_adapter.rb', line 28

def configuration
  @config
end

#configuration=(value) ⇒ Object



32
33
34
# File 'lib/action_sms/connection_adapters/abstract_adapter.rb', line 32

def configuration=(value)
  @config = value
end

#use_sslObject



36
37
38
# File 'lib/action_sms/connection_adapters/abstract_adapter.rb', line 36

def use_ssl
  @config[:use_ssl]
end

#use_ssl=(value) ⇒ Object



40
41
42
# File 'lib/action_sms/connection_adapters/abstract_adapter.rb', line 40

def use_ssl=(value)
  @config[:use_ssl] = value
end