Class: ActsAsNotifiableRedmine::Couriers::PusherCourier

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_notifiable_redmine/couriers/pusher_courier.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ PusherCourier

Returns a new instance of PusherCourier.



23
24
25
26
27
28
29
30
31
32
# File 'lib/acts_as_notifiable_redmine/couriers/pusher_courier.rb', line 23

def initialize(&block)
  @name      = 'Pusher'
  @app_id    = ''
  @key       = ''
  @secret    = ''
  @encrypted = true

  instance_eval(&block)
  setup_pusher
end

Class Method Details

.def_field(*names) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/acts_as_notifiable_redmine/couriers/pusher_courier.rb', line 9

def def_field(*names)
  class_eval do
    names.each do |name|
      define_method(name) do |*args|
        args.empty? ? instance_variable_get("@#{name}") : instance_variable_set("@#{name}", *args)
      end
    end
  end
end

Instance Method Details

#send_notification(channels, event, options) ⇒ Object



35
36
37
# File 'lib/acts_as_notifiable_redmine/couriers/pusher_courier.rb', line 35

def send_notification(channels, event, options)
  Pusher.trigger(channels, event, options)
end