kea-on-rails 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/kea/controller.rb +21 -0
- data/lib/kea/error_controller.rb +7 -0
- data/lib/kea/router.rb +32 -0
- data/lib/kea-on-rails.rb +3 -0
- metadata +47 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f70d714fafb87fc116f21429a38b1e2715949750
|
4
|
+
data.tar.gz: 3b3d782a74b3626bce748883816dae76286bec14
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9335007566ac986749f255a2b975a0735c9f391baba51614b5ebb98fcf3489e25caac5f275e210b4678c7df52686d11ba577a1c9ae06327fd6bea70cb2d7453c
|
7
|
+
data.tar.gz: 83d64bab5c2e0e9fefca21f9accabfa740be8ecbe9fac7da04f10e5ace9e61d7bc9f0f207752e2bf5bc51839dde06056d42d5bfbab2318d6b0a1fb6ac6862953
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Kea
|
2
|
+
module Controller
|
3
|
+
attr_accessor :running_via_kea
|
4
|
+
|
5
|
+
def run_kea_action
|
6
|
+
active_method = params['method']
|
7
|
+
@running_via_kea = true
|
8
|
+
self.send(active_method)
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
def params
|
14
|
+
if @running_via_kea
|
15
|
+
request.params['params']
|
16
|
+
else
|
17
|
+
request.params
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/kea/router.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Kea
|
2
|
+
class Router
|
3
|
+
def self.do_route
|
4
|
+
new
|
5
|
+
end
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
@env = env
|
12
|
+
params = (@env['rack.request.form_hash'] || Rack::Utils.parse_nested_query(@env['QUERY_STRING'])).deep_symbolize_keys
|
13
|
+
|
14
|
+
begin
|
15
|
+
@endpoint = params[:endpoint].classify.constantize
|
16
|
+
|
17
|
+
unless @endpoint.ancestors.include? Kea::Controller
|
18
|
+
return render_error({endpoint: 'does not descend from Kea::Controller'})
|
19
|
+
end
|
20
|
+
rescue => e
|
21
|
+
return render_error({exception: e.message})
|
22
|
+
end
|
23
|
+
|
24
|
+
@endpoint.action(:run_kea_action).call(env)
|
25
|
+
end
|
26
|
+
|
27
|
+
def render_error(error)
|
28
|
+
@env['KEA_ERROR'] = error
|
29
|
+
Kea::ErrorController.action(:render_kea_error).call(@env)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/kea-on-rails.rb
ADDED
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kea-on-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marius Andra
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Rails connector for kea and kea-rails-loader
|
14
|
+
email: marius.andra@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/kea-on-rails.rb
|
20
|
+
- lib/kea/controller.rb
|
21
|
+
- lib/kea/error_controller.rb
|
22
|
+
- lib/kea/router.rb
|
23
|
+
homepage: https://github.com/mariusandra/kea-rails
|
24
|
+
licenses:
|
25
|
+
- MIT
|
26
|
+
metadata: {}
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 2.5.1
|
44
|
+
signing_key:
|
45
|
+
specification_version: 4
|
46
|
+
summary: Rails connector for kea and kea-rails-loader
|
47
|
+
test_files: []
|