mmangino-facebooker 1.0.29 → 1.0.30
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +15 -0
- data/Manifest.txt +129 -0
- data/Rakefile +2 -3
- data/examples/desktop_login.rb +14 -0
- data/facebooker.gemspec +43 -0
- data/lib/facebooker/adapters/adapter_base.rb +3 -2
- data/lib/facebooker/adapters/bebo_adapter.rb +6 -4
- data/lib/facebooker/batch_request.rb +11 -10
- data/lib/facebooker/logging.rb +6 -13
- data/lib/facebooker/mobile.rb +2 -2
- data/lib/facebooker/model.rb +15 -13
- data/lib/facebooker/models/applicationproperties.rb +1 -1
- data/lib/facebooker/models/applicationrestrictions.rb +3 -3
- data/lib/facebooker/models/event.rb +2 -2
- data/lib/facebooker/models/friend_list.rb +2 -2
- data/lib/facebooker/models/group.rb +4 -4
- data/lib/facebooker/models/page.rb +3 -2
- data/lib/facebooker/models/photo.rb +2 -2
- data/lib/facebooker/models/user.rb +13 -5
- data/lib/facebooker/models/work_info.rb +3 -2
- data/lib/facebooker/rails/controller.rb +6 -1
- data/lib/facebooker/rails/facebook_request_fix.rb +12 -8
- data/lib/facebooker/rails/facebook_session_handling.rb +1 -2
- data/lib/facebooker/rails/facebook_url_rewriting.rb +14 -11
- data/lib/facebooker/rails/helpers/fb_connect.rb +8 -2
- data/lib/facebooker/rails/helpers.rb +4 -3
- data/lib/facebooker/rails/publisher.rb +36 -30
- data/lib/facebooker/session.rb +81 -73
- data/lib/facebooker/version.rb +1 -1
- data/lib/facebooker.rb +41 -39
- data/test/facebooker/adapters_test.rb +23 -23
- data/test/facebooker/model_test.rb +10 -0
- data/test/facebooker/rails/publisher_test.rb +97 -88
- data/test/facebooker/rails_integration_test.rb +44 -43
- data/test/facebooker/session_test.rb +5 -5
- data/test/rack/facebook_test.rb +2 -3
- data/test/rails_test_helper.rb +14 -0
- data/test/test_helper.rb +5 -4
- metadata +21 -16
data/.autotest
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Autotest.add_hook(:initialize) do |at|
|
2
|
+
at.clear_mappings
|
3
|
+
at.find_directories = %w(lib test)
|
4
|
+
|
5
|
+
at.add_exception("test/test_helper.rb")
|
6
|
+
at.add_exception("test/rails_test_helper.rb")
|
7
|
+
|
8
|
+
at.add_mapping(/^lib\/.*\.rb$/) do |file, _|
|
9
|
+
at.files_matching(/^test\/.*_test\.rb$/)
|
10
|
+
end
|
11
|
+
|
12
|
+
at.add_mapping(/^test\/.*_test\.rb$/) do |file, _|
|
13
|
+
file
|
14
|
+
end
|
15
|
+
end
|
data/Manifest.txt
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
.autotest
|
2
|
+
CHANGELOG.rdoc
|
3
|
+
COPYING.rdoc
|
4
|
+
Manifest.txt
|
5
|
+
README.rdoc
|
6
|
+
Rakefile
|
7
|
+
TODO.rdoc
|
8
|
+
examples/desktop_login.rb
|
9
|
+
facebooker.gemspec
|
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/publisher/publisher_generator.rb
|
41
|
+
generators/xd_receiver/templates/xd_receiver.html
|
42
|
+
generators/xd_receiver/xd_receiver_generator.rb
|
43
|
+
init.rb
|
44
|
+
install.rb
|
45
|
+
lib/facebooker.rb
|
46
|
+
lib/facebooker/adapters/adapter_base.rb
|
47
|
+
lib/facebooker/adapters/bebo_adapter.rb
|
48
|
+
lib/facebooker/adapters/facebook_adapter.rb
|
49
|
+
lib/facebooker/admin.rb
|
50
|
+
lib/facebooker/batch_request.rb
|
51
|
+
lib/facebooker/data.rb
|
52
|
+
lib/facebooker/feed.rb
|
53
|
+
lib/facebooker/logging.rb
|
54
|
+
lib/facebooker/mobile.rb
|
55
|
+
lib/facebooker/mock/service.rb
|
56
|
+
lib/facebooker/mock/session.rb
|
57
|
+
lib/facebooker/model.rb
|
58
|
+
lib/facebooker/models/affiliation.rb
|
59
|
+
lib/facebooker/models/album.rb
|
60
|
+
lib/facebooker/models/applicationproperties.rb
|
61
|
+
lib/facebooker/models/applicationrestrictions.rb
|
62
|
+
lib/facebooker/models/cookie.rb
|
63
|
+
lib/facebooker/models/education_info.rb
|
64
|
+
lib/facebooker/models/event.rb
|
65
|
+
lib/facebooker/models/friend_list.rb
|
66
|
+
lib/facebooker/models/group.rb
|
67
|
+
lib/facebooker/models/info_item.rb
|
68
|
+
lib/facebooker/models/info_section.rb
|
69
|
+
lib/facebooker/models/location.rb
|
70
|
+
lib/facebooker/models/notifications.rb
|
71
|
+
lib/facebooker/models/page.rb
|
72
|
+
lib/facebooker/models/photo.rb
|
73
|
+
lib/facebooker/models/tag.rb
|
74
|
+
lib/facebooker/models/user.rb
|
75
|
+
lib/facebooker/models/video.rb
|
76
|
+
lib/facebooker/models/work_info.rb
|
77
|
+
lib/facebooker/parser.rb
|
78
|
+
lib/facebooker/rails/controller.rb
|
79
|
+
lib/facebooker/rails/cucumber.rb
|
80
|
+
lib/facebooker/rails/cucumber/world.rb
|
81
|
+
lib/facebooker/rails/extensions/action_controller.rb
|
82
|
+
lib/facebooker/rails/extensions/rack_setup.rb
|
83
|
+
lib/facebooker/rails/extensions/routing.rb
|
84
|
+
lib/facebooker/rails/facebook_form_builder.rb
|
85
|
+
lib/facebooker/rails/facebook_pretty_errors.rb
|
86
|
+
lib/facebooker/rails/facebook_request_fix.rb
|
87
|
+
lib/facebooker/rails/facebook_session_handling.rb
|
88
|
+
lib/facebooker/rails/facebook_url_helper.rb
|
89
|
+
lib/facebooker/rails/facebook_url_rewriting.rb
|
90
|
+
lib/facebooker/rails/helpers.rb
|
91
|
+
lib/facebooker/rails/helpers/fb_connect.rb
|
92
|
+
lib/facebooker/rails/integration_session.rb
|
93
|
+
lib/facebooker/rails/profile_publisher_extensions.rb
|
94
|
+
lib/facebooker/rails/publisher.rb
|
95
|
+
lib/facebooker/rails/routing.rb
|
96
|
+
lib/facebooker/rails/test_helpers.rb
|
97
|
+
lib/facebooker/rails/utilities.rb
|
98
|
+
lib/facebooker/server_cache.rb
|
99
|
+
lib/facebooker/service.rb
|
100
|
+
lib/facebooker/session.rb
|
101
|
+
lib/facebooker/version.rb
|
102
|
+
lib/net/http_multipart_post.rb
|
103
|
+
lib/rack/facebook.rb
|
104
|
+
lib/tasks/facebooker.rake
|
105
|
+
lib/tasks/tunnel.rake
|
106
|
+
rails/init.rb
|
107
|
+
setup.rb
|
108
|
+
templates/layout.erb
|
109
|
+
test/facebooker/adapters_test.rb
|
110
|
+
test/facebooker/admin_test.rb
|
111
|
+
test/facebooker/batch_request_test.rb
|
112
|
+
test/facebooker/data_test.rb
|
113
|
+
test/facebooker/logging_test.rb
|
114
|
+
test/facebooker/mobile_test.rb
|
115
|
+
test/facebooker/model_test.rb
|
116
|
+
test/facebooker/models/event_test.rb
|
117
|
+
test/facebooker/models/user_test.rb
|
118
|
+
test/facebooker/rails/publisher_test.rb
|
119
|
+
test/facebooker/rails_integration_test.rb
|
120
|
+
test/facebooker/server_cache_test.rb
|
121
|
+
test/facebooker/session_test.rb
|
122
|
+
test/facebooker_test.rb
|
123
|
+
test/fixtures/multipart_post_body_with_only_parameters.txt
|
124
|
+
test/fixtures/multipart_post_body_with_single_file.txt
|
125
|
+
test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt
|
126
|
+
test/net/http_multipart_post_test.rb
|
127
|
+
test/rack/facebook_test.rb
|
128
|
+
test/rails_test_helper.rb
|
129
|
+
test/test_helper.rb
|
data/Rakefile
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
#
|
3
3
|
require 'rubygems'
|
4
|
-
ENV['RUBY_FLAGS']="-I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}"
|
5
4
|
require 'hoe'
|
6
5
|
begin
|
7
6
|
require 'load_multi_rails_rake_tasks'
|
@@ -20,13 +19,13 @@ HOE = Hoe.new('facebooker', Facebooker::VERSION::STRING) do |p|
|
|
20
19
|
p.history_file = 'CHANGELOG.rdoc'
|
21
20
|
p.remote_rdoc_dir = '' # Release to root
|
22
21
|
p.test_globs = 'test/**/*_test.rb'
|
23
|
-
p.extra_deps << ['json', '>= 1.0.0']
|
22
|
+
p.extra_deps << ['json', '>= 1.0.0']
|
24
23
|
p.extra_rdoc_files = FileList['*.rdoc']
|
25
24
|
end
|
26
25
|
|
27
26
|
require 'rcov/rcovtask'
|
28
27
|
|
29
|
-
namespace :test do
|
28
|
+
namespace :test do
|
30
29
|
namespace :coverage do
|
31
30
|
desc "Delete aggregate coverage data."
|
32
31
|
task(:clean) { rm_f "coverage.data" }
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$: << File.join(File.dirname(__FILE__), "..", 'lib')
|
2
|
+
require 'facebooker'
|
3
|
+
load "~/.facebooker" rescue fail("You'll need to specify API_KEY and SECRET_KEY to run this example. One way to do that would be to put them in ~/.facebooker")
|
4
|
+
session = Facebooker::Session::Desktop.create(API_KEY, SECRET_KEY)
|
5
|
+
puts session.login_url
|
6
|
+
gets
|
7
|
+
|
8
|
+
session.user.friends!.each do |user|
|
9
|
+
puts "#{user.id}:#{user.name}"
|
10
|
+
end
|
11
|
+
# This time all the data is there because friends! has already retrieved it.
|
12
|
+
session.user.friends.each do |user|
|
13
|
+
puts "#{user.id}:#{user.name}"
|
14
|
+
end
|
data/facebooker.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{facebooker}
|
5
|
+
s.version = "1.0.30"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Chad Fowler", "Patrick Ewing", "Mike Mangino", "Shane Vitarana", "Corey Innis"]
|
9
|
+
s.date = %q{2009-04-29}
|
10
|
+
s.description = %q{Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://wiki.developers.facebook.com/index.php/API]. Its goals are:
|
11
|
+
|
12
|
+
* Idiomatic Ruby
|
13
|
+
* No dependencies outside of the Ruby standard library (This is true with Rails 2.1. Previous Rails versions require the JSON gem)
|
14
|
+
* Concrete classes and methods modeling the Facebook data, so it's easy for a Rubyist to understand what's available
|
15
|
+
* Well tested}
|
16
|
+
s.email = %q{mmangino@elevatedrails.com}
|
17
|
+
s.extra_rdoc_files = ["Manifest.txt", "CHANGELOG.rdoc", "COPYING.rdoc", "README.rdoc", "TODO.rdoc"]
|
18
|
+
s.files = [".autotest", "CHANGELOG.rdoc", "COPYING.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "TODO.rdoc", "examples/desktop_login.rb", "facebooker.gemspec", "generators/facebook/facebook_generator.rb", "generators/facebook/templates/config/facebooker.yml", "generators/facebook/templates/public/javascripts/facebooker.js", "generators/facebook_controller/USAGE", "generators/facebook_controller/facebook_controller_generator.rb", "generators/facebook_controller/templates/controller.rb", "generators/facebook_controller/templates/functional_test.rb", "generators/facebook_controller/templates/helper.rb", "generators/facebook_controller/templates/view.fbml.erb", "generators/facebook_controller/templates/view.html.erb", "generators/facebook_publisher/facebook_publisher_generator.rb", "generators/facebook_publisher/templates/create_facebook_templates.rb", "generators/facebook_publisher/templates/publisher.rb", "generators/facebook_scaffold/USAGE", "generators/facebook_scaffold/facebook_scaffold_generator.rb", "generators/facebook_scaffold/templates/controller.rb", "generators/facebook_scaffold/templates/facebook_style.css", "generators/facebook_scaffold/templates/functional_test.rb", "generators/facebook_scaffold/templates/helper.rb", "generators/facebook_scaffold/templates/layout.fbml.erb", "generators/facebook_scaffold/templates/layout.html.erb", "generators/facebook_scaffold/templates/style.css", "generators/facebook_scaffold/templates/view_edit.fbml.erb", "generators/facebook_scaffold/templates/view_edit.html.erb", "generators/facebook_scaffold/templates/view_index.fbml.erb", "generators/facebook_scaffold/templates/view_index.html.erb", "generators/facebook_scaffold/templates/view_new.fbml.erb", "generators/facebook_scaffold/templates/view_new.html.erb", "generators/facebook_scaffold/templates/view_show.fbml.erb", "generators/facebook_scaffold/templates/view_show.html.erb", "generators/publisher/publisher_generator.rb", "generators/xd_receiver/templates/xd_receiver.html", "generators/xd_receiver/xd_receiver_generator.rb", "init.rb", "install.rb", "lib/facebooker.rb", "lib/facebooker/adapters/adapter_base.rb", "lib/facebooker/adapters/bebo_adapter.rb", "lib/facebooker/adapters/facebook_adapter.rb", "lib/facebooker/admin.rb", "lib/facebooker/batch_request.rb", "lib/facebooker/data.rb", "lib/facebooker/feed.rb", "lib/facebooker/logging.rb", "lib/facebooker/mobile.rb", "lib/facebooker/mock/service.rb", "lib/facebooker/mock/session.rb", "lib/facebooker/model.rb", "lib/facebooker/models/affiliation.rb", "lib/facebooker/models/album.rb", "lib/facebooker/models/applicationproperties.rb", "lib/facebooker/models/applicationrestrictions.rb", "lib/facebooker/models/cookie.rb", "lib/facebooker/models/education_info.rb", "lib/facebooker/models/event.rb", "lib/facebooker/models/friend_list.rb", "lib/facebooker/models/group.rb", "lib/facebooker/models/info_item.rb", "lib/facebooker/models/info_section.rb", "lib/facebooker/models/location.rb", "lib/facebooker/models/notifications.rb", "lib/facebooker/models/page.rb", "lib/facebooker/models/photo.rb", "lib/facebooker/models/tag.rb", "lib/facebooker/models/user.rb", "lib/facebooker/models/video.rb", "lib/facebooker/models/work_info.rb", "lib/facebooker/parser.rb", "lib/facebooker/rails/controller.rb", "lib/facebooker/rails/cucumber.rb", "lib/facebooker/rails/cucumber/world.rb", "lib/facebooker/rails/extensions/action_controller.rb", "lib/facebooker/rails/extensions/rack_setup.rb", "lib/facebooker/rails/extensions/routing.rb", "lib/facebooker/rails/facebook_form_builder.rb", "lib/facebooker/rails/facebook_pretty_errors.rb", "lib/facebooker/rails/facebook_request_fix.rb", "lib/facebooker/rails/facebook_session_handling.rb", "lib/facebooker/rails/facebook_url_helper.rb", "lib/facebooker/rails/facebook_url_rewriting.rb", "lib/facebooker/rails/helpers.rb", "lib/facebooker/rails/helpers/fb_connect.rb", "lib/facebooker/rails/integration_session.rb", "lib/facebooker/rails/profile_publisher_extensions.rb", "lib/facebooker/rails/publisher.rb", "lib/facebooker/rails/routing.rb", "lib/facebooker/rails/test_helpers.rb", "lib/facebooker/rails/utilities.rb", "lib/facebooker/server_cache.rb", "lib/facebooker/service.rb", "lib/facebooker/session.rb", "lib/facebooker/version.rb", "lib/net/http_multipart_post.rb", "lib/rack/facebook.rb", "lib/tasks/facebooker.rake", "lib/tasks/tunnel.rake", "rails/init.rb", "setup.rb", "templates/layout.erb", "test/facebooker/adapters_test.rb", "test/facebooker/admin_test.rb", "test/facebooker/batch_request_test.rb", "test/facebooker/data_test.rb", "test/facebooker/logging_test.rb", "test/facebooker/mobile_test.rb", "test/facebooker/model_test.rb", "test/facebooker/models/event_test.rb", "test/facebooker/models/user_test.rb", "test/facebooker/rails/publisher_test.rb", "test/facebooker/rails_integration_test.rb", "test/facebooker/server_cache_test.rb", "test/facebooker/session_test.rb", "test/facebooker_test.rb", "test/fixtures/multipart_post_body_with_only_parameters.txt", "test/fixtures/multipart_post_body_with_single_file.txt", "test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt", "test/net/http_multipart_post_test.rb", "test/rack/facebook_test.rb", "test/rails_test_helper.rb", "test/test_helper.rb"]
|
19
|
+
s.has_rdoc = true
|
20
|
+
s.homepage = %q{http://facebooker.rubyforge.org}
|
21
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
22
|
+
s.require_paths = ["lib"]
|
23
|
+
s.rubyforge_project = %q{facebooker}
|
24
|
+
s.rubygems_version = %q{1.3.2}
|
25
|
+
s.summary = %q{Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://wiki.developers.facebook.com/index.php/API]}
|
26
|
+
s.test_files = ["test/facebooker/adapters_test.rb", "test/facebooker/admin_test.rb", "test/facebooker/batch_request_test.rb", "test/facebooker/data_test.rb", "test/facebooker/logging_test.rb", "test/facebooker/mobile_test.rb", "test/facebooker/model_test.rb", "test/facebooker/models/event_test.rb", "test/facebooker/models/user_test.rb", "test/facebooker/rails/publisher_test.rb", "test/facebooker/rails_integration_test.rb", "test/facebooker/server_cache_test.rb", "test/facebooker/session_test.rb", "test/facebooker_test.rb", "test/net/http_multipart_post_test.rb", "test/rack/facebook_test.rb"]
|
27
|
+
|
28
|
+
if s.respond_to? :specification_version then
|
29
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
30
|
+
s.specification_version = 3
|
31
|
+
|
32
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
33
|
+
s.add_runtime_dependency(%q<json>, [">= 1.0.0"])
|
34
|
+
s.add_development_dependency(%q<hoe>, [">= 1.12.1"])
|
35
|
+
else
|
36
|
+
s.add_dependency(%q<json>, [">= 1.0.0"])
|
37
|
+
s.add_dependency(%q<hoe>, [">= 1.12.1"])
|
38
|
+
end
|
39
|
+
else
|
40
|
+
s.add_dependency(%q<json>, [">= 1.0.0"])
|
41
|
+
s.add_dependency(%q<hoe>, [">= 1.12.1"])
|
42
|
+
end
|
43
|
+
end
|
@@ -26,6 +26,7 @@ module Facebooker
|
|
26
26
|
|
27
27
|
def initialize(config)
|
28
28
|
@config = config
|
29
|
+
@facebook_path_prefix = nil
|
29
30
|
end
|
30
31
|
|
31
32
|
def self.facebooker_config
|
@@ -36,7 +37,7 @@ module Facebooker
|
|
36
37
|
def self.load_adapter(params)
|
37
38
|
|
38
39
|
config_key_base = params[:config_key_base] # This allows for loading of a aspecific adapter
|
39
|
-
config_key_base += "_"
|
40
|
+
config_key_base += "_" if config_key_base && config_key_base.length > 0
|
40
41
|
|
41
42
|
unless api_key = (params[:fb_sig_api_key] || facebooker_config["#{config_key_base}api_key"])
|
42
43
|
raise Facebooker::AdapterBase::UnableToLoadAdapter
|
@@ -51,7 +52,7 @@ module Facebooker
|
|
51
52
|
|
52
53
|
key_base = key.match(/(.*)[_]?api_key/)[1]
|
53
54
|
|
54
|
-
adapter_class_name = if key_base.
|
55
|
+
adapter_class_name = if !key_base || key_base.length == 0
|
55
56
|
"FacebookAdapter"
|
56
57
|
else
|
57
58
|
facebooker_config[key_base + "adapter"]
|
@@ -12,16 +12,16 @@ module Facebooker
|
|
12
12
|
def api_rest_path
|
13
13
|
"/restserver.php"
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def is_for?(application_context)
|
17
17
|
application_context == :bebo
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def www_server_base_url
|
21
21
|
"www.bebo.com"
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
|
25
25
|
def login_url_base
|
26
26
|
"http://#{www_server_base_url}/SignIn.jsp?ApiKey=#{api_key}&v=1.0"
|
27
27
|
end
|
@@ -33,7 +33,6 @@ module Facebooker
|
|
33
33
|
end
|
34
34
|
|
35
35
|
# Things that don't actually work as expected in BEBO
|
36
|
-
Facebooker::PublishTemplatizedAction
|
37
36
|
module Facebooker
|
38
37
|
class User
|
39
38
|
def set_profile_fbml_with_bebo_adapter(profile_fbml, mobile_fbml, profile_action_fbml, profile_main = nil)
|
@@ -49,6 +48,9 @@ module Facebooker
|
|
49
48
|
private
|
50
49
|
|
51
50
|
BEBO_FIELDS = FIELDS - [:meeting_sex, :wall_count, :meeting_for]
|
51
|
+
|
52
|
+
remove_method :collect
|
53
|
+
|
52
54
|
def collect(fields)
|
53
55
|
if(Facebooker.is_for?(:bebo) )
|
54
56
|
BEBO_FIELDS.reject{|field_name| !fields.empty? && !fields.include?(field_name)}.join(',')
|
@@ -5,19 +5,21 @@ module Facebooker
|
|
5
5
|
attr_reader :method
|
6
6
|
class UnexecutedRequest < StandardError; end
|
7
7
|
def initialize(params,proc)
|
8
|
-
@
|
9
|
-
@
|
10
|
-
@
|
8
|
+
@exception = nil
|
9
|
+
@result = nil
|
10
|
+
@method = params[:method]
|
11
|
+
@uri = params.map{|k,v| "#{k}=#{CGI.escape(v.to_s)}"}.join("&")
|
12
|
+
@proc = proc
|
11
13
|
end
|
12
|
-
|
14
|
+
|
13
15
|
def result=(result_object)
|
14
16
|
@result = @proc.nil? ? result_object : @proc.call(result_object)
|
15
17
|
end
|
16
|
-
|
18
|
+
|
17
19
|
def exception_raised=(ex)
|
18
20
|
@exception=ex
|
19
21
|
end
|
20
|
-
|
22
|
+
|
21
23
|
def exception_raised?
|
22
24
|
@exception.nil? ? false : raise(@exception)
|
23
25
|
end
|
@@ -25,12 +27,11 @@ module Facebooker
|
|
25
27
|
def respond_to?(name)
|
26
28
|
super || @result.respond_to?(name)
|
27
29
|
end
|
28
|
-
|
30
|
+
|
29
31
|
def ===(other)
|
30
32
|
other === @result
|
31
33
|
end
|
32
|
-
|
33
|
-
|
34
|
+
|
34
35
|
def method_missing(name,*args,&proc)
|
35
36
|
if @exception
|
36
37
|
raise @exception
|
@@ -41,4 +42,4 @@ module Facebooker
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
44
|
-
end
|
45
|
+
end
|
data/lib/facebooker/logging.rb
CHANGED
@@ -9,16 +9,9 @@ module Facebooker
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module Logging
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.skip_api_logging
|
18
|
-
@skip_api_logging
|
19
|
-
end
|
20
|
-
|
21
|
-
|
12
|
+
@skip_api_logging = nil
|
13
|
+
class << self; attr_accessor :skip_api_logging; end
|
14
|
+
|
22
15
|
def self.log_fb_api(method, params)
|
23
16
|
message = method # might customize later
|
24
17
|
dump = format_fb_params(params)
|
@@ -36,11 +29,11 @@ module Facebooker
|
|
36
29
|
log_info(message, exception)
|
37
30
|
raise
|
38
31
|
end
|
39
|
-
|
32
|
+
|
40
33
|
def self.format_fb_params(params)
|
41
34
|
params.map { |key,value| "#{key} = #{value}" }.join(', ')
|
42
35
|
end
|
43
|
-
|
36
|
+
|
44
37
|
def self.log_info(message, dump, seconds = 0)
|
45
38
|
return unless Facebooker.logger
|
46
39
|
log_message = "#{message} (#{seconds}) #{dump}"
|
@@ -48,4 +41,4 @@ module Facebooker
|
|
48
41
|
end
|
49
42
|
|
50
43
|
end
|
51
|
-
end
|
44
|
+
end
|
data/lib/facebooker/mobile.rb
CHANGED
@@ -3,12 +3,12 @@ module Facebooker
|
|
3
3
|
def initialize(session)
|
4
4
|
@session = session
|
5
5
|
end
|
6
|
-
|
6
|
+
|
7
7
|
# Used to determine whether the user identified by "uid" has enabled SMS for this application.
|
8
8
|
def can_send(user)
|
9
9
|
@session.post('facebook.sms.canSend', :uid => User.cast_to_facebook_id(user))
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
# Send the given message to the user.
|
13
13
|
# See http://wiki.developers.facebook.com/index.php/Mobile
|
14
14
|
def send(user, message)
|
data/lib/facebooker/model.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Facebooker
|
2
2
|
##
|
3
|
-
# helper methods primarily supporting the management of Ruby objects which are populatable via Hashes.
|
3
|
+
# helper methods primarily supporting the management of Ruby objects which are populatable via Hashes.
|
4
4
|
# Since most Facebook API calls accept and return hashes of data (as XML), the Model module allows us to
|
5
5
|
# directly populate a model's attributes given a Hash with matching key names.
|
6
6
|
module Model
|
@@ -19,15 +19,15 @@ module Facebooker
|
|
19
19
|
yield instance if block_given?
|
20
20
|
instance
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
##
|
24
|
-
# Create a standard attr_writer and a populating_attr_reader
|
24
|
+
# Create a standard attr_writer and a populating_attr_reader
|
25
25
|
def populating_attr_accessor(*symbols)
|
26
|
-
attr_writer
|
27
|
-
populating_attr_reader
|
26
|
+
attr_writer(*symbols)
|
27
|
+
populating_attr_reader(*symbols)
|
28
28
|
end
|
29
29
|
|
30
|
-
##
|
30
|
+
##
|
31
31
|
# Create a reader that will attempt to populate the model if it has not already been populated
|
32
32
|
def populating_attr_reader(*symbols)
|
33
33
|
symbols.each do |symbol|
|
@@ -59,27 +59,29 @@ module Facebooker
|
|
59
59
|
def hash_settable_writer(symbol, klass)
|
60
60
|
define_method("#{symbol}=") do |value|
|
61
61
|
instance_variable_set("@#{symbol}", value.kind_of?(Hash) ? klass.from_hash(value) : value)
|
62
|
-
end
|
62
|
+
end
|
63
63
|
end
|
64
64
|
|
65
65
|
#
|
66
66
|
# Declares an attribute named ::symbol:: which can be set with either a list of instances of ::klass::
|
67
|
-
# or a list of Hashes which will be used to populate a new instance of ::klass::.
|
67
|
+
# or a list of Hashes which will be used to populate a new instance of ::klass::.
|
68
68
|
def hash_settable_list_accessor(symbol, klass)
|
69
69
|
attr_reader symbol
|
70
70
|
hash_settable_list_writer(symbol, klass)
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
def hash_settable_list_writer(symbol, klass)
|
74
74
|
define_method("#{symbol}=") do |list|
|
75
75
|
instance_variable_set("@#{symbol}", list.map do |item|
|
76
76
|
item.kind_of?(Hash) ? klass.from_hash(item) : item
|
77
77
|
end)
|
78
78
|
end
|
79
|
-
end
|
79
|
+
end
|
80
80
|
|
81
81
|
def id_is(attribute)
|
82
|
-
|
82
|
+
(file, line) = caller.first.split(':')
|
83
|
+
|
84
|
+
class_eval(<<-EOS, file, line.to_i)
|
83
85
|
def #{attribute}=(value)
|
84
86
|
@#{attribute} = value.to_i
|
85
87
|
end
|
@@ -90,7 +92,7 @@ module Facebooker
|
|
90
92
|
EOS
|
91
93
|
end
|
92
94
|
end
|
93
|
-
|
95
|
+
|
94
96
|
##
|
95
97
|
# Centralized, error-checked place for a model to get the session to which it is bound.
|
96
98
|
# Any Facebook API queries require a Session instance.
|
@@ -113,7 +115,7 @@ module Facebooker
|
|
113
115
|
end
|
114
116
|
|
115
117
|
def populated?
|
116
|
-
|
118
|
+
@populated
|
117
119
|
end
|
118
120
|
|
119
121
|
##
|
@@ -21,8 +21,8 @@ module Facebooker
|
|
21
21
|
end
|
22
22
|
|
23
23
|
include Model
|
24
|
-
attr_accessor :
|
24
|
+
attr_accessor :pic, :pic_small, :pic_big, :name, :creator, :update_time, :description, :tagline, :venue, :host, :event_type, :nid, :location, :end_time, :start_time, :event_subtype
|
25
25
|
|
26
26
|
id_is :eid
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|
@@ -8,10 +8,10 @@ module Facebooker
|
|
8
8
|
attr_accessor :position, :gid, :uid
|
9
9
|
end
|
10
10
|
include Model
|
11
|
-
attr_accessor :pic, :pic_small, :pic_big, :name, :creator, :recent_news, :
|
12
|
-
|
11
|
+
attr_accessor :pic, :pic_small, :pic_big, :name, :creator, :recent_news, :update_time, :group_subtype, :group_type, :website, :office, :description, :venue, :nid
|
12
|
+
|
13
13
|
id_is :gid
|
14
|
-
|
14
|
+
|
15
15
|
##
|
16
16
|
# Get the full list of members as populated User objects. First time fetches group members via Facebook API call.
|
17
17
|
# Subsequent calls return cached values.
|
@@ -33,4 +33,4 @@ module Facebooker
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
-
end
|
36
|
+
end
|
@@ -5,7 +5,7 @@ module Facebooker
|
|
5
5
|
class Genre
|
6
6
|
include Model
|
7
7
|
FIELDS = [ :dance, :party, :relax, :talk, :think, :workout, :sing, :intimate, :raunchy, :headphones ]
|
8
|
-
attr_accessor
|
8
|
+
attr_accessor(*FIELDS)
|
9
9
|
|
10
10
|
def initialize(*args)
|
11
11
|
super
|
@@ -18,7 +18,8 @@ module Facebooker
|
|
18
18
|
end
|
19
19
|
|
20
20
|
include Model
|
21
|
-
attr_accessor :page_id, :name, :pic_small, :pic_big, :pic_square, :pic_large, :type, :type, :website, :location, :hours, :band_members, :bio, :hometown, :
|
21
|
+
attr_accessor :page_id, :name, :pic_small, :pic_big, :pic_square, :pic_large, :type, :type, :website, :location, :hours, :band_members, :bio, :hometown, :record_label, :influences, :has_added_app, :founded, :company_overview, :mission, :products, :release_date, :starring, :written_by, :directed_by, :produced_by, :studio, :awards, :plot_outline, :network, :season, :schedule
|
22
|
+
attr_reader :genre
|
22
23
|
|
23
24
|
def genre=(value)
|
24
25
|
@genre = value.kind_of?(Hash) ? Genre.from_hash(value) : value
|
@@ -2,11 +2,11 @@ require 'facebooker/model'
|
|
2
2
|
module Facebooker
|
3
3
|
class Photo
|
4
4
|
include Model
|
5
|
-
attr_accessor :
|
5
|
+
attr_accessor :aid, :owner, :title,
|
6
6
|
:link, :caption, :created,
|
7
7
|
:src, :src_big, :src_small,
|
8
8
|
:story_fbid
|
9
9
|
|
10
10
|
id_is :pid
|
11
11
|
end
|
12
|
-
end
|
12
|
+
end
|
@@ -10,22 +10,30 @@ module Facebooker
|
|
10
10
|
include Model
|
11
11
|
attr_accessor :message, :time, :status_id
|
12
12
|
end
|
13
|
-
FIELDS = [:
|
13
|
+
FIELDS = [:political, :pic_small, :name, :quotes, :is_app_user, :tv, :profile_update_time, :meeting_sex, :hs_info, :timezone, :relationship_status, :hometown_location, :about_me, :wall_count, :significant_other_id, :pic_big, :music, :work_history, :sex, :religion, :notes_count, :activities, :pic_square, :movies, :has_added_app, :education_history, :birthday, :first_name, :meeting_for, :last_name, :interests, :current_location, :pic, :books, :affiliations, :locale, :profile_url, :proxied_email, :email_hashes, :allowed_restrictions, :pic_with_logo, :pic_big_with_logo, :pic_small_with_logo, :pic_square_with_logo]
|
14
14
|
STANDARD_FIELDS = [:uid, :first_name, :last_name, :name, :timezone, :birthday, :sex, :affiliations, :locale, :profile_url, :pic_square]
|
15
|
-
populating_attr_accessor
|
15
|
+
populating_attr_accessor(*FIELDS)
|
16
16
|
attr_reader :affiliations
|
17
17
|
populating_hash_settable_accessor :current_location, Location
|
18
18
|
populating_hash_settable_accessor :hometown_location, Location
|
19
19
|
populating_hash_settable_accessor :hs_info, EducationInfo::HighschoolInfo
|
20
|
-
populating_hash_settable_accessor :status, Status
|
21
20
|
populating_hash_settable_list_accessor :affiliations, Affiliation
|
22
21
|
populating_hash_settable_list_accessor :education_history, EducationInfo
|
23
22
|
populating_hash_settable_list_accessor :work_history, WorkInfo
|
24
|
-
|
23
|
+
|
24
|
+
populating_attr_reader :status
|
25
|
+
|
25
26
|
# Can pass in these two forms:
|
26
27
|
# id, session, (optional) attribute_hash
|
27
28
|
# attribute_hash
|
28
29
|
def initialize(*args)
|
30
|
+
@friends = nil
|
31
|
+
@current_location = nil
|
32
|
+
@pic = nil
|
33
|
+
@hometown_location = nil
|
34
|
+
@populated = false
|
35
|
+
@session = nil
|
36
|
+
@id = nil
|
29
37
|
if (args.first.kind_of?(String) || args.first.kind_of?(Integer)) && args.size==1
|
30
38
|
self.uid = args.shift
|
31
39
|
@session = Session.current
|
@@ -35,7 +43,7 @@ module Facebooker
|
|
35
43
|
end
|
36
44
|
if args.last.kind_of?(Hash)
|
37
45
|
populate_from_hash!(args.pop)
|
38
|
-
end
|
46
|
+
end
|
39
47
|
end
|
40
48
|
|
41
49
|
id_is :uid
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module Facebooker
|
2
2
|
class WorkInfo
|
3
3
|
include Model
|
4
|
-
attr_accessor :end_date, :start_date, :company_name, :description, :position
|
4
|
+
attr_accessor :end_date, :start_date, :company_name, :description, :position
|
5
|
+
attr_reader :location
|
5
6
|
def location=(location)
|
6
7
|
@location = location.kind_of?(Hash) ? Location.from_hash(location) : location
|
7
8
|
end
|
8
9
|
end
|
9
|
-
end
|
10
|
+
end
|