-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
36 lines (27 loc) · 912 Bytes
/
app.rb
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
# frozen_string_literal: true
require 'date'
require 'dotenv/load'
require 'sinatra'
require 'zeitwerk'
loader = Zeitwerk::Loader.new
loader.push_dir("#{__dir__}/lib/")
loader.enable_reloading
loader.setup
before { loader.reload }
use Rack::Auth::Basic, "Protected Area" do |username, password|
username == ENV['USERNAME'] && password == ENV['PASSWORD']
end
get '/' do
gateway = Sinatra::Application.environment == :development ? GoogleSheetsSimulator.new : Gateway::GoogleSpreadsheet.new
response = UseCase::ViewTeams.new(
google_spreadsheet_gateway: gateway
).execute
erb :index, locals: { data: response }
end
get '/present' do
gateway = Sinatra::Application.environment == :development ? GoogleSheetsSimulator.new : Gateway::GoogleSpreadsheet.new
response = UseCase::ViewTeams.new(
google_spreadsheet_gateway: gateway
).execute
erb :present, locals: { data: response }
end