2015-11-10 14:01:04 +00:00
|
|
|
class Sessions::Event
|
|
|
|
include ApplicationLib
|
|
|
|
|
2015-12-09 13:09:37 +00:00
|
|
|
def self.run(params)
|
|
|
|
adapter = "Sessions::Event::#{params[:event].to_classname}"
|
2015-11-12 07:51:52 +00:00
|
|
|
|
2015-11-10 14:05:29 +00:00
|
|
|
begin
|
|
|
|
backend = load_adapter(adapter)
|
|
|
|
rescue => e
|
2015-12-09 13:09:37 +00:00
|
|
|
return { error: "No such event #{params[:event]}" }
|
2015-11-10 14:05:29 +00:00
|
|
|
end
|
2015-11-10 14:01:04 +00:00
|
|
|
|
2015-12-09 13:09:37 +00:00
|
|
|
instance = backend.new(params)
|
2015-11-11 13:10:26 +00:00
|
|
|
result = instance.run
|
2015-12-09 13:09:37 +00:00
|
|
|
instance.destroy
|
2015-11-10 14:05:29 +00:00
|
|
|
result
|
2015-11-10 14:01:04 +00:00
|
|
|
end
|
|
|
|
|
2015-11-10 14:05:29 +00:00
|
|
|
end
|