Class: IfreeSms::Manager

Inherits:
Object
  • Object
show all
Extended by:
Callbacks
Defined in:
lib/ifree_sms/manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Callbacks

_incoming_message, incoming_message

Constructor Details

#initialize(app, options = {}) {|@config| ... } ⇒ Manager

Initialize the middleware. If a block is given, a IfreeSms::Config is yielded so you can properly configure the IfreeSms::Manager.

Yields:



10
11
12
13
14
15
16
# File 'lib/ifree_sms/manager.rb', line 10

def initialize(app, options={})
  options.symbolize_keys!

  @app, @config = app, IfreeSms::Config.new(options)
  yield @config if block_given?
  self
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



6
7
8
# File 'lib/ifree_sms/manager.rb', line 6

def config
  @config
end

Instance Method Details

#_run_callbacks(*args) ⇒ Object

:api: private



27
28
29
# File 'lib/ifree_sms/manager.rb', line 27

def _run_callbacks(*args) #:nodoc:
  self.class._run_callbacks(*args)
end

#call(env) ⇒ Object

:nodoc:



18
19
20
21
22
23
24
# File 'lib/ifree_sms/manager.rb', line 18

def call(env) # :nodoc:      
  if smsing_path?(env['PATH_INFO'])
    create(env)
  else
    @app.call(env)
  end
end