Class: Route500Check::Checker

Inherits:
Object
  • Object
show all
Defined in:
lib/route_500_check/checker.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_url) ⇒ Checker

Returns a new instance of Checker.



8
9
10
# File 'lib/route_500_check/checker.rb', line 8

def initialize(base_url)
  @base_url = base_url
end

Instance Method Details

#check(path) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/route_500_check/checker.rb', line 12

def check(path)
  uri   = build_uri(path)
  start = now

  response = Net::HTTP.get_response(uri)
  finish   = now

  build_success_result(
    path: path,
    uri: uri,
    response: response,
    start: start,
    finish: finish
  )
rescue => e
  finish = now rescue nil

  build_error_result(
    path: path,
    uri: uri,
    error: e,
    start: start,
    finish: finish
  )
end