Sha256: f5c9283e76d53b6a7bbfd6992f8ddac4fdce27f6d181163c015a56c84800c5e6

Contents?: true

Size: 1.11 KB

Versions: 10

Compression:

Stored size: 1.11 KB

Contents

require_dependency "panda_pal/application_controller"

module PandaPal
  class LtiV1P0Controller < ApplicationController
    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

    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
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
panda_pal-5.3.5 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.3.4 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.3.2 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.3.0 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.2.5 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.2.4 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.2.3 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.2.2 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.2.1 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.2.0 app/controllers/panda_pal/lti_v1_p0_controller.rb