Open cycomachead opened 8 years ago
I was able to do the second part by modifying DceLti::SessionHelpers::capture_attributes_from
def captured_attributes_from(tool_provider)
attributes_to_copy = Engine.config.copy_launch_attributes_to_session
if attributes_to_copy.respond_to?(:call)
attributes_to_copy = attributes_to_copy.call(params)
end
attributes_to_copy.inject({}) do |attributes, att|
attributes.merge(att => params[att]) #tool_provider.send(att)
end
end
So far things seem to work, but I'm unsure about replacing tool_provider.send
. The problem is, the ims_lti module separates params on its own, so you can't directly access a custom param, because you need to go through tool_provider.custom_params[:custom_...]
. It seems like tool_provider
is mere aggregating, and not modifying the params here, so it doesn't look like this is causing issues but I'm not sure.
@cycomachead I am in a completely different problem space right now and can't context switch, but I will look through and think about this (probably tomorrow). Thanks for trying to push through it yourself!
Thanks for the reply! No rush though. :)
I realize my path breaks the current rspec tests, so I'm going to look into that, and I'll update this if I find anything.
I'm working on an app where I'd like to be able to log custom parameters passed by the consumer.
However, the catch is that I won't know what those parameters are. These show as custom_*.
Essentially I'd like to do something like:
In this version, there'd need to be some defined type of syntax, or better yet, you could allow
copy_launch_attributes_to_session
to be an array including regex's which would callmatch
for the keys.Or possibly:
Then you could really do whatever you'd like inside the lambda, which seems like a more flexible approach.
I'm fairly new to ruby, but I'd be happy to take a stab at implementing one option (probably the second).
Or is there a way to do this already? :)