Class: Keys::ExpiryNotificationService

Inherits:
BaseService show all
Defined in:
app/services/keys/expiry_notification_service.rb

Instance Attribute Summary collapse

Attributes inherited from BaseService

#params, #user

Instance Method Summary collapse

Methods inherited from BaseService

#notification_service

Constructor Details

#initialize(user, params) ⇒ ExpiryNotificationService

Returns a new instance of ExpiryNotificationService.



7
8
9
10
11
12
# File 'app/services/keys/expiry_notification_service.rb', line 7

def initialize(user, params)
  @keys = params[:keys]
  @expiring_soon = params[:expiring_soon]

  super
end

Instance Attribute Details

#expiring_soonObject

Returns the value of attribute expiring_soon.



5
6
7
# File 'app/services/keys/expiry_notification_service.rb', line 5

def expiring_soon
  @expiring_soon
end

#keysObject

Returns the value of attribute keys.



5
6
7
# File 'app/services/keys/expiry_notification_service.rb', line 5

def keys
  @keys
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
# File 'app/services/keys/expiry_notification_service.rb', line 14

def execute
  return unless allowed?

  if expiring_soon
    trigger_expiring_soon_notification
  else
    trigger_expired_notification
  end
end