merb_facebooker 0.0.5 → 0.0.6
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/lib/merb_facebooker.rb +3 -9
- data/lib/merb_facebooker/controller.rb +17 -12
- data/lib/merb_facebooker/version.rb +1 -1
- metadata +7 -8
data/lib/merb_facebooker.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
# make sure we're running inside Merb
|
2
1
|
require 'facebooker'
|
3
2
|
require 'yaml'
|
4
3
|
require 'merb_facebooker/controller'
|
5
4
|
require 'merb_facebooker/helpers'
|
6
5
|
|
6
|
+
# make sure we're running inside Merb
|
7
7
|
if defined?(Merb::Plugins)
|
8
8
|
|
9
9
|
# Merb gives you a Merb::Plugins.config hash...feel free to put your stuff in your piece of it
|
@@ -13,10 +13,9 @@ if defined?(Merb::Plugins)
|
|
13
13
|
ENV['FACEBOOK_API_KEY'] = Merb::Plugins.config[:merb_facebooker]['api_key']
|
14
14
|
ENV['FACEBOOK_SECRET_KEY'] = Merb::Plugins.config[:merb_facebooker]['secret_key']
|
15
15
|
ENV['FACEBOOKER_RELATIVE_URL_ROOT'] = Merb::Plugins.config[:merb_facebooker]['canvas_page_name']
|
16
|
-
#ActionController::Base.asset_host = FACEBOOKER['callback_url']
|
17
16
|
end
|
18
17
|
|
19
|
-
Merb.add_mime_type(:fbml, :to_fbml, %w[application/fbml text/fbml], :encoding =>
|
18
|
+
Merb.add_mime_type(:fbml, :to_fbml, %w[application/fbml text/fbml], :encoding => 'utf-8')
|
20
19
|
Merb::Request.http_method_overrides.push(
|
21
20
|
proc { |c| c.params[:fb_sig_request_method].clone if c.params[:fb_sig_request_method]}
|
22
21
|
)
|
@@ -24,12 +23,7 @@ if defined?(Merb::Plugins)
|
|
24
23
|
Merb::BootLoader.before_app_loads do
|
25
24
|
Merb::Controller.send(:include, Facebooker::Merb::Controller)
|
26
25
|
Merb::Controller.send(:include, Facebooker::Merb::Helpers)
|
27
|
-
# require code that must be loaded before the application
|
28
|
-
end
|
29
|
-
|
30
|
-
Merb::BootLoader.after_app_loads do
|
31
|
-
# code that can be required after the application loads
|
32
26
|
end
|
33
27
|
|
34
|
-
Merb::Plugins.add_rakefiles
|
28
|
+
Merb::Plugins.add_rakefiles 'merb_facebooker/merbtasks'
|
35
29
|
end
|
@@ -7,18 +7,22 @@ module Facebooker
|
|
7
7
|
controller.before :set_fbml_format
|
8
8
|
end
|
9
9
|
|
10
|
+
# Facebook session
|
10
11
|
#
|
11
|
-
#
|
12
|
-
#
|
12
|
+
# @return Facebook::Session
|
13
13
|
def facebook_session
|
14
14
|
@facebook_session
|
15
15
|
end
|
16
16
|
|
17
|
+
# Sets session
|
17
18
|
#
|
18
|
-
# Tries to secure the facebook_session, if it is not secured
|
19
|
-
#
|
20
|
-
#
|
19
|
+
# Tries to secure the facebook_session, if it is not secured
|
20
|
+
# already, it tries to secure it via the request parameter
|
21
|
+
# 'auth_token', if that doesn't work, it tries to use the parameters
|
22
|
+
# from facebook (this could be in the request or via cookies
|
23
|
+
# [cookies in case of FBConnect]).
|
21
24
|
#
|
25
|
+
# @return [Boolean]
|
22
26
|
def set_facebook_session
|
23
27
|
session_set = session_already_secured? || secure_with_token! || secure_with_facebook_params!
|
24
28
|
if session_set
|
@@ -28,18 +32,19 @@ module Facebooker
|
|
28
32
|
session_set
|
29
33
|
end
|
30
34
|
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
35
|
+
# Initializes the @facebook_params instance using the method
|
36
|
+
# verified_facebook_params
|
37
|
+
#
|
38
|
+
# @return [Mash]
|
34
39
|
def facebook_params
|
35
40
|
@facebook_params ||= verified_facebook_params
|
36
41
|
end
|
37
42
|
|
38
43
|
private
|
39
44
|
|
40
|
-
#
|
41
45
|
# Ensures there is an existing facebook session, and if so, it ask if it is secured.
|
42
46
|
#
|
47
|
+
# @return [Boolean]
|
43
48
|
def session_already_secured?
|
44
49
|
(@facebook_session = session[:facebook_session]) && session[:facebook_session].secured?
|
45
50
|
end
|
@@ -102,10 +107,10 @@ module Facebooker
|
|
102
107
|
(value == '0' || value.nil? || value == '')
|
103
108
|
end
|
104
109
|
|
105
|
-
#
|
106
110
|
# Get all the parameters from facebook via the request or cookies...
|
107
111
|
# (Cookies have more presedence)
|
108
112
|
#
|
113
|
+
# @return [Mash]
|
109
114
|
def verified_facebook_params
|
110
115
|
if !request.cookies[Facebooker::Session.api_key].blank?
|
111
116
|
facebook_sig_params = request.cookies.inject({}) do |collection, pair|
|
@@ -211,7 +216,7 @@ module Facebooker
|
|
211
216
|
end
|
212
217
|
|
213
218
|
module ClassMethods
|
214
|
-
|
219
|
+
|
215
220
|
# Creates a filter which reqires a user to have already authenticated to
|
216
221
|
# Facebook before executing actions. Accepts the same optional options hash which
|
217
222
|
# before_filter and after_filter accept.
|
@@ -225,4 +230,4 @@ module Facebooker
|
|
225
230
|
end
|
226
231
|
end
|
227
232
|
end
|
228
|
-
end
|
233
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Chris Van Pelt
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-04-
|
18
|
+
date: 2010-04-08 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -28,8 +28,7 @@ dependencies:
|
|
28
28
|
segments:
|
29
29
|
- 1
|
30
30
|
- 1
|
31
|
-
|
32
|
-
version: 1.1.0
|
31
|
+
version: "1.1"
|
33
32
|
type: :runtime
|
34
33
|
version_requirements: *id001
|
35
34
|
- !ruby/object:Gem::Dependency
|
@@ -46,7 +45,7 @@ dependencies:
|
|
46
45
|
version: 1.0.50
|
47
46
|
type: :runtime
|
48
47
|
version_requirements: *id002
|
49
|
-
description: Merb plugin that makes facebooker work with
|
48
|
+
description: Merb plugin that makes facebooker work with Merb.
|
50
49
|
email: vanpelt@doloreslabs.com, pavel.kunc@gmail.com
|
51
50
|
executables: []
|
52
51
|
|
@@ -69,7 +68,7 @@ files:
|
|
69
68
|
- LICENSE
|
70
69
|
- TODO
|
71
70
|
has_rdoc: true
|
72
|
-
homepage: http://
|
71
|
+
homepage: http://github.com/pk/merb_facebooker
|
73
72
|
licenses: []
|
74
73
|
|
75
74
|
post_install_message:
|
@@ -97,6 +96,6 @@ rubyforge_project:
|
|
97
96
|
rubygems_version: 1.3.6
|
98
97
|
signing_key:
|
99
98
|
specification_version: 3
|
100
|
-
summary: Merb plugin that makes facebooker work with
|
99
|
+
summary: Merb plugin that makes facebooker work with Merb.
|
101
100
|
test_files: []
|
102
101
|
|