Class: WebHooks::WebHookLogsFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/web_hooks/web_hook_logs_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hook, current_user, params = {}) ⇒ WebHookLogsFinder

Returns a new instance of WebHookLogsFinder.



7
8
9
10
11
# File 'app/finders/web_hooks/web_hook_logs_finder.rb', line 7

def initialize(hook, current_user, params = {})
  @hook = hook
  @current_user = current_user
  @params = params
end

Instance Attribute Details

#current_userObject

Returns the value of attribute current_user.



5
6
7
# File 'app/finders/web_hooks/web_hook_logs_finder.rb', line 5

def current_user
  @current_user
end

#hookObject

Returns the value of attribute hook.



5
6
7
# File 'app/finders/web_hooks/web_hook_logs_finder.rb', line 5

def hook
  @hook
end

#paramsObject

Returns the value of attribute params.



5
6
7
# File 'app/finders/web_hooks/web_hook_logs_finder.rb', line 5

def params
  @params
end

Instance Method Details

#executeObject



13
14
15
16
17
18
19
20
# File 'app/finders/web_hooks/web_hook_logs_finder.rb', line 13

def execute
  return WebHookLog.none unless authorized?

  logs = hook.web_hook_logs
  logs = by_status_code(logs)
  logs = by_created_at(logs)
  by_id(logs)
end