Class: Users::ActivityService

Inherits:
Object
  • Object
show all
Defined in:
app/services/users/activity_service.rb

Constant Summary collapse

LEASE_TIMEOUT =
1.minute.to_i

Instance Method Summary collapse

Constructor Details

#initialize(author) ⇒ ActivityService

Returns a new instance of ActivityService.


7
8
9
10
11
12
13
14
15
# File 'app/services/users/activity_service.rb', line 7

def initialize(author)
  @user = if author.respond_to?(:username)
            author
          elsif author.respond_to?(:user)
            author.user
          end

  @user = nil unless @user.is_a?(User)
end

Instance Method Details

#executeObject


17
18
19
20
21
# File 'app/services/users/activity_service.rb', line 17

def execute
  return unless @user

  record_activity
end