facebooker 0.9.5 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +14 -0
- data/Manifest.txt +68 -14
- data/README +4 -2
- data/README.txt +22 -4
- data/Rakefile +42 -4
- data/TODO.txt +3 -9
- data/generators/facebook/facebook_generator.rb +14 -0
- data/{facebooker.yml.tpl → generators/facebook/templates/config/facebooker.yml} +12 -2
- data/generators/facebook/templates/public/javascripts/facebooker.js +106 -0
- data/generators/facebook_controller/USAGE +33 -0
- data/generators/facebook_controller/facebook_controller_generator.rb +40 -0
- data/generators/facebook_controller/templates/controller.rb +7 -0
- data/generators/facebook_controller/templates/functional_test.rb +11 -0
- data/generators/facebook_controller/templates/helper.rb +2 -0
- data/generators/facebook_controller/templates/view.fbml.erb +2 -0
- data/generators/facebook_controller/templates/view.html.erb +2 -0
- data/generators/facebook_publisher/facebook_publisher_generator.rb +14 -0
- data/generators/facebook_publisher/templates/create_facebook_templates.rb +15 -0
- data/generators/facebook_publisher/templates/publisher.rb +3 -0
- data/generators/facebook_scaffold/USAGE +27 -0
- data/generators/facebook_scaffold/facebook_scaffold_generator.rb +118 -0
- data/generators/facebook_scaffold/templates/controller.rb +93 -0
- data/generators/facebook_scaffold/templates/facebook_style.css +2579 -0
- data/generators/facebook_scaffold/templates/functional_test.rb +89 -0
- data/generators/facebook_scaffold/templates/helper.rb +2 -0
- data/generators/facebook_scaffold/templates/layout.fbml.erb +6 -0
- data/generators/facebook_scaffold/templates/layout.html.erb +17 -0
- data/generators/facebook_scaffold/templates/style.css +74 -0
- data/generators/facebook_scaffold/templates/view_edit.fbml.erb +13 -0
- data/generators/facebook_scaffold/templates/view_edit.html.erb +18 -0
- data/generators/facebook_scaffold/templates/view_index.fbml.erb +24 -0
- data/generators/facebook_scaffold/templates/view_index.html.erb +24 -0
- data/generators/facebook_scaffold/templates/view_new.fbml.erb +12 -0
- data/generators/facebook_scaffold/templates/view_new.html.erb +17 -0
- data/generators/facebook_scaffold/templates/view_show.fbml.erb +10 -0
- data/generators/facebook_scaffold/templates/view_show.html.erb +10 -0
- data/generators/publisher/publisher_generator.rb +14 -0
- data/generators/xd_receiver/templates/xd_receiver.html +10 -0
- data/generators/xd_receiver/xd_receiver_generator.rb +9 -0
- data/init.rb +30 -12
- data/install.rb +10 -3
- data/lib/facebooker.rb +139 -30
- data/lib/facebooker/adapters/adapter_base.rb +87 -0
- data/lib/facebooker/adapters/bebo_adapter.rb +75 -0
- data/lib/facebooker/adapters/facebook_adapter.rb +48 -0
- data/lib/facebooker/admin.rb +42 -0
- data/lib/facebooker/batch_request.rb +44 -0
- data/lib/facebooker/data.rb +24 -5
- data/lib/facebooker/feed.rb +18 -5
- data/lib/facebooker/logging.rb +51 -0
- data/lib/facebooker/model.rb +18 -1
- data/lib/facebooker/{affiliation.rb → models/affiliation.rb} +0 -0
- data/lib/facebooker/{album.rb → models/album.rb} +0 -0
- data/lib/facebooker/models/applicationproperties.rb +39 -0
- data/lib/facebooker/{cookie.rb → models/cookie.rb} +0 -0
- data/lib/facebooker/{education_info.rb → models/education_info.rb} +0 -0
- data/lib/facebooker/{event.rb → models/event.rb} +2 -0
- data/lib/facebooker/models/friend_list.rb +16 -0
- data/lib/facebooker/{group.rb → models/group.rb} +1 -0
- data/lib/facebooker/models/info_item.rb +10 -0
- data/lib/facebooker/models/info_section.rb +10 -0
- data/lib/facebooker/{location.rb → models/location.rb} +0 -0
- data/lib/facebooker/{notifications.rb → models/notifications.rb} +0 -0
- data/lib/facebooker/models/page.rb +27 -0
- data/lib/facebooker/{photo.rb → models/photo.rb} +4 -1
- data/lib/facebooker/{tag.rb → models/tag.rb} +0 -0
- data/lib/facebooker/models/user.rb +394 -0
- data/lib/facebooker/{work_info.rb → models/work_info.rb} +0 -0
- data/lib/facebooker/parser.rb +201 -19
- data/lib/facebooker/rails/controller.rb +129 -21
- data/lib/facebooker/rails/facebook_form_builder.rb +3 -3
- data/lib/facebooker/rails/facebook_pretty_errors.rb +14 -0
- data/lib/facebooker/rails/facebook_request_fix.rb +10 -0
- data/lib/facebooker/rails/facebook_session_handling.rb +12 -1
- data/lib/facebooker/rails/facebook_url_helper.rb +192 -0
- data/lib/facebooker/rails/facebook_url_rewriting.rb +11 -3
- data/lib/facebooker/rails/helpers.rb +180 -34
- data/lib/facebooker/rails/helpers/fb_connect.rb +38 -0
- data/lib/facebooker/rails/profile_publisher_extensions.rb +42 -0
- data/lib/facebooker/rails/publisher.rb +513 -0
- data/lib/facebooker/rails/routing.rb +1 -1
- data/lib/facebooker/rails/test_helpers.rb +75 -3
- data/lib/facebooker/server_cache.rb +3 -3
- data/lib/facebooker/service.rb +74 -7
- data/lib/facebooker/session.rb +245 -68
- data/lib/facebooker/version.rb +3 -3
- data/lib/tasks/facebooker.rake +4 -2
- data/lib/tasks/tunnel.rake +14 -7
- data/rails/init.rb +1 -0
- data/templates/layout.erb +24 -0
- data/test/adapters_test.rb +98 -0
- data/test/batch_request_test.rb +82 -0
- data/test/facebook_admin_test.rb +102 -0
- data/test/facebook_cache_test.rb +1 -0
- data/test/facebook_data_test.rb +36 -0
- data/test/facebooker_test.rb +221 -80
- data/test/logging_test.rb +43 -0
- data/test/model_test.rb +12 -0
- data/test/publisher_test.rb +458 -0
- data/test/rails_integration_test.rb +538 -33
- data/test/session_test.rb +223 -6
- data/test/test_helper.rb +8 -2
- data/test/user_test.rb +191 -2
- metadata +99 -18
- data/lib/facebooker/user.rb +0 -200
data/History.txt
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
=== 1.0.13 / 2009-02-26
|
2
|
+
|
3
|
+
* Modified fql_query to return results as Hashes as a last resort [Alan Larkin]
|
4
|
+
* fixed typo in set app properties parser [Andrew Grim, shane]
|
5
|
+
* Removed actor_id param from templatized feed [shane]
|
6
|
+
* Added admin.get_allocation [shane]
|
7
|
+
* Added data.get_cookies and data.set_cookie [shane]
|
8
|
+
* Added admin.get_app_properties and admin.set_app_properties [shane]
|
9
|
+
|
10
|
+
=== 0.9.9 / 2008-09-08
|
11
|
+
|
12
|
+
* Re-package as gem after reworking for new API
|
13
|
+
|
14
|
+
|
1
15
|
=== 0.9.5 / 2008-02-13
|
2
16
|
|
3
17
|
* Next release of documentation
|
data/Manifest.txt
CHANGED
@@ -6,45 +6,98 @@ README
|
|
6
6
|
README.txt
|
7
7
|
Rakefile
|
8
8
|
TODO.txt
|
9
|
-
|
9
|
+
generators/publisher/publisher_generator.rb
|
10
|
+
generators/facebook/facebook_generator.rb
|
11
|
+
generators/facebook/templates/config/facebooker.yml
|
12
|
+
generators/facebook/templates/public/javascripts/facebooker.js
|
13
|
+
generators/facebook_controller/USAGE
|
14
|
+
generators/facebook_controller/facebook_controller_generator.rb
|
15
|
+
generators/facebook_controller/templates/controller.rb
|
16
|
+
generators/facebook_controller/templates/functional_test.rb
|
17
|
+
generators/facebook_controller/templates/helper.rb
|
18
|
+
generators/facebook_controller/templates/view.fbml.erb
|
19
|
+
generators/facebook_controller/templates/view.html.erb
|
20
|
+
generators/facebook_publisher/facebook_publisher_generator.rb
|
21
|
+
generators/facebook_publisher/templates/create_facebook_templates.rb
|
22
|
+
generators/facebook_publisher/templates/publisher.rb
|
23
|
+
generators/facebook_scaffold/USAGE
|
24
|
+
generators/facebook_scaffold/facebook_scaffold_generator.rb
|
25
|
+
generators/facebook_scaffold/templates/controller.rb
|
26
|
+
generators/facebook_scaffold/templates/facebook_style.css
|
27
|
+
generators/facebook_scaffold/templates/functional_test.rb
|
28
|
+
generators/facebook_scaffold/templates/helper.rb
|
29
|
+
generators/facebook_scaffold/templates/layout.fbml.erb
|
30
|
+
generators/facebook_scaffold/templates/layout.html.erb
|
31
|
+
generators/facebook_scaffold/templates/style.css
|
32
|
+
generators/facebook_scaffold/templates/view_edit.fbml.erb
|
33
|
+
generators/facebook_scaffold/templates/view_edit.html.erb
|
34
|
+
generators/facebook_scaffold/templates/view_index.fbml.erb
|
35
|
+
generators/facebook_scaffold/templates/view_index.html.erb
|
36
|
+
generators/facebook_scaffold/templates/view_new.fbml.erb
|
37
|
+
generators/facebook_scaffold/templates/view_new.html.erb
|
38
|
+
generators/facebook_scaffold/templates/view_show.fbml.erb
|
39
|
+
generators/facebook_scaffold/templates/view_show.html.erb
|
40
|
+
generators/xd_receiver/xd_receiver_generator.rb
|
41
|
+
generators/xd_receiver/templates/xd_receiver.html
|
10
42
|
init.rb
|
11
43
|
install.rb
|
12
44
|
lib/facebooker.rb
|
13
|
-
lib/facebooker/
|
14
|
-
lib/facebooker/
|
15
|
-
lib/facebooker/
|
45
|
+
lib/facebooker/adapters/adapter_base.rb
|
46
|
+
lib/facebooker/adapters/bebo_adapter.rb
|
47
|
+
lib/facebooker/adapters/facebook_adapter.rb
|
48
|
+
lib/facebooker/admin.rb
|
49
|
+
lib/facebooker/batch_request.rb
|
16
50
|
lib/facebooker/data.rb
|
17
|
-
lib/facebooker/education_info.rb
|
18
|
-
lib/facebooker/event.rb
|
19
51
|
lib/facebooker/feed.rb
|
20
|
-
lib/facebooker/
|
21
|
-
lib/facebooker/location.rb
|
52
|
+
lib/facebooker/logging.rb
|
22
53
|
lib/facebooker/model.rb
|
23
|
-
lib/facebooker/
|
54
|
+
lib/facebooker/models/affiliation.rb
|
55
|
+
lib/facebooker/models/album.rb
|
56
|
+
lib/facebooker/models/applicationproperties.rb
|
57
|
+
lib/facebooker/models/cookie.rb
|
58
|
+
lib/facebooker/models/education_info.rb
|
59
|
+
lib/facebooker/models/event.rb
|
60
|
+
lib/facebooker/models/friend_list.rb
|
61
|
+
lib/facebooker/models/group.rb
|
62
|
+
lib/facebooker/models/info_item.rb
|
63
|
+
lib/facebooker/models/info_section.rb
|
64
|
+
lib/facebooker/models/location.rb
|
65
|
+
lib/facebooker/models/notifications.rb
|
66
|
+
lib/facebooker/models/page.rb
|
67
|
+
lib/facebooker/models/photo.rb
|
68
|
+
lib/facebooker/models/tag.rb
|
69
|
+
lib/facebooker/models/user.rb
|
70
|
+
lib/facebooker/models/work_info.rb
|
24
71
|
lib/facebooker/parser.rb
|
25
|
-
lib/facebooker/photo.rb
|
26
72
|
lib/facebooker/rails/controller.rb
|
27
73
|
lib/facebooker/rails/facebook_asset_path.rb
|
28
74
|
lib/facebooker/rails/facebook_form_builder.rb
|
75
|
+
lib/facebooker/rails/facebook_pretty_errors.rb
|
29
76
|
lib/facebooker/rails/facebook_request_fix.rb
|
30
77
|
lib/facebooker/rails/facebook_session_handling.rb
|
78
|
+
lib/facebooker/rails/facebook_url_helper.rb
|
31
79
|
lib/facebooker/rails/facebook_url_rewriting.rb
|
32
80
|
lib/facebooker/rails/helpers.rb
|
81
|
+
lib/facebooker/rails/helpers/fb_connect.rb
|
82
|
+
lib/facebooker/rails/profile_publisher_extensions.rb
|
83
|
+
lib/facebooker/rails/publisher.rb
|
33
84
|
lib/facebooker/rails/routing.rb
|
34
85
|
lib/facebooker/rails/test_helpers.rb
|
35
86
|
lib/facebooker/rails/utilities.rb
|
36
87
|
lib/facebooker/server_cache.rb
|
37
88
|
lib/facebooker/service.rb
|
38
89
|
lib/facebooker/session.rb
|
39
|
-
lib/facebooker/tag.rb
|
40
|
-
lib/facebooker/user.rb
|
41
90
|
lib/facebooker/version.rb
|
42
|
-
lib/facebooker/work_info.rb
|
43
91
|
lib/net/http_multipart_post.rb
|
44
92
|
lib/tasks/facebooker.rake
|
45
93
|
lib/tasks/tunnel.rake
|
94
|
+
rails/init.rb
|
46
95
|
setup.rb
|
96
|
+
templates/layout.erb
|
97
|
+
test/adapters_test.rb
|
98
|
+
test/batch_request_test.rb
|
47
99
|
test/event_test.rb
|
100
|
+
test/facebook_admin_test.rb
|
48
101
|
test/facebook_cache_test.rb
|
49
102
|
test/facebook_data_test.rb
|
50
103
|
test/facebooker_test.rb
|
@@ -52,9 +105,10 @@ test/fixtures/multipart_post_body_with_only_parameters.txt
|
|
52
105
|
test/fixtures/multipart_post_body_with_single_file.txt
|
53
106
|
test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt
|
54
107
|
test/http_multipart_post_test.rb
|
108
|
+
test/logging_test.rb
|
55
109
|
test/model_test.rb
|
110
|
+
test/publisher_test.rb
|
56
111
|
test/rails_integration_test.rb
|
57
112
|
test/session_test.rb
|
58
113
|
test/test_helper.rb
|
59
114
|
test/user_test.rb
|
60
|
-
|
data/README
CHANGED
@@ -5,7 +5,7 @@ Copyright (c) 2007 Chad Fowler, Patrick Ewing
|
|
5
5
|
Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://developer.facebook.com]. Its goals are:
|
6
6
|
|
7
7
|
* Idiomatic Ruby
|
8
|
-
* No dependencies outside of the Ruby standard library
|
8
|
+
* No dependencies outside of the Ruby standard library (This is true with Rails 2.1. Previous Rails versions require the JSON gem)
|
9
9
|
* Concrete classes and methods modeling the Facebook data, so it's easy for a Rubyist to understand what's available
|
10
10
|
* Well tested
|
11
11
|
|
@@ -23,7 +23,9 @@ If, for some reason, you can't/won't use RubyGems, you can do:
|
|
23
23
|
|
24
24
|
Facebooker can be installed as a Rails plugin by:
|
25
25
|
|
26
|
-
script/plugin install
|
26
|
+
script/plugin install git://github.com/mmangino/facebooker.git
|
27
|
+
|
28
|
+
If you don't have git, the plugin can be downloaded from http://github.com/mmangino/facebooker/tarball/master
|
27
29
|
|
28
30
|
Once the plugin is installed, you will need to configure your Facebook app in config/facebooker.yml.
|
29
31
|
|
data/README.txt
CHANGED
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://
|
7
|
+
Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://wiki.developers.facebook.com/index.php/API]. Its goals are:
|
8
8
|
|
9
9
|
* Idiomatic Ruby
|
10
|
-
* No dependencies outside of the Ruby standard library
|
10
|
+
* No dependencies outside of the Ruby standard library (This is true with Rails 2.1. Previous Rails versions require the JSON gem)
|
11
11
|
* Concrete classes and methods modeling the Facebook data, so it's easy for a Rubyist to understand what's available
|
12
12
|
* Well tested
|
13
13
|
|
@@ -21,7 +21,7 @@ Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[h
|
|
21
21
|
|
22
22
|
== SYNOPSIS:
|
23
23
|
|
24
|
-
|
24
|
+
View David Clements' {excellent tutorial}[http://apps.facebook.com/facebooker_tutorial] at {http://apps.facebook.com/facebooker_tutorial/}[http://apps.facebook.com/facebooker_tutorial] or check out {Developing Facebook Platform Applications with Rails}[http://www.pragprog.com/titles/mmfacer].
|
25
25
|
|
26
26
|
== REQUIREMENTS:
|
27
27
|
|
@@ -43,7 +43,9 @@ If, for some reason, you can't/won't use RubyGems, you can do:
|
|
43
43
|
|
44
44
|
Facebooker can be installed as a Rails plugin by:
|
45
45
|
|
46
|
-
script/plugin install
|
46
|
+
script/plugin install git://github.com/mmangino/facebooker.git
|
47
|
+
|
48
|
+
If you don't have git, the plugin can be downloaded from http://github.com/mmangino/facebooker/tarball/master
|
47
49
|
|
48
50
|
Once the plugin is installed, you will need to configure your Facebook app in config/facebooker.yml.
|
49
51
|
|
@@ -53,6 +55,22 @@ Your application users will need to have added the application in facebook to ac
|
|
53
55
|
|
54
56
|
to your application controller.
|
55
57
|
|
58
|
+
== using MemCache session
|
59
|
+
|
60
|
+
Facebook uses some non alphanum characters in the session identifier which interfere with memcache stored sessions. If you want to use MemCache for storing sessions, you can override the valid session id method on memcache by placing the following code in an initializer:
|
61
|
+
|
62
|
+
# add - as an okay key
|
63
|
+
class CGI
|
64
|
+
class Session
|
65
|
+
class MemCacheStore
|
66
|
+
def check_id(id) #:nodoc:#
|
67
|
+
/[^0-9a-zA-Z\-\._]+/ =~ id.to_s ? false : true
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
|
56
74
|
== LICENSE:
|
57
75
|
|
58
76
|
(The MIT License)
|
data/Rakefile
CHANGED
@@ -1,19 +1,51 @@
|
|
1
1
|
# -*- ruby -*-
|
2
|
-
|
2
|
+
#
|
3
3
|
require 'rubygems'
|
4
|
+
ENV['RUBY_FLAGS']="-I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}"
|
4
5
|
require 'hoe'
|
5
|
-
$: << File.dirname(__FILE__) + '/lib'
|
6
|
+
$: << File.dirname(__FILE__) + '/lib'
|
6
7
|
require './lib/facebooker.rb'
|
7
8
|
|
8
|
-
Hoe.new('facebooker', Facebooker::VERSION) do |p|
|
9
|
+
Hoe.new('facebooker', Facebooker::VERSION::STRING) do |p|
|
9
10
|
p.rubyforge_name = 'facebooker'
|
10
|
-
p.author = ['Chad Fowler', 'Patrick Ewing','Mike Mangino','Shane Vitarana']
|
11
|
+
p.author = ['Chad Fowler', 'Patrick Ewing', 'Mike Mangino', 'Shane Vitarana', 'Corey Innis']
|
11
12
|
p.email = 'mmangino@elevatedrails.com'
|
12
13
|
p.summary = 'Pure, idiomatic Ruby wrapper for the Facebook REST API.'
|
13
14
|
p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
|
14
15
|
p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
|
15
16
|
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
16
17
|
p.remote_rdoc_dir = '' # Release to root
|
18
|
+
p.test_globs = 'test/*.rb'
|
19
|
+
p.extra_deps << ['json', '>= 1.0.0']
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'rcov/rcovtask'
|
23
|
+
|
24
|
+
namespace :test do
|
25
|
+
namespace :coverage do
|
26
|
+
desc "Delete aggregate coverage data."
|
27
|
+
task(:clean) { rm_f "coverage.data" }
|
28
|
+
end
|
29
|
+
desc 'Aggregate code coverage for unit, functional and integration tests'
|
30
|
+
Rcov::RcovTask.new(:coverage) do |t|
|
31
|
+
t.libs << "test"
|
32
|
+
t.test_files = FileList["test/*.rb"]
|
33
|
+
t.output_dir = "coverage/"
|
34
|
+
t.verbose = true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
gem_spec_file = 'facebooker.gemspec'
|
39
|
+
|
40
|
+
gem_spec = eval(File.read(gem_spec_file)) rescue nil
|
41
|
+
|
42
|
+
desc "Generate the gemspec file."
|
43
|
+
task :gemspec do
|
44
|
+
require 'erb'
|
45
|
+
|
46
|
+
File.open(gem_spec_file, 'w') do |f|
|
47
|
+
f.write ERB.new(File.read("#{gem_spec_file}.erb")).result(binding)
|
48
|
+
end
|
17
49
|
end
|
18
50
|
|
19
51
|
# vim: syntax=Ruby
|
@@ -23,6 +55,12 @@ end
|
|
23
55
|
#
|
24
56
|
# require 'facebooker'
|
25
57
|
#
|
58
|
+
# namespace :doc do
|
59
|
+
# task :readme do
|
60
|
+
# puts "Readme"
|
61
|
+
# end
|
62
|
+
# end
|
63
|
+
#
|
26
64
|
# Gardener.configure do
|
27
65
|
# gem_spec do |spec|
|
28
66
|
# spec.name = 'facebooker'
|
data/TODO.txt
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
[ ]
|
2
|
-
[ ]
|
3
|
-
[ ] Refactor
|
4
|
-
[ ] Support missing parameters on methods---most notably authentication-related parameters such as next and canvas
|
5
|
-
[ ] Finish FQL Querying
|
6
|
-
[ ] Refactor FQL Querying
|
7
|
-
[ ] Transform incoming data into appropriate classes (Integers, Dates, etc.)
|
1
|
+
[ ] Document session handling. Come up with different cases and paths for the flow and create tests for each
|
2
|
+
[ ] Verify that sessions are used only where required. Raise exceptions on User methods that require a session when none is available
|
3
|
+
[ ] Refactor setup / Adapter loading code
|
8
4
|
|
9
|
-
[x] Specify fields wanted when getting user info (defaults to all now) [shane]
|
10
|
-
[x] Create facebooker.yml config file and merge with tunnel.yml [shane]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class FacebookGenerator < Rails::Generator::Base
|
2
|
+
def manifest
|
3
|
+
record do |m|
|
4
|
+
m.file 'config/facebooker.yml', 'config/facebooker.yml'
|
5
|
+
m.file 'public/javascripts/facebooker.js', 'public/javascripts/facebooker.js'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
def banner
|
12
|
+
"Usage: #{$0} facebooker"
|
13
|
+
end
|
14
|
+
end
|
@@ -1,12 +1,20 @@
|
|
1
1
|
# The api key, secret key, and canvas page name are required to get started
|
2
2
|
# Tunnel configuration is only needed if you are going to use the facebooker:tunnel Rake tasks
|
3
3
|
# Your callback url in Facebook should be set to http://public_host:public_port
|
4
|
+
# If you're building a Facebook connect site,
|
5
|
+
# change the value of set_asset_host_to_callback_url to false
|
6
|
+
# To develop for the new profile design, add the following key..
|
7
|
+
# api: new
|
8
|
+
# remove the key or set it to anything else to use the old facebook design.
|
9
|
+
# This should only be necessary until the final version of the new profile is released.
|
4
10
|
|
5
11
|
development:
|
6
12
|
api_key:
|
7
13
|
secret_key:
|
8
14
|
canvas_page_name:
|
9
15
|
callback_url:
|
16
|
+
pretty_errors: true
|
17
|
+
set_asset_host_to_callback_url: true
|
10
18
|
tunnel:
|
11
19
|
public_host_username:
|
12
20
|
public_host:
|
@@ -18,6 +26,7 @@ test:
|
|
18
26
|
secret_key:
|
19
27
|
canvas_page_name:
|
20
28
|
callback_url:
|
29
|
+
set_asset_host_to_callback_url: true
|
21
30
|
tunnel:
|
22
31
|
public_host_username:
|
23
32
|
public_host:
|
@@ -28,9 +37,10 @@ production:
|
|
28
37
|
api_key:
|
29
38
|
secret_key:
|
30
39
|
canvas_page_name:
|
31
|
-
callback_url:
|
40
|
+
callback_url:
|
41
|
+
set_asset_host_to_callback_url: true
|
32
42
|
tunnel:
|
33
43
|
public_host_username:
|
34
44
|
public_host:
|
35
45
|
public_port: 4007
|
36
|
-
local_port: 3000
|
46
|
+
local_port: 3000
|
@@ -0,0 +1,106 @@
|
|
1
|
+
|
2
|
+
function $(element) {
|
3
|
+
if (typeof element == "string") {
|
4
|
+
element=document.getElementById(element);
|
5
|
+
}
|
6
|
+
if (element)
|
7
|
+
extend_instance(element,Element);
|
8
|
+
return element;
|
9
|
+
}
|
10
|
+
|
11
|
+
function extend_instance(instance,hash) {
|
12
|
+
for (var name in hash) {
|
13
|
+
instance[name] = hash[name];
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
var Element = {
|
18
|
+
"hide": function () {
|
19
|
+
this.setStyle("display","none")
|
20
|
+
},
|
21
|
+
"show": function () {
|
22
|
+
this.setStyle("display","block")
|
23
|
+
},
|
24
|
+
"visible": function () {
|
25
|
+
return (this.getStyle("display") != "none");
|
26
|
+
},
|
27
|
+
"toggle": function () {
|
28
|
+
if (this.visible) {
|
29
|
+
this.hide();
|
30
|
+
} else {
|
31
|
+
this.show();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
function encodeURIComponent(str) {
|
37
|
+
if (typeof(str) == "string") {
|
38
|
+
return str.replace(/=/g,'%3D').replace(/&/g,'%26');
|
39
|
+
}
|
40
|
+
//checkboxes and radio buttons return objects instead of a string
|
41
|
+
else if(typeof(str) == "object"){
|
42
|
+
for (prop in str)
|
43
|
+
{
|
44
|
+
return str[prop].replace(/=/g,'%3D').replace(/&/g,'%26');
|
45
|
+
}
|
46
|
+
}
|
47
|
+
};
|
48
|
+
|
49
|
+
var Form = {};
|
50
|
+
Form.serialize = function(form_element) {
|
51
|
+
elements=$(form_element).serialize();
|
52
|
+
param_string="";
|
53
|
+
for (var name in elements) {
|
54
|
+
if (param_string)
|
55
|
+
param_string += "&";
|
56
|
+
param_string += encodeURIComponent(name)+"="+encodeURIComponent(elements[name]);
|
57
|
+
}
|
58
|
+
return param_string;
|
59
|
+
};
|
60
|
+
|
61
|
+
Ajax.Updater = function (container,url,options) {
|
62
|
+
this.container = container;
|
63
|
+
this.url=url;
|
64
|
+
this.ajax = new Ajax();
|
65
|
+
this.ajax.requireLogin = 1;
|
66
|
+
if (options["onSuccess"]) {
|
67
|
+
this.ajax.responseType = Ajax.JSON;
|
68
|
+
this.ajax.ondone = options["onSuccess"];
|
69
|
+
} else {
|
70
|
+
this.ajax.responseType = Ajax.FBML;
|
71
|
+
this.ajax.ondone = function(data) {
|
72
|
+
$(container).setInnerFBML(data);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
if (options["onFailure"]) {
|
76
|
+
this.ajax.onerror = options["onFailure"];
|
77
|
+
}
|
78
|
+
|
79
|
+
// Yes, this is an excercise in undoing what we just did
|
80
|
+
// FB doesn't provide encodeURI, but they will encode things passed as a hash
|
81
|
+
// so we turn it into a string, esaping & and =
|
82
|
+
// then we split it all back out here
|
83
|
+
// this could be killed if encodeURIComponent was available
|
84
|
+
parameters={};
|
85
|
+
if (options['parameters']) {
|
86
|
+
pairs=options['parameters'].split('&');
|
87
|
+
for (var i=0; i<pairs.length; i++) {
|
88
|
+
kv=pairs[i].split('=');
|
89
|
+
key=kv[0].replace(/%3D/g,'=').replace(/%26/g,'&');
|
90
|
+
val=kv[1].replace(/%3D/g,'=').replace(/%26/g,'&');
|
91
|
+
parameters[key]=val;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
this.ajax.post(url,parameters);
|
95
|
+
if (options["onLoading"]) {
|
96
|
+
options["onLoading"].call()
|
97
|
+
}
|
98
|
+
};
|
99
|
+
Ajax.Request = function(url,options) {
|
100
|
+
Ajax.Updater('unused',url,options);
|
101
|
+
};
|
102
|
+
|
103
|
+
PeriodicalExecuter = function (callback, frequency) {
|
104
|
+
setTimeout(callback, frequency *1000);
|
105
|
+
setTimeout(function() { new PeriodicalExecuter(callback,frequency); }, frequency*1000);
|
106
|
+
};
|