Class: Kamigo::EventProcessors::RailsRouterProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/kamigo/event_processors/rails_router_processor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRailsRouterProcessor

Returns a new instance of RailsRouterProcessor.



7
8
# File 'lib/kamigo/event_processors/rails_router_processor.rb', line 7

def initialize
end

Instance Attribute Details

#form_authenticity_tokenObject

Returns the value of attribute form_authenticity_token.



5
6
7
# File 'lib/kamigo/event_processors/rails_router_processor.rb', line 5

def form_authenticity_token
  @form_authenticity_token
end

#requestObject

Returns the value of attribute request.



4
5
6
# File 'lib/kamigo/event_processors/rails_router_processor.rb', line 4

def request
  @request
end

Instance Method Details

#process(event) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/kamigo/event_processors/rails_router_processor.rb', line 10

def process(event)
  http_method, path, request_params = kamiform_context(event)
  http_method, path, request_params = language_understanding(event.message) if http_method.nil?
  return nil if http_method.nil? || path.nil?

  encoded_path = URI::Parser.new.escape(path)
  request_params = event.platform_params.merge(request_params)
  output = reserve_route(encoded_path, http_method: http_method, request_params: request_params, format: :line)
  return output if output.present?
end