Module: Bianchi::USSD::ProviderParsers::Africastalking
- Included in:
- Bianchi::USSD::ProviderConfigurations
- Defined in:
- lib/bianchi/ussd/provider_parsers/africastalking.rb
Instance Method Summary collapse
- #africastalking_params_parser(params) ⇒ Object
- #africastalking_prompt_data_parser(prompt_data) ⇒ Object
Instance Method Details
#africastalking_params_parser(params) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/bianchi/ussd/provider_parsers/africastalking.rb', line 7 def africastalking_params_parser(params) required_params = %w[sessionId phoneNumber text serviceCode] left_required_params = required_params - params.keys.map(&:to_s) unless left_required_params.empty? raise ArgumentError, "#{left_required_params} required in params to start engine for provider #{@provider}" end { session_id: params["sessionId"], mobile_number: params["phoneNumber"], activity_state: params["text"] && params["text"].empty? ? "initial" : "subsequent", input_body: params["text"].split("*").last, service_code: params["serviceCode"] } end |
#africastalking_prompt_data_parser(prompt_data) ⇒ Object
24 25 26 |
# File 'lib/bianchi/ussd/provider_parsers/africastalking.rb', line 24 def africastalking_prompt_data_parser(prompt_data) prompt_data["activity_state"] == :await ? "CON #{prompt_data['body']}" : "END #{prompt_data['body']}" end |