mmangino-facebooker 1.0.21 → 1.0.22

Sign up to get free protection for your applications and to get access to all the features.
File without changes
File without changes
data/Manifest.txt CHANGED
@@ -1,11 +1,8 @@
1
- CHANGELOG.txt
2
- COPYING
3
- History.txt
4
- Manifest.txt
5
- README
6
- README.txt
1
+ COPYING.rdoc
2
+ History.rdoc
3
+ README.rdoc
7
4
  Rakefile
8
- TODO.txt
5
+ TODO.rdoc
9
6
  generators/publisher/publisher_generator.rb
10
7
  generators/facebook/facebook_generator.rb
11
8
  generators/facebook/templates/config/facebooker.yml
@@ -1,4 +1,4 @@
1
- = facebooker
1
+ = Facebooker
2
2
 
3
3
  * http://facebooker.rubyforge.org
4
4
 
@@ -30,7 +30,7 @@ None
30
30
 
31
31
  == INSTALL:
32
32
 
33
- * Non Rails
33
+ === Non Rails
34
34
 
35
35
  The best way is:
36
36
 
@@ -40,7 +40,7 @@ If, for some reason, you can't/won't use RubyGems, you can do:
40
40
 
41
41
  (sudo) ruby setup.rb
42
42
 
43
- * Rails
43
+ === Rails
44
44
 
45
45
  Facebooker can be installed as a Rails plugin by:
46
46
 
@@ -76,7 +76,13 @@ end
76
76
 
77
77
  (The MIT License)
78
78
 
79
- Copyright (c) 2008 FIX
79
+ Copyright (c) 2008-2009:
80
+
81
+ * Chad Fowler
82
+ * Patrick Ewing
83
+ * Mike Mangino
84
+ * Shane Vitarana
85
+ * Corey Innis
80
86
 
81
87
  Permission is hereby granted, free of charge, to any person obtaining
82
88
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -17,9 +17,9 @@ Hoe.new('facebooker', Facebooker::VERSION::STRING) do |p|
17
17
  p.author = ['Chad Fowler', 'Patrick Ewing', 'Mike Mangino', 'Shane Vitarana', 'Corey Innis']
18
18
  p.email = 'mmangino@elevatedrails.com'
19
19
  p.summary = 'Pure, idiomatic Ruby wrapper for the Facebook REST API.'
20
- p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
21
- p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
22
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
20
+ p.description = p.paragraphs_of('README.rdoc', 2..5).join("\n\n")
21
+ p.url = p.paragraphs_of('README.rdoc', 0).first.split(/\n/)[1..-1]
22
+ p.changes = p.paragraphs_of('History.rdoc', 0..1).join("\n\n")
23
23
  p.remote_rdoc_dir = '' # Release to root
24
24
  p.test_globs = 'test/**/*_test.rb'
25
25
  p.extra_deps << ['json', '>= 1.0.0']
File without changes
@@ -44,7 +44,7 @@ module Facebooker
44
44
  def self.log_info(message, dump, seconds = 0)
45
45
  return unless Facebooker.logger
46
46
  log_message = "#{message} (#{seconds}) #{dump}"
47
- Facebooker.logger.debug(log_message)
47
+ Facebooker.logger.info(log_message)
48
48
  end
49
49
 
50
50
  end
@@ -377,6 +377,28 @@ module Facebooker
377
377
  ret
378
378
  end
379
379
  end
380
+
381
+ # Get a count of unconnected friends
382
+ def getUnconnectedFriendsCount
383
+ session.post("facebook.connect.getUnconnectedFriendsCount")
384
+ end
385
+
386
+
387
+ # Unregister a bunch of users
388
+ def self.unregister(emails)
389
+ emails = emails.collect {|e| hash_email(e)}
390
+ Facebooker::Session.create.post("facebook.connect.unregisterUsers",:email_hashes=>emails.to_json) do |ret|
391
+ ret.each do |hash|
392
+ emails.delete(hash)
393
+ end
394
+ unless emails.empty?
395
+ e=Facebooker::Session::UserUnRegistrationFailed.new
396
+ e.failed_users = emails
397
+ raise e
398
+ end
399
+ ret
400
+ end
401
+ end
380
402
 
381
403
  def self.hash_email(email)
382
404
  email = email.downcase.strip
@@ -96,6 +96,18 @@ module Facebooker
96
96
  array_of_text_values(element("connect_registerUsers_response", data), "connect_registerUsers_response_elt")
97
97
  end
98
98
  end
99
+
100
+ class UnregisterUsers < Parser
101
+ def self.process(data)
102
+ array_of_text_values(element("connect_unregisterUsers_response", data), "connect_unregisterUsers_response_elt")
103
+ end
104
+ end
105
+
106
+ class GetUnconnectedFriendsCount < Parser
107
+ def self.process(data)
108
+ hash_or_value_for(element("connect_getUnconnectedFriendsCount_response",data)).to_i
109
+ end
110
+ end
99
111
 
100
112
  class GetSession < Parser#:nodoc:
101
113
  def self.process(data)
@@ -530,6 +542,8 @@ module Facebooker
530
542
  'facebook.auth.createToken' => CreateToken,
531
543
  'facebook.auth.getSession' => GetSession,
532
544
  'facebook.connect.registerUsers' => RegisterUsers,
545
+ 'facebook.connect.unregisterUsers' => UnregisterUsers,
546
+ 'facebook.connect.getUnconnectedFriendsCount' => GetUnconnectedFriendsCount,
533
547
  'facebook.users.getInfo' => UserInfo,
534
548
  'facebook.users.getStandardInfo' => UserStandardInfo,
535
549
  'facebook.users.setStatus' => SetStatus,
@@ -50,7 +50,7 @@ module ActionView
50
50
  module UrlHelper
51
51
  # Alters one and only one line of the Rails button_to. See below.
52
52
  def button_to_with_facebooker(name, options={}, html_options = {})
53
- if !request_comes_from_facebook?
53
+ if !respond_to?(:request_comes_from_facebook?) || !request_comes_from_facebook?
54
54
  button_to_without_facebooker(name,options,html_options)
55
55
  else
56
56
  html_options = html_options.stringify_keys
@@ -125,7 +125,7 @@ module ActionView
125
125
  # link_to("Facebooker", "http://rubyforge.org/projects/facebooker", :confirm=>{:title=>"the page says:, :content=>"Go to Facebooker?"})
126
126
  # link_to("Facebooker", "http://rubyforge.org/projects/facebooker", :confirm=>{:title=>"the page says:, :content=>"Go to Facebooker?", :color=>"pink"})
127
127
  def confirm_javascript_function_with_facebooker(confirm, fun = nil)
128
- if !request_comes_from_facebook?
128
+ if !respond_to?(:request_comes_from_facebook?) || !request_comes_from_facebook?
129
129
  confirm_javascript_function_without_facebooker(confirm)
130
130
  else
131
131
  if(confirm.is_a?(Hash))
@@ -157,7 +157,7 @@ module ActionView
157
157
  # Dynamically creates a form for link_to with method. Calls confirm_javascript_function if and
158
158
  # only if (confirm && method) for link_to
159
159
  def method_javascript_function_with_facebooker(method, url = '', href = nil, confirm = nil)
160
- if !request_comes_from_facebook?
160
+ if !respond_to?(:request_comes_from_facebook?) || !request_comes_from_facebook?
161
161
  method_javascript_function_without_facebooker(method,url,href)
162
162
  else
163
163
  action = (href && url.size > 0) ? "'#{url}'" : 'a.getHref()'
@@ -59,6 +59,7 @@ module Facebooker
59
59
 
60
60
  content_tag("fb:login-button",nil, options)
61
61
  end
62
+
62
63
  def fb_login_and_redirect(url)
63
64
  js = update_page do |page|
64
65
  page.redirect_to url
@@ -70,16 +71,16 @@ module Facebooker
70
71
  content_tag "fb:unconnected-friends-count",nil
71
72
  end
72
73
 
73
- def fb_logout_link(text,url)
74
+ def fb_logout_link(text,url,*args)
74
75
  js = update_page do |page|
75
76
  page.call "FB.Connect.logoutAndRedirect",url
76
77
  end
77
- link_to_function text, js
78
+ link_to_function text, js, *args
78
79
  end
79
80
 
80
- def fb_user_action(action)
81
+ def fb_user_action(action, user_message = "", prompt = "", callback = nil)
81
82
  update_page do |page|
82
- page.call "FB.Connect.showFeedDialog",action.template_id,action.data,action.target_ids,action.body_general,nil,"FB.RequireConnect.promptConnect"
83
+ page.call "FB.Connect.showFeedDialog",action.template_id,action.data,action.target_ids,action.body_general,nil,"FB.RequireConnect.promptConnect",callback,prompt,user_message
83
84
  end
84
85
  end
85
86
 
@@ -6,7 +6,15 @@ module Facebooker
6
6
  # other than the logged in user (if that's unallowed)
7
7
  class NonSessionUser < StandardError; end
8
8
  class Session
9
+
10
+ #
11
+ # Raised when a facebook session has expired. This
12
+ # happens when the timeout is reached, or when the
13
+ # user logs out of facebook
14
+ # can be handled with:
15
+ # rescue_from Facebooker::Session::SessionExpired, :with => :some_method_name
9
16
  class SessionExpired < StandardError; end
17
+
10
18
  class UnknownError < StandardError; end
11
19
  class ServiceUnavailable < StandardError; end
12
20
  class MaxRequestsDepleted < StandardError; end
@@ -48,6 +56,9 @@ module Facebooker
48
56
  class TooManyUnapprovedPhotosPending < StandardError; end
49
57
  class ExtendedPermissionRequired < StandardError; end
50
58
  class InvalidFriendList < StandardError; end
59
+ class UserUnRegistrationFailed < StandardError
60
+ attr_accessor :failed_users
61
+ end
51
62
  class UserRegistrationFailed < StandardError
52
63
  attr_accessor :failed_users
53
64
  end
@@ -2,7 +2,7 @@ module Facebooker #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 19
5
+ TINY = 22
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -19,7 +19,7 @@ class Facebooker::LoggingTest < Test::Unit::TestCase
19
19
  end
20
20
 
21
21
  def test_does_not_crash_outside_rails
22
- flexmock(Facebooker.logger, :logger).should_receive(:debug).once.with(String)
22
+ flexmock(Facebooker.logger, :logger).should_receive(:info).once.with(String)
23
23
  Facebooker::Logging.log_fb_api('sample.api.call',
24
24
  {'param1' => true, 'param2' => 'value2'})
25
25
  end
@@ -32,7 +32,7 @@ class Facebooker::LoggingTest < Test::Unit::TestCase
32
32
  end
33
33
 
34
34
  def test_plain_format
35
- flexmock(Facebooker.logger, :logger).should_receive(:debug).once.with(
35
+ flexmock(Facebooker.logger, :logger).should_receive(:info).once.with(
36
36
  'sample.api.call (0) param1 = true')
37
37
  Facebooker::Logging.log_fb_api('sample.api.call',
38
38
  {'param1' => true})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mmangino-facebooker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.21
4
+ version: 1.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Fowler
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2009-03-26 00:00:00 -07:00
15
+ date: 2009-03-30 00:00:00 -07:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -32,23 +32,20 @@ executables: []
32
32
  extensions: []
33
33
 
34
34
  extra_rdoc_files:
35
- - CHANGELOG.txt
36
- - History.txt
35
+ - History.rdoc
37
36
  - Manifest.txt
38
- - README.txt
39
- - TODO.txt
37
+ - README.rdoc
38
+ - TODO.rdoc
40
39
  - test/fixtures/multipart_post_body_with_only_parameters.txt
41
40
  - test/fixtures/multipart_post_body_with_single_file.txt
42
41
  - test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt
43
42
  files:
44
- - CHANGELOG.txt
45
- - COPYING
46
- - History.txt
47
- - Manifest.txt
48
- - README
49
- - README.txt
43
+ - CHANGELOG.rdoc
44
+ - COPYING.rdoc
45
+ - History.rdoc
46
+ - README.rdoc
50
47
  - Rakefile
51
- - TODO.txt
48
+ - TODO.rdoc
52
49
  - generators/publisher/publisher_generator.rb
53
50
  - generators/facebook/facebook_generator.rb
54
51
  - generators/facebook/templates/config/facebooker.yml
@@ -168,12 +165,13 @@ files:
168
165
  - test/rails_test_helper.rb
169
166
  - test/test_helper.rb
170
167
  - test/facebooker/mobile_test.rb
168
+ - Manifest.txt
171
169
  has_rdoc: true
172
170
  homepage:
173
171
  post_install_message:
174
172
  rdoc_options:
175
173
  - --main
176
- - README.txt
174
+ - README.rdoc
177
175
  require_paths:
178
176
  - lib
179
177
  required_ruby_version: !ruby/object:Gem::Requirement
data/CHANGELOG.txt DELETED
File without changes
data/README DELETED
@@ -1,46 +0,0 @@
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 {GitHub page}[http://github.com/mmangino/facebooker/tree/] 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
-