djanowski-facebooker 1.0.1
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/CHANGELOG.txt +0 -0
- data/COPYING +19 -0
- data/History.txt +16 -0
- data/Manifest.txt +110 -0
- data/README +46 -0
- data/README.txt +81 -0
- data/Rakefile +76 -0
- data/TODO.txt +10 -0
- data/generators/facebook/facebook_generator.rb +14 -0
- data/generators/facebook/templates/config/facebooker.yml +41 -0
- 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/init.rb +54 -0
- data/install.rb +12 -0
- data/lib/facebooker/adapters/adapter_base.rb +87 -0
- data/lib/facebooker/adapters/bebo_adapter.rb +73 -0
- data/lib/facebooker/adapters/facebook_adapter.rb +48 -0
- data/lib/facebooker/admin.rb +28 -0
- data/lib/facebooker/batch_request.rb +44 -0
- data/lib/facebooker/data.rb +57 -0
- data/lib/facebooker/feed.rb +78 -0
- data/lib/facebooker/logging.rb +51 -0
- data/lib/facebooker/model.rb +123 -0
- data/lib/facebooker/models/affiliation.rb +10 -0
- data/lib/facebooker/models/album.rb +11 -0
- data/lib/facebooker/models/applicationproperties.rb +39 -0
- data/lib/facebooker/models/cookie.rb +10 -0
- data/lib/facebooker/models/education_info.rb +11 -0
- data/lib/facebooker/models/event.rb +26 -0
- data/lib/facebooker/models/friend_list.rb +14 -0
- data/lib/facebooker/models/group.rb +35 -0
- data/lib/facebooker/models/info_item.rb +10 -0
- data/lib/facebooker/models/info_section.rb +10 -0
- data/lib/facebooker/models/location.rb +8 -0
- data/lib/facebooker/models/notifications.rb +17 -0
- data/lib/facebooker/models/page.rb +27 -0
- data/lib/facebooker/models/photo.rb +10 -0
- data/lib/facebooker/models/tag.rb +12 -0
- data/lib/facebooker/models/user.rb +352 -0
- data/lib/facebooker/models/work_info.rb +9 -0
- data/lib/facebooker/parser.rb +540 -0
- data/lib/facebooker/rails/controller.rb +246 -0
- data/lib/facebooker/rails/facebook_asset_path.rb +18 -0
- data/lib/facebooker/rails/facebook_form_builder.rb +112 -0
- data/lib/facebooker/rails/facebook_pretty_errors.rb +14 -0
- data/lib/facebooker/rails/facebook_request_fix.rb +24 -0
- data/lib/facebooker/rails/facebook_session_handling.rb +69 -0
- data/lib/facebooker/rails/facebook_url_rewriting.rb +39 -0
- data/lib/facebooker/rails/helpers.rb +615 -0
- data/lib/facebooker/rails/profile_publisher_extensions.rb +42 -0
- data/lib/facebooker/rails/publisher.rb +492 -0
- data/lib/facebooker/rails/routing.rb +49 -0
- data/lib/facebooker/rails/test_helpers.rb +88 -0
- data/lib/facebooker/rails/utilities.rb +22 -0
- data/lib/facebooker/server_cache.rb +24 -0
- data/lib/facebooker/service.rb +31 -0
- data/lib/facebooker/session.rb +564 -0
- data/lib/facebooker/version.rb +9 -0
- data/lib/facebooker.rb +143 -0
- data/lib/net/http_multipart_post.rb +123 -0
- data/lib/tasks/facebooker.rake +18 -0
- data/lib/tasks/tunnel.rake +46 -0
- data/rails/init.rb +1 -0
- data/setup.rb +1585 -0
- data/templates/layout.erb +24 -0
- data/test/adapters_test.rb +98 -0
- data/test/batch_request_test.rb +82 -0
- data/test/event_test.rb +15 -0
- data/test/facebook_admin_test.rb +75 -0
- data/test/facebook_cache_test.rb +43 -0
- data/test/facebook_data_test.rb +84 -0
- data/test/facebooker_test.rb +855 -0
- data/test/fixtures/multipart_post_body_with_only_parameters.txt +33 -0
- data/test/fixtures/multipart_post_body_with_single_file.txt +38 -0
- data/test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt +38 -0
- data/test/http_multipart_post_test.rb +54 -0
- data/test/logging_test.rb +43 -0
- data/test/model_test.rb +91 -0
- data/test/publisher_test.rb +436 -0
- data/test/rails_integration_test.rb +1126 -0
- data/test/session_test.rb +587 -0
- data/test/test_helper.rb +60 -0
- data/test/user_test.rb +229 -0
- metadata +181 -0
data/CHANGELOG.txt
ADDED
|
File without changes
|
data/COPYING
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2007 Chad Fowler <chad@infoether.com>
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
# this software and associated documentation files (the "Software"), to deal in the
|
|
6
|
+
# Software without restriction, including without limitation the rights to use,
|
|
7
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
|
8
|
+
# Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
# subject to the following conditions:
|
|
10
|
+
#
|
|
11
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
# copies or substantial portions of the Software.
|
|
13
|
+
#
|
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
17
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
18
|
+
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
19
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/History.txt
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
=== x.x.x / 2008-xx-xx
|
|
2
|
+
|
|
3
|
+
* fixed typo in set app properties parser [Andrew Grim, shane]
|
|
4
|
+
* Removed actor_id param from templatized feed [shane]
|
|
5
|
+
* Added admin.get_allocation [shane]
|
|
6
|
+
* Added data.get_cookies and data.set_cookie [shane]
|
|
7
|
+
* Added admin.get_app_properties and admin.set_app_properties [shane]
|
|
8
|
+
|
|
9
|
+
=== 0.9.9 / 2008-09-08
|
|
10
|
+
|
|
11
|
+
* Re-package as gem after reworking for new API
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
=== 0.9.5 / 2008-02-13
|
|
15
|
+
|
|
16
|
+
* Next release of documentation
|
data/Manifest.txt
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
CHANGELOG.txt
|
|
2
|
+
COPYING
|
|
3
|
+
History.txt
|
|
4
|
+
Manifest.txt
|
|
5
|
+
README
|
|
6
|
+
README.txt
|
|
7
|
+
Rakefile
|
|
8
|
+
TODO.txt
|
|
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
|
+
init.rb
|
|
41
|
+
install.rb
|
|
42
|
+
lib/facebooker.rb
|
|
43
|
+
lib/facebooker/adapters/adapter_base.rb
|
|
44
|
+
lib/facebooker/adapters/bebo_adapter.rb
|
|
45
|
+
lib/facebooker/adapters/facebook_adapter.rb
|
|
46
|
+
lib/facebooker/admin.rb
|
|
47
|
+
lib/facebooker/batch_request.rb
|
|
48
|
+
lib/facebooker/data.rb
|
|
49
|
+
lib/facebooker/feed.rb
|
|
50
|
+
lib/facebooker/logging.rb
|
|
51
|
+
lib/facebooker/model.rb
|
|
52
|
+
lib/facebooker/models/affiliation.rb
|
|
53
|
+
lib/facebooker/models/album.rb
|
|
54
|
+
lib/facebooker/models/applicationproperties.rb
|
|
55
|
+
lib/facebooker/models/cookie.rb
|
|
56
|
+
lib/facebooker/models/education_info.rb
|
|
57
|
+
lib/facebooker/models/event.rb
|
|
58
|
+
lib/facebooker/models/friend_list.rb
|
|
59
|
+
lib/facebooker/models/group.rb
|
|
60
|
+
lib/facebooker/models/info_item.rb
|
|
61
|
+
lib/facebooker/models/info_section.rb
|
|
62
|
+
lib/facebooker/models/location.rb
|
|
63
|
+
lib/facebooker/models/notifications.rb
|
|
64
|
+
lib/facebooker/models/page.rb
|
|
65
|
+
lib/facebooker/models/photo.rb
|
|
66
|
+
lib/facebooker/models/tag.rb
|
|
67
|
+
lib/facebooker/models/user.rb
|
|
68
|
+
lib/facebooker/models/work_info.rb
|
|
69
|
+
lib/facebooker/parser.rb
|
|
70
|
+
lib/facebooker/rails/controller.rb
|
|
71
|
+
lib/facebooker/rails/facebook_asset_path.rb
|
|
72
|
+
lib/facebooker/rails/facebook_form_builder.rb
|
|
73
|
+
lib/facebooker/rails/facebook_pretty_errors.rb
|
|
74
|
+
lib/facebooker/rails/facebook_request_fix.rb
|
|
75
|
+
lib/facebooker/rails/facebook_session_handling.rb
|
|
76
|
+
lib/facebooker/rails/facebook_url_rewriting.rb
|
|
77
|
+
lib/facebooker/rails/helpers.rb
|
|
78
|
+
lib/facebooker/rails/profile_publisher_extensions.rb
|
|
79
|
+
lib/facebooker/rails/publisher.rb
|
|
80
|
+
lib/facebooker/rails/routing.rb
|
|
81
|
+
lib/facebooker/rails/test_helpers.rb
|
|
82
|
+
lib/facebooker/rails/utilities.rb
|
|
83
|
+
lib/facebooker/server_cache.rb
|
|
84
|
+
lib/facebooker/service.rb
|
|
85
|
+
lib/facebooker/session.rb
|
|
86
|
+
lib/facebooker/version.rb
|
|
87
|
+
lib/net/http_multipart_post.rb
|
|
88
|
+
lib/tasks/facebooker.rake
|
|
89
|
+
lib/tasks/tunnel.rake
|
|
90
|
+
rails/init.rb
|
|
91
|
+
setup.rb
|
|
92
|
+
templates/layout.erb
|
|
93
|
+
test/adapters_test.rb
|
|
94
|
+
test/batch_request_test.rb
|
|
95
|
+
test/event_test.rb
|
|
96
|
+
test/facebook_admin_test.rb
|
|
97
|
+
test/facebook_cache_test.rb
|
|
98
|
+
test/facebook_data_test.rb
|
|
99
|
+
test/facebooker_test.rb
|
|
100
|
+
test/fixtures/multipart_post_body_with_only_parameters.txt
|
|
101
|
+
test/fixtures/multipart_post_body_with_single_file.txt
|
|
102
|
+
test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt
|
|
103
|
+
test/http_multipart_post_test.rb
|
|
104
|
+
test/logging_test.rb
|
|
105
|
+
test/model_test.rb
|
|
106
|
+
test/publisher_test.rb
|
|
107
|
+
test/rails_integration_test.rb
|
|
108
|
+
test/session_test.rb
|
|
109
|
+
test/test_helper.rb
|
|
110
|
+
test/user_test.rb
|
data/README
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Copyright (c) 2007 Chad Fowler, Patrick Ewing
|
|
2
|
+
|
|
3
|
+
= Facebooker
|
|
4
|
+
|
|
5
|
+
Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://developer.facebook.com]. Its goals are:
|
|
6
|
+
|
|
7
|
+
* Idiomatic Ruby
|
|
8
|
+
* No dependencies outside of the Ruby standard library (This is true with Rails 2.1. Previous Rails versions require the JSON gem)
|
|
9
|
+
* Concrete classes and methods modeling the Facebook data, so it's easy for a Rubyist to understand what's available
|
|
10
|
+
* Well tested
|
|
11
|
+
|
|
12
|
+
= Installing (Non Rails)
|
|
13
|
+
|
|
14
|
+
The best way is:
|
|
15
|
+
|
|
16
|
+
gem install facebooker
|
|
17
|
+
|
|
18
|
+
If, for some reason, you can't/won't use RubyGems, you can do:
|
|
19
|
+
|
|
20
|
+
(sudo) ruby setup.rb
|
|
21
|
+
|
|
22
|
+
= Installing (Rails)
|
|
23
|
+
|
|
24
|
+
Facebooker can be installed as a Rails plugin by:
|
|
25
|
+
|
|
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
|
|
29
|
+
|
|
30
|
+
Once the plugin is installed, you will need to configure your Facebook app in config/facebooker.yml.
|
|
31
|
+
|
|
32
|
+
Your application users will need to have added the application in facebook to access all of facebooker's features. You enforce this by adding
|
|
33
|
+
|
|
34
|
+
ensure_application_is_installed_by_facebook_user
|
|
35
|
+
|
|
36
|
+
to your application controller.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
== Work in Progress
|
|
40
|
+
|
|
41
|
+
I'm not saying it meets its goals fully yet. Please help. I'm especially interested in feedback and criticism re: Ruby style and design and testing. RCov has the library (at the time of this writing) at 100% coverage. I take that with a grain of salt, but it's a good start.
|
|
42
|
+
|
|
43
|
+
== Contribute
|
|
44
|
+
|
|
45
|
+
Please visit the {RubyForge project page}[http://rubyforge.org/projects/facebooker] to get the latest source via svn, write some tests, add/fix features, and submit a patch via the tracker. If you submit a good patch, it's likely that I'll add you to the project for commit access if you want to be added.
|
|
46
|
+
|
data/README.txt
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
= facebooker
|
|
2
|
+
|
|
3
|
+
* http://facebooker.rubyforge.org
|
|
4
|
+
|
|
5
|
+
== DESCRIPTION:
|
|
6
|
+
|
|
7
|
+
Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://developer.facebook.com]. Its goals are:
|
|
8
|
+
|
|
9
|
+
* Idiomatic Ruby
|
|
10
|
+
* No dependencies outside of the Ruby standard library (This is true with Rails 2.1. Previous Rails versions require the JSON gem)
|
|
11
|
+
* Concrete classes and methods modeling the Facebook data, so it's easy for a Rubyist to understand what's available
|
|
12
|
+
* Well tested
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
== FEATURES/PROBLEMS:
|
|
16
|
+
|
|
17
|
+
* Idiomatic Ruby
|
|
18
|
+
* No dependencies outside of the Ruby standard library
|
|
19
|
+
* Concrete classes and methods modeling the Facebook data, so it's easy for a Rubyist to understand what's available
|
|
20
|
+
* Well tested
|
|
21
|
+
|
|
22
|
+
== SYNOPSIS:
|
|
23
|
+
|
|
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
|
+
|
|
26
|
+
== REQUIREMENTS:
|
|
27
|
+
|
|
28
|
+
None
|
|
29
|
+
|
|
30
|
+
== INSTALL:
|
|
31
|
+
|
|
32
|
+
* Non Rails
|
|
33
|
+
|
|
34
|
+
The best way is:
|
|
35
|
+
|
|
36
|
+
gem install facebooker
|
|
37
|
+
|
|
38
|
+
If, for some reason, you can't/won't use RubyGems, you can do:
|
|
39
|
+
|
|
40
|
+
(sudo) ruby setup.rb
|
|
41
|
+
|
|
42
|
+
* Rails
|
|
43
|
+
|
|
44
|
+
Facebooker can be installed as a Rails plugin by:
|
|
45
|
+
|
|
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
|
|
49
|
+
|
|
50
|
+
Once the plugin is installed, you will need to configure your Facebook app in config/facebooker.yml.
|
|
51
|
+
|
|
52
|
+
Your application users will need to have added the application in facebook to access all of facebooker's features. You enforce this by adding
|
|
53
|
+
|
|
54
|
+
ensure_application_is_installed_by_facebook_user
|
|
55
|
+
|
|
56
|
+
to your application controller.
|
|
57
|
+
|
|
58
|
+
== LICENSE:
|
|
59
|
+
|
|
60
|
+
(The MIT License)
|
|
61
|
+
|
|
62
|
+
Copyright (c) 2008 FIX
|
|
63
|
+
|
|
64
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
65
|
+
a copy of this software and associated documentation files (the
|
|
66
|
+
'Software'), to deal in the Software without restriction, including
|
|
67
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
68
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
69
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
70
|
+
the following conditions:
|
|
71
|
+
|
|
72
|
+
The above copyright notice and this permission notice shall be
|
|
73
|
+
included in all copies or substantial portions of the Software.
|
|
74
|
+
|
|
75
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
76
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
77
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
78
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
79
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
80
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
81
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# -*- ruby -*-
|
|
2
|
+
#
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
ENV['RUBY_FLAGS']="-I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}"
|
|
5
|
+
require 'hoe'
|
|
6
|
+
$: << File.dirname(__FILE__) + '/lib'
|
|
7
|
+
require './lib/facebooker.rb'
|
|
8
|
+
|
|
9
|
+
Hoe.new('facebooker', Facebooker::VERSION::STRING) do |p|
|
|
10
|
+
p.rubyforge_name = 'facebooker'
|
|
11
|
+
p.author = ['Chad Fowler', 'Patrick Ewing', 'Mike Mangino', 'Shane Vitarana', 'Corey Innis']
|
|
12
|
+
p.email = 'mmangino@elevatedrails.com'
|
|
13
|
+
p.summary = 'Pure, idiomatic Ruby wrapper for the Facebook REST API.'
|
|
14
|
+
p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
|
|
15
|
+
p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
|
|
16
|
+
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
|
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
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# vim: syntax=Ruby
|
|
52
|
+
#
|
|
53
|
+
#
|
|
54
|
+
# require File.dirname(__FILE__) + '/vendor/gardener/lib/gardener'
|
|
55
|
+
#
|
|
56
|
+
# require 'facebooker'
|
|
57
|
+
#
|
|
58
|
+
# namespace :doc do
|
|
59
|
+
# task :readme do
|
|
60
|
+
# puts "Readme"
|
|
61
|
+
# end
|
|
62
|
+
# end
|
|
63
|
+
#
|
|
64
|
+
# Gardener.configure do
|
|
65
|
+
# gem_spec do |spec|
|
|
66
|
+
# spec.name = 'facebooker'
|
|
67
|
+
# spec.version = Gem::Version.new(Facebooker::VERSION::STRING)
|
|
68
|
+
# spec.summary = "Pure, idiomatic Ruby wrapper for the Facebook REST API."
|
|
69
|
+
# spec.email = 'chad@infoether.com'
|
|
70
|
+
# spec.author = ['Chad Fowler', 'Patrick Ewing','Mike Mangino','Shane Vitarana']
|
|
71
|
+
# spec.extra_rdoc_files = %w(COPYING)
|
|
72
|
+
# spec.rdoc_options = ['--title', "Gardener",
|
|
73
|
+
# '--main', 'README',
|
|
74
|
+
# '--line-numbers', '--inline-source']
|
|
75
|
+
# end
|
|
76
|
+
# end
|
data/TODO.txt
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
[ ] Refactor facebook form builder so erbout won't be deeply nested, causing erubis to break
|
|
2
|
+
[ ] Support missing parameters on methods---most notably authentication-related parameters such as next and canvas
|
|
3
|
+
[ ] Finish FQL Querying
|
|
4
|
+
[ ] Refactor FQL Querying
|
|
5
|
+
[ ] Transform incoming data into appropriate classes (Integers, Dates, etc.)
|
|
6
|
+
|
|
7
|
+
[x] Specify fields wanted when getting user info (defaults to all now) [shane]
|
|
8
|
+
[x] Create facebooker.yml config file and merge with tunnel.yml [shane]
|
|
9
|
+
[X] Remove facebook prefix from resource routes, making them worth with facebook and regular Rails controllers [mike]
|
|
10
|
+
[X] Use fb_sig_request_method to make facebook routes more Rails-like [mike]
|
|
@@ -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
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# The api key, secret key, and canvas page name are required to get started
|
|
2
|
+
# Tunnel configuration is only needed if you are going to use the facebooker:tunnel Rake tasks
|
|
3
|
+
# Your callback url in Facebook should be set to http://public_host:public_port
|
|
4
|
+
# To develop for the new profile design, add the following key..
|
|
5
|
+
# api: new
|
|
6
|
+
# remove the key or set it to anything else to use the old facebook design.
|
|
7
|
+
# This should only be necessary until the final version of the new profile is released.
|
|
8
|
+
|
|
9
|
+
development:
|
|
10
|
+
api_key:
|
|
11
|
+
secret_key:
|
|
12
|
+
canvas_page_name:
|
|
13
|
+
callback_url:
|
|
14
|
+
pretty_errors: true
|
|
15
|
+
tunnel:
|
|
16
|
+
public_host_username:
|
|
17
|
+
public_host:
|
|
18
|
+
public_port: 4007
|
|
19
|
+
local_port: 3000
|
|
20
|
+
|
|
21
|
+
test:
|
|
22
|
+
api_key:
|
|
23
|
+
secret_key:
|
|
24
|
+
canvas_page_name:
|
|
25
|
+
callback_url:
|
|
26
|
+
tunnel:
|
|
27
|
+
public_host_username:
|
|
28
|
+
public_host:
|
|
29
|
+
public_port: 4007
|
|
30
|
+
local_port: 3000
|
|
31
|
+
|
|
32
|
+
production:
|
|
33
|
+
api_key:
|
|
34
|
+
secret_key:
|
|
35
|
+
canvas_page_name:
|
|
36
|
+
callback_url:
|
|
37
|
+
tunnel:
|
|
38
|
+
public_host_username:
|
|
39
|
+
public_host:
|
|
40
|
+
public_port: 4007
|
|
41
|
+
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
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Description:
|
|
2
|
+
Stubs out a new controller and its views. Pass the controller name, either
|
|
3
|
+
CamelCased or under_scored, and a list of views as arguments.
|
|
4
|
+
|
|
5
|
+
To create a controller within a module, specify the controller name as a
|
|
6
|
+
path like 'parent_module/controller_name'.
|
|
7
|
+
|
|
8
|
+
This generates a controller class in app/controllers, view templates in
|
|
9
|
+
app/views/controller_name, a helper class in app/helpers, and a functional
|
|
10
|
+
test suite in test/functional.
|
|
11
|
+
|
|
12
|
+
Also, it generates fbml view templates.
|
|
13
|
+
|
|
14
|
+
Example:
|
|
15
|
+
`./script/generate controller CreditCard open debit credit close`
|
|
16
|
+
|
|
17
|
+
Credit card controller with URLs like /credit_card/debit.
|
|
18
|
+
Controller: app/controllers/credit_card_controller.rb
|
|
19
|
+
Views: app/views/credit_card/debit.html.erb [...],
|
|
20
|
+
app/views/credit_card/debit.fbml.erb [...]
|
|
21
|
+
Helper: app/helpers/credit_card_helper.rb
|
|
22
|
+
Test: test/functional/credit_card_controller_test.rb
|
|
23
|
+
|
|
24
|
+
Modules Example:
|
|
25
|
+
`./script/generate controller 'admin/credit_card' suspend late_fee`
|
|
26
|
+
|
|
27
|
+
Credit card admin controller with URLs /admin/credit_card/suspend.
|
|
28
|
+
Controller: app/controllers/admin/credit_card_controller.rb
|
|
29
|
+
Views: app/views/admin/credit_card/debit.html.erb [...],
|
|
30
|
+
app/views/admin/credit_card/debit.fbml.erb [...]
|
|
31
|
+
Helper: app/helpers/admin/credit_card_helper.rb
|
|
32
|
+
Test: test/functional/admin/credit_card_controller_test.rb
|
|
33
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
class FacebookControllerGenerator < Rails::Generator::NamedBase
|
|
2
|
+
def manifest
|
|
3
|
+
record do |m|
|
|
4
|
+
# Check for class naming collisions.
|
|
5
|
+
m.class_collisions class_path, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper"
|
|
6
|
+
|
|
7
|
+
# Controller, helper, views, and test directories.
|
|
8
|
+
m.directory File.join('app/controllers', class_path)
|
|
9
|
+
m.directory File.join('app/helpers', class_path)
|
|
10
|
+
m.directory File.join('app/views', class_path, file_name)
|
|
11
|
+
m.directory File.join('test/functional', class_path)
|
|
12
|
+
|
|
13
|
+
# Controller class, functional test, and helper class.
|
|
14
|
+
m.template 'controller.rb',
|
|
15
|
+
File.join('app/controllers',
|
|
16
|
+
class_path,
|
|
17
|
+
"#{file_name}_controller.rb")
|
|
18
|
+
|
|
19
|
+
m.template 'functional_test.rb',
|
|
20
|
+
File.join('test/functional',
|
|
21
|
+
class_path,
|
|
22
|
+
"#{file_name}_controller_test.rb")
|
|
23
|
+
|
|
24
|
+
m.template 'helper.rb',
|
|
25
|
+
File.join('app/helpers',
|
|
26
|
+
class_path,
|
|
27
|
+
"#{file_name}_helper.rb")
|
|
28
|
+
|
|
29
|
+
# View template for each action.
|
|
30
|
+
actions.each do |action|
|
|
31
|
+
html_path = File.join('app/views', class_path, file_name, "#{action}.html.erb")
|
|
32
|
+
m.template 'view.html.erb', html_path,
|
|
33
|
+
:assigns => { :action => action, :path => html_path }
|
|
34
|
+
fbml_path = File.join('app/views', class_path, file_name, "#{action}.fbml.erb")
|
|
35
|
+
m.template 'view.fbml.erb', fbml_path,
|
|
36
|
+
:assigns => { :action => action, :path => fbml_path }
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
require File.dirname(__FILE__)+'/../../vendor/plugins/facebooker/lib/facebooker/rails/test_helpers.rb'
|
|
3
|
+
|
|
4
|
+
class <%= class_name %>ControllerTest < ActionController::TestCase
|
|
5
|
+
include Facebooker::Rails::TestHelpers
|
|
6
|
+
|
|
7
|
+
# Replace this with your real tests.
|
|
8
|
+
def test_truth
|
|
9
|
+
assert true
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class FacebookPublisherGenerator < Rails::Generator::NamedBase
|
|
2
|
+
def manifest
|
|
3
|
+
record do |m|
|
|
4
|
+
m.directory "app/models"
|
|
5
|
+
m.template "publisher.rb", "app/models/#{file_name}_publisher.rb"
|
|
6
|
+
migration_file_name="create_facebook_templates"
|
|
7
|
+
# unless m.migration_exists?(migration_file_name)
|
|
8
|
+
# THis should work, but it doesn't. So we re-implement it instead
|
|
9
|
+
if Dir.glob(File.join(RAILS_ROOT,"db","migrate","[0-9]*_*.rb")).grep(/[0-9]+_create_facebook_templates.rb$/).blank?
|
|
10
|
+
m.migration_template "create_facebook_templates.rb", "db/migrate", :migration_file_name=>migration_file_name
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CreateFacebookTemplates < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :facebook_templates, :force => true do |t|
|
|
4
|
+
t.string :template_name, :null => false
|
|
5
|
+
t.string :content_hash, :null => false
|
|
6
|
+
t.string :bundle_id, :null => true
|
|
7
|
+
end
|
|
8
|
+
add_index :facebook_templates, :template_name, :unique => true
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.down
|
|
12
|
+
remove_index :facebook_templates, :template_name
|
|
13
|
+
drop_table :facebook_templates
|
|
14
|
+
end
|
|
15
|
+
end
|