Class: Usage::CodeSnippetController

Inherits:
ApplicationController show all
Defined in:
lib/nexmo_developer/app/controllers/usage/code_snippet_controller.rb

Constant Summary

Constants included from ApplicationHelper

ApplicationHelper::CONFIG

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_admin!, #not_found, #redirect_vonage_domain

Methods included from ApplicationHelper

#active_sidenav_item, #canonical_base, #canonical_base_from_config, #canonical_path, #canonical_url, #dashboard_cookie, #search_enabled?, #set_utm_cookie, #theme

Instance Method Details

#createObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/nexmo_developer/app/controllers/usage/code_snippet_controller.rb', line 5

def create
  event = ::Usage::CodeSnippetEvent.new(
    language: params['language'],
    snippet: params['snippet'],
    action: params['event'],
    section: params['section'],
    ip: request.remote_ip
  )

  event.save!

  render json: event
end