mmangino-facebooker 1.0.26 → 1.0.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -80,7 +80,7 @@ module Facebooker
80
80
 
81
81
  def fb_user_action(action, user_message = "", prompt = "", callback = nil)
82
82
  update_page do |page|
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
+ page.call "FB.Connect.showFeedDialog",action.template_id,action.data,action.target_ids,action.body_general,nil,page.literal("FB.RequireConnect.promptConnect"),callback,prompt,user_message
84
84
  end
85
85
  end
86
86
 
@@ -283,14 +283,23 @@ module Facebooker
283
283
  # Render an <fb:profile-pic> for the specified user.
284
284
  #
285
285
  # You can optionally specify the size using the :size=> option.
286
- #
287
286
  # Valid sizes are :thumb, :small, :normal and :square
287
+ #
288
+ # You can optionally specify whether or not to include the facebook icon
289
+ # overlay using the :facebook_logo => true option. Default is false.
290
+ #
288
291
  def fb_profile_pic(user, options={})
289
292
  options = options.dup
290
293
  validate_fb_profile_pic_size(options)
294
+ options.transform_keys!(FB_PROFILE_PIC_OPTION_KEYS_TO_TRANSFORM)
295
+ options.assert_valid_keys(FB_PROFILE_PIC_VALID_OPTION_KEYS)
291
296
  options.merge!(:uid => cast_to_facebook_id(user))
292
297
  content_tag("fb:profile-pic", nil,stringify_vals(options))
293
298
  end
299
+
300
+ FB_PROFILE_PIC_OPTION_KEYS_TO_TRANSFORM = {:facebook_logo => 'facebook-logo'}
301
+ FB_PROFILE_PIC_VALID_OPTION_KEYS = [:size, :linked, 'facebook-logo']
302
+
294
303
 
295
304
  # Render an fb:photo tag.
296
305
  # photo is either a Facebooker::Photo or an id of a Facebook photo or an object that responds to photo_id.
@@ -229,8 +229,7 @@ module Facebooker
229
229
  @target_ids = val.is_a?(Array) ? val.join(",") : val
230
230
  end
231
231
  def data_hash
232
- default_data = story_size.nil? ? {} : {:story_size=>story_size}
233
- default_data.merge(data||{})
232
+ data||{}
234
233
  end
235
234
  end
236
235
 
@@ -378,7 +377,7 @@ module Facebooker
378
377
  when Ref
379
378
  Facebooker::Session.create.server_cache.set_ref_handle(_body.handle,_body.fbml)
380
379
  when UserAction
381
- @from.session.publish_user_action(_body.template_id,_body.data_hash,_body.target_ids,_body.body_general)
380
+ @from.session.publish_user_action(_body.template_id,_body.data_hash,_body.target_ids,_body.body_general,_body.story_size)
382
381
  else
383
382
  raise UnspecifiedBodyType.new("You must specify a valid send_as")
384
383
  end
@@ -371,10 +371,11 @@ module Facebooker
371
371
  # publish a previously rendered template bundle
372
372
  # see http://wiki.developers.facebook.com/index.php/Feed.publishUserAction
373
373
  #
374
- def publish_user_action(bundle_id,data={},target_ids=nil,body_general=nil)
374
+ def publish_user_action(bundle_id,data={},target_ids=nil,body_general=nil,story_size=nil)
375
375
  parameters={:template_bundle_id=>bundle_id,:template_data=>data.to_json}
376
376
  parameters[:target_ids] = target_ids unless target_ids.blank?
377
377
  parameters[:body_general] = body_general unless body_general.blank?
378
+ parameters[:story_size] = story_size unless story_size.nil?
378
379
  post("facebook.feed.publishUserAction", parameters)
379
380
  end
380
381
 
@@ -2,7 +2,7 @@ module Facebooker #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 26
5
+ TINY = 27
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -356,7 +356,7 @@ class Facebooker::Rails::Publisher::PublisherTest < Test::Unit::TestCase
356
356
  @from_user = Facebooker::User.new
357
357
  @session = Facebooker::Session.new("","")
358
358
  @from_user.stubs(:session).returns(@session)
359
- @session.expects(:publish_user_action).with(20309041537,{:friend=>"Mike"},nil,nil)
359
+ @session.expects(:publish_user_action).with(20309041537,{:friend=>"Mike"},nil,nil,nil)
360
360
 
361
361
  Facebooker::Rails::Publisher::FacebookTemplate.expects(:bundle_id_for_class_and_method).
362
362
  with(TestPublisher, 'user_action').
@@ -371,7 +371,7 @@ class Facebooker::Rails::Publisher::PublisherTest < Test::Unit::TestCase
371
371
  @from_user = Facebooker::User.new
372
372
  @session = Facebooker::Session.new("","")
373
373
  @from_user.stubs(:session).returns(@session)
374
- @session.expects(:publish_user_action).with(20309041537,{:friend=>"Mike", :story_size=>2},nil,nil)
374
+ @session.expects(:publish_user_action).with(20309041537,{:friend=>"Mike"},nil,nil,2)
375
375
 
376
376
  Facebooker::Rails::Publisher::FacebookTemplate.expects(:bundle_id_for_class_and_method).
377
377
  with(TestPublisher, 'user_action_with_story_size').
@@ -384,7 +384,7 @@ class Facebooker::Rails::Publisher::PublisherTest < Test::Unit::TestCase
384
384
  @from_user = Facebooker::User.new
385
385
  @session = Facebooker::Session.new("","")
386
386
  @from_user.stubs(:session).returns(@session)
387
- @session.expects(:publish_user_action).with(20309041537,{},nil,nil)
387
+ @session.expects(:publish_user_action).with(20309041537,{},nil,nil,nil)
388
388
 
389
389
  Facebooker::Rails::Publisher::FacebookTemplate.stubs(:bundle_id_for_class_and_method).returns(20309041537)
390
390
  TestPublisher.deliver_user_action_no_data(@from_user)
@@ -970,6 +970,10 @@ class RailsHelperTest < Test::Unit::TestCase
970
970
  def test_fb_logout_link
971
971
  assert_equal @h.fb_logout_link("Logout","My URL"),"<a href=\"#\" onclick=\"FB.Connect.logoutAndRedirect(&quot;My URL&quot;);; return false;\">Logout</a>"
972
972
  end
973
+ def test_fb_user_action
974
+ action = Facebooker::Rails::Publisher::UserAction.new
975
+ assert_equal @h.fb_user_action(action,"message","prompt"),"FB.Connect.showFeedDialog(null, null, null, null, null, FB.RequireConnect.promptConnect, null, \"prompt\", \"message\");"
976
+ end
973
977
 
974
978
 
975
979
  def test_fb_connect_javascript_tag
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.26
4
+ version: 1.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Fowler
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2009-04-03 00:00:00 -07:00
16
+ date: 2009-04-07 00:00:00 -07:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency