• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

payrollhero / webhook_system / #852

23 Apr 2025 09:54AM UTC coverage: 8.333% (+8.0%) from 0.293%
#852

push

web-flow
Merge feaf9aa23 into 523bc8de4

1 of 2 new or added lines in 1 file covered. (50.0%)

27 of 324 relevant lines covered (8.33%)

0.08 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

62.5
/lib/webhook_system/event_log.rb
1
# frozen_string_literal: true
2

3
module WebhookSystem
1✔
4

5
  # This is the model holding on to all webhook responses
6
  class EventLog < ActiveRecord::Base
1✔
7
    self.table_name = 'webhook_event_logs'
1✔
8

9
    MAX_JSON_ATTRIBUTE_SIZE = 40_000
1✔
10

11
    belongs_to :subscription, class_name: 'WebhookSystem::Subscription'
1✔
12

13
    validates :event_id, presence: true
1✔
14
    validates :subscription_id, presence: true
1✔
15
    validates :event_name, presence: true
1✔
16
    validates :status, presence: true
1✔
17

18
    serialize :request, coder: JSON
1✔
NEW
19
    serialize :response, coder: JSON
×
20

21
    def self.construct(subscription, event, request, response)
×
22
      request_info = {
23
        'event' => event,
×
24
        'headers' => request.headers.to_hash,
25
        'body' => request.body.truncate(MAX_JSON_ATTRIBUTE_SIZE),
26
        'url' => request.path,
27
      }
28
      response_info = {
29
        'headers' => response.headers.to_hash,
×
30
        'body' => response.body.truncate(MAX_JSON_ATTRIBUTE_SIZE),
31
      }
32

33
      attributes = {
34
        event_name: event['event_name'],
×
35
        event_id: event['event_id'],
36
        status: response.status,
37
        request: request_info,
38
        response: response_info,
39
      }
40
      subscription.event_logs.build(attributes)
×
41
    end
42
  end
43
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc