Class: EventMachine::Kannel

Inherits:
Object
  • Object
show all
Defined in:
lib/em-kannel.rb,
lib/em-kannel/client.rb,
lib/em-kannel/message.rb,
lib/em-kannel/version.rb,
lib/em-kannel/response.rb,
lib/em-kannel/log_message.rb,
lib/em-kannel/test_helper.rb,
lib/em-kannel/validations.rb,
lib/em-kannel/configuration.rb

Defined Under Namespace

Modules: Validations Classes: Client, Configuration, LogMessage, Message, Response

Constant Summary collapse

VERSION =
"0.2.1"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration_options = {}) ⇒ Kannel

Returns a new instance of Kannel.



17
18
19
# File 'lib/em-kannel.rb', line 17

def initialize(configuration_options={})
  self.configuration = Configuration.new(configuration_options)
end

Instance Attribute Details

#configurationObject

Returns the value of attribute configuration.



15
16
17
# File 'lib/em-kannel.rb', line 15

def configuration
  @configuration
end

Class Method Details

.deliveriesObject



5
6
7
# File 'lib/em-kannel/test_helper.rb', line 5

def self.deliveries
  @deliveries ||= []
end

.loggerObject



21
22
23
# File 'lib/em-kannel.rb', line 21

def self.logger
  @logger ||= Logger.new(STDOUT)
end

.logger=(new_logger) ⇒ Object



25
26
27
# File 'lib/em-kannel.rb', line 25

def self.logger=(new_logger)
  @logger = new_logger
end

Instance Method Details

#send_sms(message_options, &block) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/em-kannel.rb', line 29

def send_sms(message_options, &block)
  configuration.validate!

  message = Message.new(message_options)
  message.validate!

  client = Client.new(message, configuration)
  client.deliver(&block)
end