nephos-server 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nephos-server/router/helpers.rb +34 -0
- data/nephos-server.gemspec +1 -0
- data/test/test.rb +1 -0
- data/version +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c11b4d5d944f6cce30fbcda25510e5f6aba72c0
|
4
|
+
data.tar.gz: c12a3b132cfdea4075469c53d14e79b851058c78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f51af907c046e17a3f1845a95af7eba1c593225dcfe8061f57aa2c9c5a029850642845ebd179c09caf15ed3d0a3ec77a4f7c037aa06cae900c0439569e15e37
|
7
|
+
data.tar.gz: 3fd178f54482d3ead7a413302e1677a3095fa35f426001e2cc83d766ed7864f48603609235a48dd4ffb2043285b9b63eaa3fa21918198531ac99c5a36973470a
|
@@ -0,0 +1,34 @@
|
|
1
|
+
def route_prefix
|
2
|
+
@route_prefix ||= []
|
3
|
+
File.join(["/"] + @route_prefix)
|
4
|
+
end
|
5
|
+
|
6
|
+
def add_route(what, verb)
|
7
|
+
raise InvalidRoute unless what.is_a? Hash
|
8
|
+
what[:url] = File.expand_path File.join(route_prefix, what[:url])
|
9
|
+
Nephos::Router.check!(what)
|
10
|
+
Nephos::Router.add_params!(what)
|
11
|
+
Nephos::Router.add(what, verb)
|
12
|
+
end
|
13
|
+
|
14
|
+
# @param what [Hash]
|
15
|
+
def get what
|
16
|
+
add_route what, "GET"
|
17
|
+
end
|
18
|
+
|
19
|
+
# @param what [Hash]
|
20
|
+
def post what
|
21
|
+
add_route what, "POST"
|
22
|
+
end
|
23
|
+
|
24
|
+
# @param what [Hash]
|
25
|
+
def put what
|
26
|
+
add_route what, "PUT"
|
27
|
+
end
|
28
|
+
|
29
|
+
def resource(name, &block)
|
30
|
+
@route_prefix ||= []
|
31
|
+
@route_prefix << name
|
32
|
+
block.call
|
33
|
+
@route_prefix.pop
|
34
|
+
end
|
data/nephos-server.gemspec
CHANGED
data/test/test.rb
CHANGED
data/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nephos-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- poulet_a
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nomorebeer
|
@@ -64,6 +64,7 @@ email:
|
|
64
64
|
- lib/nephos-server/server/responder.rb
|
65
65
|
- lib/nephos-server/router/main.rb
|
66
66
|
- lib/nephos-server/router/load.rb
|
67
|
+
- lib/nephos-server/router/helpers.rb
|
67
68
|
- README.md
|
68
69
|
- Rakefile
|
69
70
|
- Procfile
|
@@ -102,6 +103,7 @@ files:
|
|
102
103
|
- lib/nephos-server/basic_errors.rb
|
103
104
|
- lib/nephos-server/controller.rb
|
104
105
|
- lib/nephos-server/params.rb
|
106
|
+
- lib/nephos-server/router/helpers.rb
|
105
107
|
- lib/nephos-server/router/load.rb
|
106
108
|
- lib/nephos-server/router/main.rb
|
107
109
|
- lib/nephos-server/server/main.rb
|