Class: ApiRequest
Class Method Summary
collapse
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
= {
"Framework" => "Liza #{Lizarb::VERSION}"
}
body = ""
segments = Array path.split("/")[1..-1]
case segments
in "api", "auth", "sign_up"
body = render_route_api_auth_sign_up
in "api", "auth", "sign_in"
body = render_route_api_auth_sign_in
in "api", "auth", "account"
body = render_route_api_auth_account
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, , [body]]
end
|
.render_route_api_auth_account ⇒ Object
47
48
49
|
# File 'app/web/requests/api_request.rb', line 47
def self.render_route_api_auth_account
{route: "render_route_api_auth_account"}
end
|
.render_route_api_auth_sign_in ⇒ Object
43
44
45
|
# File 'app/web/requests/api_request.rb', line 43
def self.render_route_api_auth_sign_in
{route: "render_route_api_auth_sign_in"}
end
|
.render_route_api_auth_sign_out ⇒ Object
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_up ⇒ Object
39
40
41
|
# File 'app/web/requests/api_request.rb', line 39
def self.render_route_api_auth_sign_up
{route: "render_route_api_auth_sign_up"}
end
|
.render_route_api_users ⇒ Object
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
|