class Kamigo::RequestHandlers::LineRequestHandler
Public Class Methods
new(request, form_authenticity_token)
click to toggle source
# File lib/kamigo/request_handlers/line_request_handler.rb, line 4 def initialize(request, form_authenticity_token) @request = request @form_authenticity_token = form_authenticity_token end
Public Instance Methods
handle()
click to toggle source
# File lib/kamigo/request_handlers/line_request_handler.rb, line 9 def handle parser = EventParsers::LineEventParser.new events = parser.parse_events(@request) events.each do |event| output = process_event(event) || Kamigo.line_default_message responser = EventResponsers::LineEventResponser.new response = responser.response_event(event, output) end end
Private Instance Methods
process_event(event)
click to toggle source
# File lib/kamigo/request_handlers/line_request_handler.rb, line 21 def process_event(event) Kamigo.line_event_processors.each do |processor| processor.request = @request processor.form_authenticity_token = @form_authenticity_token output = processor.process(event) return output if output.present? end nil end