Class: Agents::MailgunAgent
- Inherits:
-
Agent
- Object
- Agent
- Agents::MailgunAgent
- Includes:
- FormConfigurable
- Defined in:
- lib/huginn_mailgun_agent/mailgun_agent.rb
Instance Method Summary collapse
- #check ⇒ Object
- #default_options ⇒ Object
- #receive(incoming_events) ⇒ Object
- #validate_options ⇒ Object
- #working? ⇒ Boolean
Instance Method Details
#check ⇒ Object
89 90 91 |
# File 'lib/huginn_mailgun_agent/mailgun_agent.rb', line 89 def check handle(interpolated) end |
#default_options ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/huginn_mailgun_agent/mailgun_agent.rb', line 51 def { 'connection_url' => 'mysql2://user:pass@localhost/database', 'sql' => 'select email, name from emails order by id desc', 'merge_event' => 'false', 'mailgun_apikey' => '', 'from_address' => '[email protected]', 'testing_mode' => 'false', 'mailgun_domain' => '', 'mailgun_tracking' => 'false', } end |
#receive(incoming_events) ⇒ Object
93 94 95 96 97 |
# File 'lib/huginn_mailgun_agent/mailgun_agent.rb', line 93 def receive(incoming_events) incoming_events.each do |event| handle(interpolated(event), event.payload) end end |
#validate_options ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/huginn_mailgun_agent/mailgun_agent.rb', line 74 def if ['merge_event'].present? && !%[true false].include?(['merge_event'].to_s) errors.add(:base, "Oh no!!! if provided, merge_event must be 'true' or 'false'") end errors.add(:base, "Mailgun API Key Missing") unless ['mailgun_apikey'].present? errors.add(:base, "Missing From Address") unless ['from_address'].present? errors.add(:base, "Missing Mailgun Domain") unless ['mailgun_domain'].present? end |
#working? ⇒ Boolean
85 86 87 |
# File 'lib/huginn_mailgun_agent/mailgun_agent.rb', line 85 def working? !recent_error_logs? end |