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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30879555b79aeb8632bf06e8be4d195e9f12b0cd
4
- data.tar.gz: 8f706c9e46ab36845c37c949442d1d574ba2a457
3
+ metadata.gz: e3c9ec75a6f6b5e1a856c9efaf1a194018b4c681
4
+ data.tar.gz: f0fb7fa9a508b73195bd771f5d28b65ef2351bf8
5
5
  SHA512:
6
- metadata.gz: 50100c061e878b8e0289badb3d230ce3e4eec7b3e1f8596065655732955f9cc310e424abee4607a2eedd33a9656d59f6b521e48f52bc6c1e9d3e681b21428ca7
7
- data.tar.gz: f238512fe61344001901bb6c48687a8c0e0d35264e187444bffd80aa3b91a18e2ede6ba090a722170c72249acfd28cc219af42540bbde8ac62e2a13e5cd31e80
6
+ metadata.gz: 37c653c9b2283901357381d58ede86a80ab844e77cd0977bd5e7d52609788f81668fd3fa830782cebaa82fc53f2d2d6a3bc7f82f5b9c8b517ff2e7767927846b
7
+ data.tar.gz: ac0e1ef05c586f958873a46bcf9b3c8630a8de6449e536daabae0291ad39d144d8275bc66cba6aebf67e641feb7206f04b62ce734eb91357fc10ac1099786f75
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@ Tzispa
2
2
 
3
3
  General purpose web framework
4
4
 
5
+ ## v0.7.5
6
+ - bug fix in controller base response status code was not being set
7
+
5
8
  ## v0.7.4
6
9
  - changed repository load order in app
7
10
  - tzispa commands bugs fix
@@ -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) if handler.type
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 << content
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
- prepare_client_error(404, ex)
44
+ prepare_response(404, error: ex)
45
45
  rescue StandardError, ScriptError, SecurityError => ex
46
- prepare_server_error(500, ex)
46
+ prepare_response(500, error: ex)
47
47
  end
48
48
 
49
- def prepare_response(status, content = nil)
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
@@ -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,
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tzispa
4
- VERSION = '0.7.4'
4
+ VERSION = '0.7.5'
5
5
  FRAMEWORK_NAME = 'Tzispa'
6
6
  GEM_NAME = 'tzispa'
7
7
  end
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
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-05-05 00:00:00.000000000 Z
11
+ date: 2017-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler