Class: FlowChat::Ussd::Gateway::Nalo
- Inherits:
-
Object
- Object
- FlowChat::Ussd::Gateway::Nalo
- Defined in:
- lib/flow_chat/ussd/gateway/nalo.rb
Instance Method Summary collapse
- #call(context) ⇒ Object
-
#initialize(app) ⇒ Nalo
constructor
A new instance of Nalo.
Constructor Details
#initialize(app) ⇒ Nalo
Returns a new instance of Nalo.
7 8 9 |
# File 'lib/flow_chat/ussd/gateway/nalo.rb', line 7 def initialize(app) @app = app end |
Instance Method Details
#call(context) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/flow_chat/ussd/gateway/nalo.rb', line 11 def call(context) params = context.controller.request.params context["request.id"] = params["USERID"] context["request.gateway"] = :nalo context["request.network"] = nil context["request.msisdn"] = Phonelib.parse(params["MSISDN"]).e164 # context["request.type"] = params["MSGTYPE"] ? :initial : :response context["request.input"] = params["USERDATA"].presence type, prompt, choices = @app.call(context) context.controller.render json: { USERID: params["USERID"], MSISDN: params["MSISDN"], MSG: render_prompt(prompt, choices), MSGTYPE: type == :prompt } end |