Sha256: d324870233834d963f3c1237c17542ae51b4efae419a18b3fff71ea129a3e16e

Contents?: true

Size: 1.16 KB

Versions: 30

Compression:

Stored size: 1.16 KB

Contents

require_dependency "panda_pal/application_controller"

module PandaPal
  class LtiV1P0Controller < ApplicationController
    skip_before_action :verify_authenticity_token

    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

30 entries across 30 versions & 1 rubygems

Version Path
panda_pal-5.6.1 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.6.0 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.11 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.10 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.9 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.8 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.7 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.6 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.5 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.4 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.3 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.2 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.1 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.0 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.0.beta10 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.0.beta9 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.0.beta8 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.0.beta7 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.0.beta6 app/controllers/panda_pal/lti_v1_p0_controller.rb
panda_pal-5.4.0.beta5 app/controllers/panda_pal/lti_v1_p0_controller.rb