Class: Kamigo::RequestHandlers::LineRequestHandler
- Inherits:
-
Object
- Object
- Kamigo::RequestHandlers::LineRequestHandler
- Defined in:
- lib/kamigo/request_handlers/line_request_handler.rb
Instance Method Summary collapse
- #handle ⇒ Object
-
#initialize(request, form_authenticity_token, account: nil) ⇒ LineRequestHandler
constructor
A new instance of LineRequestHandler.
Constructor Details
#initialize(request, form_authenticity_token, account: nil) ⇒ LineRequestHandler
Returns a new instance of LineRequestHandler.
4 5 6 7 8 |
# File 'lib/kamigo/request_handlers/line_request_handler.rb', line 4 def initialize(request, form_authenticity_token, account: nil) @request = request @form_authenticity_token = form_authenticity_token @account = account || Kamigo.default_account end |
Instance Method Details
#handle ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/kamigo/request_handlers/line_request_handler.rb', line 10 def handle parser = EventParsers::LineEventParser.new(account: @account) events = parser.parse_events(@request) events.each do |event| event.account_name = @account.name output = process_event(event) responser = EventResponsers::LineEventResponser.new(account: @account) response = responser.response_event(event, output) end end |