facebooker2 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/facebooker2/rack/post_canvas.rb +23 -0
- data/lib/facebooker2.rb +2 -1
- metadata +5 -4
@@ -0,0 +1,23 @@
|
|
1
|
+
# Rack middleware that converts POST requests from Facebook to GET request.
|
2
|
+
# When there is a signed_parameter in the request params, this is a request iniated by the top Facebook frame
|
3
|
+
# It will be sent as a POST request that we want to convert to a GET request to keep the app restful
|
4
|
+
# See for details : http://blog.coderubik.com/?p=178
|
5
|
+
module Rack
|
6
|
+
class PostCanvas
|
7
|
+
|
8
|
+
def initialize(app)
|
9
|
+
@app = app
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(env)
|
13
|
+
request = Request.new(env)
|
14
|
+
|
15
|
+
if request.POST['signed_request']
|
16
|
+
env["REQUEST_METHOD"] = 'GET'
|
17
|
+
end
|
18
|
+
|
19
|
+
return @app.call(env)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/lib/facebooker2.rb
CHANGED
@@ -47,4 +47,5 @@ require "facebooker2/rails/helpers/facebook_connect"
|
|
47
47
|
require "facebooker2/rails/helpers/javascript"
|
48
48
|
require "facebooker2/rails/helpers/request_forms"
|
49
49
|
require "facebooker2/rails/helpers/user"
|
50
|
-
require "facebooker2/rails/helpers"
|
50
|
+
require "facebooker2/rails/helpers"
|
51
|
+
require "facebooker2/rack/post_canvas"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facebooker2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 10
|
10
|
+
version: 0.0.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mike Mangino
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-11 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -137,6 +137,7 @@ extensions: []
|
|
137
137
|
extra_rdoc_files: []
|
138
138
|
|
139
139
|
files:
|
140
|
+
- lib/facebooker2/rack/post_canvas.rb
|
140
141
|
- lib/facebooker2/rails/controller.rb
|
141
142
|
- lib/facebooker2/rails/helpers/facebook_connect.rb
|
142
143
|
- lib/facebooker2/rails/helpers/javascript.rb
|