Module: WebhookTrigger::Trigger

Defined in:
lib/webhook_trigger/trigger.rb

Overview

Class Trigger is main class for run perform

Class Method Summary collapse

Class Method Details

.get_webhooks(event, account_id) ⇒ Object



20
21
22
23
# File 'lib/webhook_trigger/trigger.rb', line 20

def self.get_webhooks(event, )
  WebhookTrigger::Repository::TriggerRepository
    .webhook_list(event, )
end

.perform(event, event_source_id, account_id) ⇒ Object



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

def self.perform(event, event_source_id, )
  webhooks = get_webhooks(event, )
  webhooks.each do |webhook|
    WebhookTrigger::Repository::TriggerRepository
      .webhook_insert_pending(
        webhook['name'],
        webhook['url'],
        event_source_id
      )
  end
end