Sha256: 998a0c8b6367eff75f29c43c3352cb0ccb2b09f05e52e3570c569399fd8ba012

Contents?: true

Size: 1023 Bytes

Versions: 7

Compression:

Stored size: 1023 Bytes

Contents

require_dependency "coalescing_panda/application_controller"

module CoalescingPanda
  class LtiController < ApplicationController

    def lti_config
      lti_options = CoalescingPanda.lti_options
      lti_nav = CoalescingPanda.lti_paths
      platform = 'canvas.instructure.com'
      host = "#{request.scheme}://#{request.host_with_port}"
      tc = IMS::LTI::ToolConfig.new(:title => lti_options[:title], :launch_url => (lti_options[:launch_url])|| 'ABC')
      tc.set_ext_param(platform, :domain, request.host)
      tc.set_ext_param(platform, :privacy_level, 'public')
      lti_nav.each do |k, v|
        tc.set_ext_param(platform, "#{k.to_s}_navigation".to_sym, ext_params(v) )
      end

      #strip the launch url
      xml = tc.to_xml.sub( /<blti:launch_url>.*<\/blti:launch_url>/, '') if lti_options[:launch_url].blank?
      render :xml => xml
    end

    private

    def ext_params(options)
      url = options.delete(:url)
      options[:url] = main_app.send(url+'_url')
      options
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
coalescing_panda-0.0.7 app/controllers/coalescing_panda/lti_controller.rb
coalescing_panda-0.0.6 app/controllers/coalescing_panda/lti_controller.rb
coalescing_panda-0.0.5 app/controllers/coalescing_panda/lti_controller.rb
coalescing_panda-0.0.4 app/controllers/coalescing_panda/lti_controller.rb
coalescing_panda-0.0.3 app/controllers/coalescing_panda/lti_controller.rb
coalescing_panda-0.0.2 app/controllers/coalescing_panda/lti_controller.rb
coalescing_panda-0.0.1 app/controllers/coalescing_panda/lti_controller.rb