ext_direct 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/ext_direct.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ext_direct}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Marcin Lewandowski"]
12
- s.date = %q{2010-05-28}
12
+ s.date = %q{2010-06-03}
13
13
  s.description = %q{The Ext Direct plugin is a simple implementation of Ext Direct router to call server-side methods on the client-side.}
14
14
  s.email = %q{marcin.martio.lewandowski@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -1,5 +1,10 @@
1
1
  module ExtDirect
2
2
  class Request < Rack::Request
3
+ def initialize(env)
4
+ update_env(env)
5
+ super
6
+ end
7
+
3
8
  def action
4
9
  params.fetch("extAction", params.fetch("action", "unknown"))
5
10
  end
@@ -44,5 +49,14 @@ module ExtDirect
44
49
  def upload?
45
50
  params.include? "extUpload"
46
51
  end
52
+
53
+ private
54
+
55
+ def update_env(env)
56
+ if env["CONTENT_TYPE"] and env["CONTENT_TYPE"].match("^application/json")
57
+ env["rack.input"].rewind
58
+ env.update("rack.request.form_hash" => JSON.parse(env["rack.input"].read), "rack.request.form_input" => env["rack.input"])
59
+ end
60
+ end
47
61
  end
48
62
  end
@@ -1,5 +1,3 @@
1
1
  module ExtDirect
2
- class Response < Rack::Response
3
- # to-do: to implement :)
4
- end
2
+ class Response < Rack::Response; end
5
3
  end
@@ -8,12 +8,6 @@ module ExtDirect
8
8
 
9
9
  def call(env)
10
10
  if env["PATH_INFO"].match("^#{@route_path}")
11
- if env["CONTENT_TYPE"] and env["CONTENT_TYPE"].match("^application/json")
12
- # support for parsing a POST body data in a JSON format
13
- env["rack.input"].rewind
14
- env.update("rack.request.form_hash" => JSON.parse(env["rack.input"].read), "rack.request.form_input" => env["rack.input"])
15
- end
16
-
17
11
  request = ExtDirect::Request.new(env)
18
12
  response = ExtDirect::Response.new("", 200, {"Content-Type" => "application/json"})
19
13
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Marcin Lewandowski
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-28 00:00:00 +02:00
17
+ date: 2010-06-03 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20