event.rb 371 B

12345678910111213141516171819
  1. class Sessions::Event
  2. include ApplicationLib
  3. def self.run(params)
  4. adapter = "Sessions::Event::#{params[:event].to_classname}"
  5. begin
  6. backend = load_adapter(adapter)
  7. rescue => e
  8. return { error: "No such event #{params[:event]}" }
  9. end
  10. instance = backend.new(params)
  11. result = instance.run
  12. instance.destroy
  13. result
  14. end
  15. end