Sha256: 984f5b65a3b86fc13d3e2ad7aff698a1c792b25fa58a3eae3005888c613bd236
Contents?: true
Size: 1.74 KB
Versions: 7
Compression:
Stored size: 1.74 KB
Contents
module Kanaui class DashboardController < Kanaui::EngineController # # Load the dashboard by rendering the view and executing the javascript that will call # the reports and available_reports endpoints below. # def index user = current_tenant_user options = { :username => user[:username], :password => user[:password], :session_id => user[:session_id], :api_key => user[:api_key], :api_secret => user[:api_secret] } raw_reports = Kanaui::DashboardHelper::DashboardApi.available_reports(options) @startDate = params['startDate'] || (Date.today << 3).to_s @endDate = params['endDate'] || Date.today.to_s @reports = JSON.parse(raw_reports) render end # Not used anymore as reports are pulled from index def available_reports user = current_tenant_user options = { :username => user[:username], :password => user[:password], :session_id => user[:session_id], :api_key => user[:api_key], :api_secret => user[:api_secret] } available_reports = Kanaui::DashboardHelper::DashboardApi.available_reports(options) render json: available_reports end def reports user = current_tenant_user options = { :username => user[:username], :password => user[:password], :session_id => user[:session_id], :api_key => user[:api_key], :api_secret => user[:api_secret] } format = params['format'] || 'json' reports = Kanaui::DashboardHelper::DashboardApi.reports(params['startDate'], params['endDate'], params['name'], params['smooth'], format, options) render json: reports end end end
Version data entries
7 entries across 7 versions & 1 rubygems