module IMS::LTI::Extensions::Content::ToolProvider
Public Instance Methods
accepted_content_types()
click to toggle source
a list of the supported outcome data types
# File lib/ims/lti/extensions/content.rb, line 27 def accepted_content_types return @content_types if @content_types @content_types = [] if val = @ext_params["content_return_types"] @content_types = val.split(',').map {|i| i.to_sym} end @content_types end
accepted_file_extensions()
click to toggle source
# File lib/ims/lti/extensions/content.rb, line 37 def accepted_file_extensions return @file_extensions if @file_extensions @file_extensions = [] if val = @ext_params["content_file_extensions"] @file_extensions = val.split(',').map {|i| i.downcase.strip} end @file_extensions end
accepts_content?()
click to toggle source
check if the content extension is supported
# File lib/ims/lti/extensions/content.rb, line 79 def accepts_content? !!@ext_params["content_return_types"] end
accepts_content_type?(content_type)
click to toggle source
check if the consumer accepts a given type of content
# File lib/ims/lti/extensions/content.rb, line 84 def accepts_content_type?(content_type) accepted_content_types.include? content_type.to_sym end
accepts_file?(file_name = nil)
click to toggle source
# File lib/ims/lti/extensions/content.rb, line 47 def accepts_file?(file_name = nil) accepted_content_types.include?(:file) && ( file_name.nil? || accepted_file_extensions.empty? || accepted_file_extensions.any?{|ext| file_name.downcase[/#{ext}$/]} ) end
accepts_iframe?()
click to toggle source
# File lib/ims/lti/extensions/content.rb, line 66 def accepts_iframe? accepted_content_types.include?(:iframe) end
accepts_image_url?()
click to toggle source
# File lib/ims/lti/extensions/content.rb, line 62 def accepts_image_url? accepted_content_types.include?(:image_url) end
accepts_lti_launch_url?()
click to toggle source
# File lib/ims/lti/extensions/content.rb, line 58 def accepts_lti_launch_url? accepted_content_types.include?(:lti_launch_url) end
accepts_oembed?()
click to toggle source
# File lib/ims/lti/extensions/content.rb, line 70 def accepts_oembed? accepted_content_types.include?(:oembed) end
accepts_url?()
click to toggle source
# File lib/ims/lti/extensions/content.rb, line 54 def accepts_url? accepted_content_types.include?(:url) end
content_intended_use()
click to toggle source
# File lib/ims/lti/extensions/content.rb, line 74 def content_intended_use @ext_params["content_intended_use"].to_sym if @ext_params["content_intended_use"] end
content_return_url()
click to toggle source
# File lib/ims/lti/extensions/content.rb, line 93 def content_return_url @ext_params["content_return_url"] end
file_content_return_url(url, text, content_type = nil)
click to toggle source
generates the return url for file submissions
# File lib/ims/lti/extensions/content.rb, line 98 def file_content_return_url(url, text, content_type = nil) url = CGI::escape(url) text = CGI::escape(text) content_type = CGI::escape(content_type) if content_type return_url = "#{content_return_url}?return_type=file&url=#{url}&text=#{text}" return_url = "#{return_url}&content_type=#{content_type}" if content_type return return_url end
iframe_content_return_url(url, width, height, title = nil)
click to toggle source
generates the return url for iframe submissions
# File lib/ims/lti/extensions/content.rb, line 143 def iframe_content_return_url(url, width, height, title = nil) url = CGI::escape(url) width = CGI::escape(width.to_s) height = CGI::escape(height.to_s) return_url = "#{content_return_url}?return_type=iframe&url=#{url}&width=#{width}&height=#{height}" return_url = "#{return_url}&title=#{CGI::escape(title)}" if title return return_url end
image_content_return_url(url, width, height, alt = '')
click to toggle source
generates the return url for image submissions
# File lib/ims/lti/extensions/content.rb, line 133 def image_content_return_url(url, width, height, alt = '') url = CGI::escape(url) width = CGI::escape(width.to_s) height = CGI::escape(height.to_s) alt = CGI::escape(alt) "#{content_return_url}?return_type=image_url&url=#{url}&width=#{width}&height=#{height}&alt=#{alt}" end
is_content_for?(intended_use)
click to toggle source
check the use of the content
# File lib/ims/lti/extensions/content.rb, line 89 def is_content_for? (intended_use) content_intended_use == intended_use end
lti_launch_content_return_url(url, text='link', title=nil)
click to toggle source
generates the return url for lti launch submissions
# File lib/ims/lti/extensions/content.rb, line 122 def lti_launch_content_return_url(url, text='link', title=nil) url = CGI::escape(url) text = CGI::escape(text) return_url = "#{content_return_url}?return_type=lti_launch_url&url=#{url}&text=#{text}" return_url = "#{return_url}&title=#{CGI::escape(title)}" if title return return_url end
oembed_content_return_url(url, endpoint)
click to toggle source
generates the return url for oembed submissions
# File lib/ims/lti/extensions/content.rb, line 155 def oembed_content_return_url(url, endpoint) url = CGI::escape(url) endpoint = CGI::escape(endpoint) "#{content_return_url}?return_type=oembed&url=#{url}&endpoint=#{endpoint}" end
url_content_return_url(url, title = nil, text = 'link', target = '_blank')
click to toggle source
generates the return url for url submissions
# File lib/ims/lti/extensions/content.rb, line 110 def url_content_return_url(url, title = nil, text = 'link', target = '_blank') url = CGI::escape(url) text = CGI::escape(text) target = CGI::escape(target) return_url = "#{content_return_url}?return_type=url&url=#{url}&text=#{text}&target=#{target}" return_url = "#{return_url}&title=#{CGI::escape(title)}" if title return return_url end