Class: ApiRequest

Inherits:
AppRequest show all
Defined in:
app/web/requests/api_request.rb

Class Method Summary collapse

Methods inherited from Liza::Controller

color, inherited, on_connected

Methods inherited from Liza::Unit

const_missing, division, part, system, #system, test_class

Class Method Details

.call(env) ⇒ Object



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
# File 'app/web/requests/api_request.rb', line 3

def self.call env
  path = env["REQUEST_PATH"]

  #

  status = 200
  headers = {
    "Framework" => "Liza #{Lizarb::VERSION}"
  }
  body = ""

  #

  segments = Array path.split("/")[1..-1]

  case segments
  in "api", "auth", "sign_up"
    body = 
  in "api", "auth", "sign_in"
    body = 
  in "api", "auth", "account"
    body = 
  in "api", "auth", "sign_out"
    body = render_route_api_auth_sign_out
  in "api", "users"
    body = render_route_api_users
  else
    status = 404
    body = render_route_not_found env["LIZA_PATH"]
  end

  body = body.to_json

  [status, headers, [body]]
end

.render_route_api_auth_accountObject



47
48
49
# File 'app/web/requests/api_request.rb', line 47

def self.
  {route: "render_route_api_auth_account"}
end

.render_route_api_auth_sign_inObject



43
44
45
# File 'app/web/requests/api_request.rb', line 43

def self.
  {route: "render_route_api_auth_sign_in"}
end

.render_route_api_auth_sign_outObject



51
52
53
# File 'app/web/requests/api_request.rb', line 51

def self.render_route_api_auth_sign_out
  {route: "render_route_api_auth_sign_out"}
end

.render_route_api_auth_sign_upObject



39
40
41
# File 'app/web/requests/api_request.rb', line 39

def self.
  {route: "render_route_api_auth_sign_up"}
end

.render_route_api_usersObject



55
56
57
# File 'app/web/requests/api_request.rb', line 55

def self.render_route_api_users
  {route: "render_route_api_users"}
end

.render_route_not_found(path) ⇒ Object



59
60
61
# File 'app/web/requests/api_request.rb', line 59

def self.render_route_not_found path
  {route: "render_route_not_found #{path}"}
end