facebooked 0.1.0

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.
@@ -0,0 +1,4 @@
1
+ == Facebooked
2
+
3
+ A simple ruby wrapper for server side Facebook Connect authentication.
4
+ If you are using connect-js [http://github.com/facebook/connect-js] for client side authentication, this is a simple way to authorize on the server side.
@@ -0,0 +1,14 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = "facebooked"
5
+ gemspec.summary = "Facebook api wrapper for server side authentication"
6
+ gemspec.description = "Facebooked is complimentary to connect-js"
7
+ gemspec.email = "l33byrd@gmail.com"
8
+ gemspec.homepage = "http://github.com/leebyrd/facebooked"
9
+ gemspec.authors = ["Lee Byrd"]
10
+ end
11
+ Jeweler::GemcutterTasks.new
12
+ rescue LoadError
13
+ puts "Jeweler not available. Install it with: gem install jeweler"
14
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,41 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{facebooked}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Lee Byrd"]
12
+ s.date = %q{2010-08-02}
13
+ s.description = %q{Facebooked is complimentary to connect-js}
14
+ s.email = %q{l33byrd@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ "README.rdoc",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "facebooked.gemspec",
23
+ "lib/facebooked.rb"
24
+ ]
25
+ s.homepage = %q{http://github.com/leebyrd/facebooked}
26
+ s.rdoc_options = ["--charset=UTF-8"]
27
+ s.require_paths = ["lib"]
28
+ s.rubygems_version = %q{1.3.7}
29
+ s.summary = %q{Facebook api wrapper for server side authentication}
30
+
31
+ if s.respond_to? :specification_version then
32
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
33
+ s.specification_version = 3
34
+
35
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
36
+ else
37
+ end
38
+ else
39
+ end
40
+ end
41
+
@@ -0,0 +1,26 @@
1
+ module Facebooked
2
+ def facebook_session
3
+ return unless cookie = cookies["fbs_#{APP_ID}"]
4
+
5
+ fs = {}
6
+ cookie.gsub(/"/, '').split('&').map{|str| str.split('=')}.each do |pair|
7
+ fs[pair[0].to_sym] = pair[1]
8
+ end
9
+ fs
10
+ end
11
+
12
+ protected
13
+ def current_user
14
+ return nil unless facebook_session && valid_session?
15
+
16
+ User.find_or_create_by_fb_id(:fb_id => facebook_session[:uid])
17
+ end
18
+
19
+ def valid_session?
20
+ digest = ''
21
+ [:access_token, :expires, :secret, :session_key, :uid] .each do |key|
22
+ digest += "#{key.to_s}=#{facebook_session[key]}"
23
+ end
24
+ Digest::MD5.hexdigest(digest + SECRET) == facebook_session[:sig]
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: facebooked
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Lee Byrd
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-08-02 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Facebooked is complimentary to connect-js
23
+ email: l33byrd@gmail.com
24
+ executables: []
25
+
26
+ extensions: []
27
+
28
+ extra_rdoc_files:
29
+ - README.rdoc
30
+ files:
31
+ - README.rdoc
32
+ - Rakefile
33
+ - VERSION
34
+ - facebooked.gemspec
35
+ - lib/facebooked.rb
36
+ has_rdoc: true
37
+ homepage: http://github.com/leebyrd/facebooked
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options:
42
+ - --charset=UTF-8
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ hash: 3
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ requirements: []
64
+
65
+ rubyforge_project:
66
+ rubygems_version: 1.3.7
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Facebook api wrapper for server side authentication
70
+ test_files: []
71
+