Module: Webhooks::Incoming::Webhook
- Included in:
- BulletTrainWebhook
- Defined in:
- app/models/webhooks/incoming/webhook.rb
Instance Method Summary collapse
- #mark_processed ⇒ Object
- #process_async ⇒ Object
- #processed? ⇒ Boolean
- #verified? ⇒ Boolean
- #verify_and_process ⇒ Object
- #verify_authenticity ⇒ Object
Instance Method Details
#mark_processed ⇒ Object
21 22 23 |
# File 'app/models/webhooks/incoming/webhook.rb', line 21 def mark_processed touch(:processed_at) end |
#process_async ⇒ Object
13 14 15 |
# File 'app/models/webhooks/incoming/webhook.rb', line 13 def process_async Webhooks::Incoming::WebhookProcessingJob.perform_later(self) end |
#processed? ⇒ Boolean
17 18 19 |
# File 'app/models/webhooks/incoming/webhook.rb', line 17 def processed? processed_at.present? end |
#verified? ⇒ Boolean
6 7 8 9 10 11 |
# File 'app/models/webhooks/incoming/webhook.rb', line 6 def verified? unless verified_at touch(:verified_at) if verify_authenticity end verified_at.present? end |
#verify_and_process ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/models/webhooks/incoming/webhook.rb', line 25 def verify_and_process return if processed? if verified? process mark_processed end end |
#verify_authenticity ⇒ Object
2 3 4 |
# File 'app/models/webhooks/incoming/webhook.rb', line 2 def verify_authenticity raise "you must either implement `verify_authenticity` in #{self.class.name} or perform verification and set `verified_at` in #{self.class.name}sController." end |