manual_event_agent.rb 649 B

1234567891011121314151617181920212223242526272829303132
  1. module Agents
  2. class ManualEventAgent < Agent
  3. cannot_be_scheduled!
  4. cannot_receive_events!
  5. description <<-MD
  6. Use this Agent to manually create Events for testing or other purposes.
  7. MD
  8. event_description "User determined"
  9. def default_options
  10. { "no options" => "are needed" }
  11. end
  12. def handle_details_post(params)
  13. if params['payload']
  14. create_event(:payload => params['payload'])
  15. { :success => true }
  16. else
  17. { :success => false, :error => "You must provide a JSON payload" }
  18. end
  19. end
  20. def working?
  21. true
  22. end
  23. def validate_options
  24. end
  25. end
  26. end