Class: PandaPal::Session

Inherits:
PandaPalRecord show all
Defined in:
app/models/panda_pal/session.rb

Defined Under Namespace

Classes: DataSerializer

Instance Method Summary collapse

Instance Method Details

#custom_lti_paramsObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/panda_pal/session.rb', line 15

def custom_lti_params
  launch_params = data[:launch_params] || {}

  # LT 1.3
  custom_params = launch_params["https://purl.imsglobal.org/spec/lti/claim/custom"]
  return custom_params if custom_params.present?

  # LTI 1.0/1.1
  custom_params = {}
  launch_params.each do |k, v|
    next unless k.start_with?("custom_")
    custom_params[k[7..-1]] = v
  end

  custom_params.with_indifferent_access
end

#lti_platformObject



9
10
11
12
13
# File 'app/models/panda_pal/session.rb', line 9

def lti_platform
  return nil unless data[:lti_platform].present?

  @lti_platform ||= Platform.from_serialized(data[:lti_platform])
end