rocketio 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rocketio/controller.rb +36 -32
- data/lib/rocketio/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39cbcb10e360e5cba9a86831084011c5e070c48b
|
4
|
+
data.tar.gz: 099c5bd995fb5e040ba8c027a58a8c6abd604d39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6076d46b0c21a7df963e17ae6089189b911f1472594ebcb7765100bb221433bb90654c277582c49bee0a59f8775c0d0d84e3597f3ff864786deacaa0779a7c5
|
7
|
+
data.tar.gz: fc5643cfc2c87e0ae2f36b2ce8fbf7750d6b0a84739879918db895eba4e4586cb73154c32d85fc5cd886a613e48d0e34a257779ef9532e057f52fa05d6e05c60
|
data/lib/rocketio/controller.rb
CHANGED
@@ -14,11 +14,15 @@ module RocketIO
|
|
14
14
|
def_delegators RocketIO, :"#{env}?"
|
15
15
|
end
|
16
16
|
|
17
|
-
def initialize requested_method = RocketIO::INDEX_METHOD, path_params = nil
|
17
|
+
def initialize requested_method = RocketIO::INDEX_METHOD, path_params = nil, params = nil
|
18
18
|
@__requested_method__ = requested_method.to_sym
|
19
19
|
|
20
20
|
@__path_params_array__ = path_params || RocketIO::EMPTY_ARRAY
|
21
21
|
@__path_params_array__.freeze
|
22
|
+
|
23
|
+
if params
|
24
|
+
@__params__ = indifferent_params(params)
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
# call requested method
|
@@ -44,37 +48,6 @@ module RocketIO
|
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
47
|
-
private
|
48
|
-
def __call__
|
49
|
-
|
50
|
-
validate_or_request_authentication_if_needed
|
51
|
-
validate_or_request_authorization_if_needed
|
52
|
-
|
53
|
-
__run__ proc {
|
54
|
-
invoke_before_filter
|
55
|
-
invoke_around_filter proc {
|
56
|
-
response.body = public_send(requested_method, *requested_method_arguments)
|
57
|
-
}
|
58
|
-
invoke_after_filter
|
59
|
-
}
|
60
|
-
|
61
|
-
if head? # dropping body on HEAD requests
|
62
|
-
response.body = RocketIO::EMPTY_ARRAY
|
63
|
-
else
|
64
|
-
response.body ||= RocketIO::EMPTY_ARRAY
|
65
|
-
end
|
66
|
-
|
67
|
-
if env[RocketIO::HTTP_ACCEPT] == RocketIO::APPLICATION_JSON
|
68
|
-
response[RocketIO::CONTENT_TYPE] = RocketIO::APPLICATION_JSON
|
69
|
-
end
|
70
|
-
|
71
|
-
response.finish
|
72
|
-
end
|
73
|
-
|
74
|
-
def __run__ app
|
75
|
-
app.call
|
76
|
-
end
|
77
|
-
|
78
51
|
def env
|
79
52
|
@__env__
|
80
53
|
end
|
@@ -121,6 +94,37 @@ module RocketIO
|
|
121
94
|
def response
|
122
95
|
@__response__ ||= RocketIO::Response.new
|
123
96
|
end
|
97
|
+
|
98
|
+
private
|
99
|
+
def __call__
|
100
|
+
|
101
|
+
validate_or_request_authentication_if_needed
|
102
|
+
validate_or_request_authorization_if_needed
|
103
|
+
|
104
|
+
__run__ proc {
|
105
|
+
invoke_before_filter
|
106
|
+
invoke_around_filter proc {
|
107
|
+
response.body = public_send(requested_method, *requested_method_arguments)
|
108
|
+
}
|
109
|
+
invoke_after_filter
|
110
|
+
}
|
111
|
+
|
112
|
+
if head? # dropping body on HEAD requests
|
113
|
+
response.body = RocketIO::EMPTY_ARRAY
|
114
|
+
else
|
115
|
+
response.body ||= RocketIO::EMPTY_ARRAY
|
116
|
+
end
|
117
|
+
|
118
|
+
if env[RocketIO::HTTP_ACCEPT] == RocketIO::APPLICATION_JSON
|
119
|
+
response[RocketIO::CONTENT_TYPE] = RocketIO::APPLICATION_JSON
|
120
|
+
end
|
121
|
+
|
122
|
+
response.finish
|
123
|
+
end
|
124
|
+
|
125
|
+
def __run__ app
|
126
|
+
app.call
|
127
|
+
end
|
124
128
|
end
|
125
129
|
|
126
130
|
class << Controller
|
data/lib/rocketio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocketio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Slee Woo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -203,5 +203,5 @@ rubyforge_project:
|
|
203
203
|
rubygems_version: 2.5.1
|
204
204
|
signing_key:
|
205
205
|
specification_version: 4
|
206
|
-
summary: '["rocketio-0.4.
|
206
|
+
summary: '["rocketio-0.4.1", "Simple routing lib"]'
|
207
207
|
test_files: []
|