Class: ActiveDeliveryRpush::Driver

Inherits:
Object
  • Object
show all
Defined in:
lib/active_delivery_rpush/driver.rb

Instance Method Summary collapse

Constructor Details

#initialize(notification_klass) ⇒ Driver

Returns a new instance of Driver.



5
6
7
# File 'lib/active_delivery_rpush/driver.rb', line 5

def initialize(notification_klass)
  @notification_klass = notification_klass
end

Instance Method Details

#call(params) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
# File 'lib/active_delivery_rpush/driver.rb', line 9

def call(params)
  raise ArgumentError, "`app` must be passed as a param" unless params.fetch(:app, nil)

  notification = @notification_klass.new(
    params
  )

  notification.save!
end