Class: PandaPal::LtiV1P0Controller

Inherits:
ApplicationController show all
Defined in:
app/controllers/panda_pal/lti_v1_p0_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#share_controller_on_thread

Instance Method Details

#launchObject



11
12
13
14
15
16
17
18
19
# File 'app/controllers/panda_pal/lti_v1_p0_controller.rb', line 11

def launch
  current_session_data.merge!({
    lti_version: 'v1p0',
    lti_launch_placement: params[:launch_type],
    launch_params: params.to_unsafe_h,
  })

  redirect_with_session_to(:"#{LaunchUrlHelpers.launch_route(params[:launch_type])}_url", route_context: main_app)
end

#tool_configObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/panda_pal/lti_v1_p0_controller.rb', line 21

def tool_config
  if PandaPal.lti_environments.empty?
    render plain: 'Domains must be set in lti_environments'
    return
  end
  platform = PandaPal.lti_options.delete(:platform) || 'canvas.instructure.com'
  request_url = "#{request.scheme}://#{request.host_with_port}"
  case platform
  when 'canvas.instructure.com'
    xml_config = LtiXml::CanvasPlatform.new(platform, request_url, main_app)
  when 'bridgeapp.com'
    xml_config = LtiXml::BridgePlatform.new(platform, request_url, main_app)
  else
    render plain: 'platform must be set under lti_options'
    return
  end
  render xml: xml_config.xml
end