2020-04-10 11:12:37 +00:00
|
|
|
class Api::V1::Widget::EventsController < Api::V1::Widget::BaseController
|
|
|
|
include Events::Types
|
|
|
|
|
|
|
|
def create
|
2020-06-12 18:49:43 +00:00
|
|
|
Rails.configuration.dispatcher.dispatch(permitted_params[:name], Time.zone.now, contact_inbox: @contact_inbox, event_info: event_info)
|
2020-04-10 11:12:37 +00:00
|
|
|
head :no_content
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-06-12 18:49:43 +00:00
|
|
|
def event_info
|
|
|
|
{
|
|
|
|
widget_language: params[:locale],
|
|
|
|
browser_language: browser.accept_language.first&.code
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2020-04-10 11:12:37 +00:00
|
|
|
def permitted_params
|
|
|
|
params.permit(:name, :website_token)
|
|
|
|
end
|
|
|
|
end
|