Module: UssdEngine::Controller::Mixin

Includes:
Io, Options, Params
Defined in:
lib/ussd_engine/controller/mixin.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



14
15
16
17
18
# File 'lib/ussd_engine/controller/mixin.rb', line 14

def self.included(base)
  base.send :include, UssdEngine::Controller::Storable
  base.send :include, UssdEngine::Controller::Forkable
  base.send :skip_before_action, :verify_authenticity_token, only: :ussd_controller, raise: false
end

Instance Method Details

#ussd_controllerObject



20
21
22
23
24
25
26
27
28
# File 'lib/ussd_engine/controller/mixin.rb', line 20

def ussd_controller
  unless request.env["ussd_engine.request"].present?
    Config.logger&.warn "UssdEngine::Controller::Mixin :: Unknown request type"
    return render(status: :bad_request)
  end

  process_ussd_request build_ussd_request
  render body: nil
end