tzispa 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/tzispa/controller/api.rb +8 -5
- data/lib/tzispa/controller/base.rb +5 -5
- data/lib/tzispa/http/context.rb +2 -2
- data/lib/tzispa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3c9ec75a6f6b5e1a856c9efaf1a194018b4c681
|
4
|
+
data.tar.gz: f0fb7fa9a508b73195bd771f5d28b65ef2351bf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37c653c9b2283901357381d58ede86a80ab844e77cd0977bd5e7d52609788f81668fd3fa830782cebaa82fc53f2d2d6a3bc7f82f5b9c8b517ff2e7767927846b
|
7
|
+
data.tar.gz: ac0e1ef05c586f958873a46bcf9b3c8630a8de6449e536daabae0291ad39d144d8275bc66cba6aebf67e641feb7206f04b62ce734eb91357fc10ac1099786f75
|
data/CHANGELOG.md
CHANGED
@@ -22,8 +22,7 @@ module Tzispa
|
|
22
22
|
predicate = context.router_params[:predicate]
|
23
23
|
handler = prepare_handler
|
24
24
|
handler.run! verb, predicate
|
25
|
-
send(handler.type, handler)
|
26
|
-
response.finish
|
25
|
+
send(handler.type || :empty, handler)
|
27
26
|
end
|
28
27
|
|
29
28
|
def prepare_handler
|
@@ -47,6 +46,10 @@ module Tzispa
|
|
47
46
|
end
|
48
47
|
end
|
49
48
|
|
49
|
+
def empty(handler)
|
50
|
+
api_response nil, nil, handler.status, handler.error
|
51
|
+
end
|
52
|
+
|
50
53
|
def redirect(handler)
|
51
54
|
api_flash(handler.message) if handler.error?
|
52
55
|
context.redirect handler.redirect_url(handler.data), config.absolute_redirects, response
|
@@ -80,9 +83,9 @@ module Tzispa
|
|
80
83
|
context.flash << message if config.sessions&.enabled
|
81
84
|
end
|
82
85
|
|
83
|
-
def api_response(type, content, status = nil, error = nil)
|
84
|
-
content_type type
|
85
|
-
response.body
|
86
|
+
def api_response(type = nil, content = nil, status = nil, error = nil)
|
87
|
+
content_type(type) if type
|
88
|
+
response.body = content if content
|
86
89
|
response.status = status if status
|
87
90
|
api_headers error
|
88
91
|
end
|
@@ -41,17 +41,17 @@ module Tzispa
|
|
41
41
|
do_after
|
42
42
|
}
|
43
43
|
rescue Tzispa::Rig::NotFound => ex
|
44
|
-
|
44
|
+
prepare_response(404, error: ex)
|
45
45
|
rescue StandardError, ScriptError, SecurityError => ex
|
46
|
-
|
46
|
+
prepare_response(500, error: ex)
|
47
47
|
end
|
48
48
|
|
49
|
-
def prepare_response(status, content
|
49
|
+
def prepare_response(status, content: nil, error: nil)
|
50
50
|
response.status = status if status.is_a?(Integer)
|
51
51
|
if context.client_error?
|
52
|
-
prepare_client_error(status)
|
52
|
+
prepare_client_error(status, error)
|
53
53
|
elsif context.server_error?
|
54
|
-
prepare_server_error(status)
|
54
|
+
prepare_server_error(status, error)
|
55
55
|
elsif content
|
56
56
|
response.body = content
|
57
57
|
end
|
data/lib/tzispa/http/context.rb
CHANGED
@@ -102,7 +102,7 @@ module Tzispa
|
|
102
102
|
"#{canonical_root}#{app_layout_path(app_name, layout, params)}"
|
103
103
|
end
|
104
104
|
|
105
|
-
def api(handler, verb, predicate, sufix, app_name = nil)
|
105
|
+
def api(handler, verb, predicate = nil, sufix = nil, app_name = nil)
|
106
106
|
if app_name
|
107
107
|
app_canonical_url app_name, :api, handler: handler, verb: verb,
|
108
108
|
predicate: predicate, sufix: sufix
|
@@ -112,7 +112,7 @@ module Tzispa
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
-
def sapi(handler, verb, predicate, sufix, app_name = nil)
|
115
|
+
def sapi(handler, verb, predicate = nil, sufix = nil, app_name = nil)
|
116
116
|
if app_name
|
117
117
|
sign = sign_array [handler, verb, predicate], app[:app_name].config.salt
|
118
118
|
app_canonical_url app_name, :sapi, sign: sign, handler: handler,
|
data/lib/tzispa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tzispa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Antonio Piñero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|