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

payrollhero / dispatch-rider / #3015

02 Sep 2022 11:22PM UTC coverage: 0.409% (-84.7%) from 85.154%
#3015

push

web-flow
Layout/SpaceInsideStringInterpolation-20220901233630 (#89)

* :police_car: regenerate rubocop todo

* :police_car: Layout/SpaceInsideStringInterpolation

* :police_car: regenerate rubocop todo

Co-authored-by: Rubocop Challenger <rubocop@payrollhero.com>

0 of 1 new or added line in 1 file covered. (0.0%)

1529 existing lines in 63 files now uncovered.

7 of 1711 relevant lines covered (0.41%)

0.0 hits per line

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

0.0
/lib/dispatch-rider/notification_services/base.rb
1
# This base class provides an interface that we can implement
2
# to generate a wrapper around a notification service.
3
# The expected usage is as follows :
4
#   notification_service = DispatchRider::NotificationServices::Base.new
5
#   notification_service.publish(:to => [:foo, :oof], :message => {:subject => "bar", :body => "baz"})
6

UNCOV
7
require 'forwardable'
×
8

UNCOV
9
module DispatchRider
×
UNCOV
10
  module NotificationServices
×
UNCOV
11
    class Base
×
UNCOV
12
      extend Forwardable
×
13

UNCOV
14
      attr_reader :notifier, :channel_registrar
×
15

UNCOV
16
      def_delegators :channel_registrar, :register, :fetch, :unregister
×
17

UNCOV
18
      def initialize(options = {})
×
UNCOV
19
        @notifier = notifier_builder.new(options)
×
UNCOV
20
        @channel_registrar = channel_registrar_builder.new
×
UNCOV
21
      end
×
22

UNCOV
23
      def notifier_builder
×
24
        raise NotImplementedError
×
UNCOV
25
      end
×
26

UNCOV
27
      def channel_registrar_builder
×
28
        raise NotImplementedError
×
UNCOV
29
      end
×
30

UNCOV
31
      def publish(to:, message:)
×
UNCOV
32
        channels(to).each { |channel| publish_to_channel channel, message: message }
×
UNCOV
33
      end
×
34

UNCOV
35
      def channels(names)
×
UNCOV
36
        Array(names).map { |name| channel(name) }
×
UNCOV
37
      end
×
38

UNCOV
39
      def channel(name)
×
40
        raise NotImplementedError
×
UNCOV
41
      end
×
42

UNCOV
43
      def publish_to_channel(channel, message:)
×
UNCOV
44
        channel.publish(message: serialize(message))
×
UNCOV
45
      end
×
46

UNCOV
47
      private
×
48

UNCOV
49
      def serialize(item)
×
UNCOV
50
        item.to_json
×
UNCOV
51
      end
×
UNCOV
52
    end
×
UNCOV
53
  end
×
UNCOV
54
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

© 2025 Coveralls, Inc