eukaliptus 0.7.1 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -14,7 +14,7 @@ We provide integration with two authentication methods out of the box, Koala Fac
14
14
 
15
15
  Require it in your Gemfile
16
16
 
17
- gem 'eukaliptus', :git => 'git://github.com/seasonlabs/eukaliptus.git'
17
+ gem 'eukaliptus'
18
18
 
19
19
  Update your bundle
20
20
 
@@ -2,12 +2,42 @@ require 'rack/request'
2
2
 
3
3
  # Extend Rack::Request to add some helpers for FB
4
4
  class Request < ::Rack::Request
5
+ URL_ENCODED = %r{^application/x-www-form-urlencoded}
6
+ JSON_ENCODED = %r{^application/json}
7
+
5
8
  def params
6
- rack_input = env["rack.input"].read
7
- @params ||= Rack::Utils.parse_query(rack_input, "&")
9
+ @params ||= retrieve_params(env)
8
10
  end
9
11
 
10
12
  def facebook?
11
- params["signed_request"].present?
13
+ params[:signed_request].present?
12
14
  end
15
+
16
+ private
17
+ # Stolen from Goliath
18
+ def retrieve_params(env)
19
+ params = {}
20
+ params.merge!(::Rack::Utils.parse_nested_query(env['QUERY_STRING']))
21
+
22
+ if env['rack.input']
23
+ post_params = ::Rack::Utils::Multipart.parse_multipart(env)
24
+ unless post_params
25
+ body = env['rack.input'].read
26
+ env['rack.input'].rewind
27
+
28
+ post_params = case(env['CONTENT_TYPE'])
29
+ when URL_ENCODED then
30
+ ::Rack::Utils.parse_nested_query(body)
31
+ when JSON_ENCODED then
32
+ MultiJson.decode(body)
33
+ else
34
+ {}
35
+ end
36
+ end
37
+
38
+ params.merge!(post_params)
39
+ end
40
+
41
+ params
42
+ end
13
43
  end
@@ -1,3 +1,3 @@
1
1
  module Eukaliptus
2
- VERSION = "0.7.1"
2
+ VERSION = "0.8.1"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: eukaliptus
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.7.1
5
+ version: 0.8.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - season
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-06-11 00:00:00 +02:00
14
+ date: 2011-06-12 00:00:00 +02:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency