Module: ForstokTrigger::Webhook::Trigger

Defined in:
lib/forstok_trigger/webhook/trigger.rb

Overview

Module Trigger is main module for run perform webhook trigger

Class Method Summary collapse

Class Method Details

.get_webhooks(event, channel_id) ⇒ Object



21
22
23
24
# File 'lib/forstok_trigger/webhook/trigger.rb', line 21

def self.get_webhooks(event, channel_id)
  ForstokTrigger::Webhook::Repository::WebhookRepository
    .webhook_list(event, channel_id)
end

.perform(event, event_payload, channel_id) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/forstok_trigger/webhook/trigger.rb', line 8

def self.perform(event, event_payload, channel_id)
  webhooks = get_webhooks(event, channel_id)
  webhooks.each do |webhook|
    ForstokTrigger::Webhook::Repository::WebhookRepository
      .webhook_insert_pending(
        webhook['name'],
        webhook['url'],
        event_payload,
        channel_id
      )
  end
end