nephos-server 0.4.7 → 0.4.8

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: c19caddb625aa364f4db457946e82f11c9677cad
4
- data.tar.gz: cfbda59dc9b76f3127738802b8fa5e32c7195daa
3
+ metadata.gz: 6c35f4d2f0547725d90cc6f979151bc978d41670
4
+ data.tar.gz: c65b023117aa32ab0ce732b9c0073f315b50ce5c
5
5
  SHA512:
6
- metadata.gz: 976ab4a4c50704d349a41c47bc2d62f8d2ce8c358ad27ad6812dc122d3cbe09cbd375d22725a6002f524f616a9557e3484b54a69655ec747df4fd57858a9972c
7
- data.tar.gz: 976677fcea7eee326490ef4811b6087e8d7403fed10952566370c29703dc8fc616c4abf0d73f65cd84151845e79efe4d12e68f15c3eda3bc4152120e3a4839b3
6
+ metadata.gz: 63d465d46581d22542a6dbfd4a7d7caf159080ef7e1d5d0a2e732bb774c86d1b9b2f53ce27140054a10301061c04d89a92cf41f41603cb86aa4ab470008b5033
7
+ data.tar.gz: 146add81a36a974479ab84d57be331c8e48e2e1137c84cdd1c860a66c1d727b166649a582d316b0b57cd4f31086b2a76ac0f5adc4bd9a794b44d5f9b0fd4c3ed
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.4.7
2
+ * fix parameters
3
+
1
4
  v0.4.7
2
5
  * improve controller generator (names)
3
6
  * add puma to change the default web server
@@ -5,17 +5,17 @@ module Nephos
5
5
 
6
6
  # @param env [Hash] env extracted from the http request
7
7
  # @param parsed [Hash] pre-parsed env with parameters, ...
8
- def initialize env={}, parsed={path: [], args: {}}, callpath={params: []}
8
+ def initialize env={}, parsed={path: [], params: {}}, callpath={params: []}
9
9
  raise ArgumentError, "env must be a Hash" unless env.is_a? Hash
10
10
  raise ArgumentError, "parsed must be a Hash" unless parsed.is_a? Hash
11
11
  raise ArgumentError, "callpath must be a Hash" unless callpath.is_a? Hash
12
12
  raise ArgumentError, "Invalid Parsed. :path must be associated with an Array" unless parsed[:path].is_a? Array
13
- raise ArgumentError, "Invalid Parsed. :args must be associated with a Hash" unless parsed[:args].is_a? Hash
13
+ raise ArgumentError, "Invalid Parsed. :params must be associated with a Hash" unless parsed[:params].is_a? Hash
14
14
  raise ArgumentError, "Invalid Callpath. :params must be associated with an Array" unless callpath[:params].is_a? Array
15
15
  @env= env
16
16
  @infos= parsed
17
17
  @callpath= callpath
18
- @params= parsed[:args]
18
+ @params= parsed[:params]
19
19
  @params.merge! Hash[callpath[:params].zip @infos[:path]]
20
20
  @params.select!{|k,v| not k.to_s.empty?}
21
21
  @params = Params.new(@params)
@@ -25,8 +25,9 @@ module Nephos
25
25
  verb = env["REQUEST_METHOD"]
26
26
  from = env["REMOTE_ADDR"]
27
27
  path = route.path.split("/").select{|e|not e.to_s.empty?}
28
- args = Hash[route.query.to_s.split("&").map{|e| e.split("=")}]
29
- return {route: route, verb: verb, from: from, path: path, args: args}
28
+ params = Rack::Request.new(env).params
29
+ # Hash[route.query.to_s.split("&").map{|e| e.split("=")}]
30
+ return {route: route, verb: verb, from: from, path: path, params: params}
30
31
  end
31
32
 
32
33
  def self.error(code, err=nil)
data/test/controller.rb CHANGED
@@ -2,22 +2,22 @@ class TestNephosServerController < Test::Unit::TestCase
2
2
 
3
3
  def test_initialize_success
4
4
  assert Nephos::Controller.new()
5
- assert Nephos::Controller.new(env={}, {path: [], args: {}}, {params: []})
5
+ assert Nephos::Controller.new(env={}, {path: [], params: {}}, {params: []})
6
6
  end
7
7
 
8
8
  def test_initialize_failure
9
9
  assert_raise do Nephos::Controller.new({}, {}, {}) end
10
10
  assert_raise do Nephos::Controller.new({}, {path: nil}, {}) end
11
11
  assert_raise do Nephos::Controller.new({}, {path: []}, {}) end
12
- assert_raise do Nephos::Controller.new({}, {path: [], args: {}}, {}) end
13
- assert_raise do Nephos::Controller.new({}, {path: [], args: {}}, {params: nil}) end
14
- assert_raise do Nephos::Controller.new({}, {path: nil, args: nil}, params: nil) end
15
- assert_raise do Nephos::Controller.new({}, {path: nil, args: {}}, {params: {}}) end
16
- assert_raise do Nephos::Controller.new({}, {path: [], args: nil}, {params: {}}) end
12
+ assert_raise do Nephos::Controller.new({}, {path: [], params: {}}, {}) end
13
+ assert_raise do Nephos::Controller.new({}, {path: [], params: {}}, {params: nil}) end
14
+ assert_raise do Nephos::Controller.new({}, {path: nil, params: nil}, params: nil) end
15
+ assert_raise do Nephos::Controller.new({}, {path: nil, params: {}}, {params: {}}) end
16
+ assert_raise do Nephos::Controller.new({}, {path: [], params: nil}, {params: {}}) end
17
17
  end
18
18
 
19
19
  def test_controller_params
20
- c = Nephos::Controller.new(env={}, {path: ["value"], args: {}}, {params: ["param"]})
20
+ c = Nephos::Controller.new(env={}, {path: ["value"], params: {}}, {params: ["param"]})
21
21
  assert_equal "value", c.params[:param]
22
22
  assert_equal "value", c.params["param"]
23
23
  end
data/version CHANGED
@@ -1 +1 @@
1
- 0.4.7
1
+ 0.4.8
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nephos-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - poulet_a
@@ -162,6 +162,5 @@ rubyforge_project:
162
162
  rubygems_version: 2.4.8
163
163
  signing_key:
164
164
  specification_version: 4
165
- summary: "* improve controller generator (names) * add puma to change the default
166
- web server * add environments"
165
+ summary: "* fix parameters"
167
166
  test_files: []