-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.rb
More file actions
55 lines (47 loc) · 973 Bytes
/
app.rb
File metadata and controls
55 lines (47 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require 'sinatra'
require 'sinatra/namespace'
require './lib/redis_connector.rb'
class String
def to_bool
return true if self == "true"
return false if self == "false"
end
end
configure do
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/lib")
Dir.glob("#{File.dirname(__FILE__)}/lib/*.rb") { |lib|
require File.basename(lib, '.*')
}
end
namespace '/fdic' do
get '/badge' do
if fdic_valid?
send_file 'fdic_safe.svg'
else
send_file 'fdic_errors.svg'
end
end
get '/status' do
content_type :json
{ schema_good: fdic_valid? }.to_json
end
end
namespace '/ncua' do
get '/badge' do
if ncua_valid?
send_file 'ncua_safe.svg'
else
send_file 'ncua_errors.svg'
end
end
get '/status' do
content_type :json
{ schema_good: ncua_valid? }.to_json
end
end
def fdic_valid?
RedisConnector.get('fdic_status').to_bool
end
def ncua_valid?
RedisConnector.get('ncua_status').to_bool
end