facebooker 1.0.56 → 1.0.58

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,6 +47,7 @@ lib/facebooker.rb
47
47
  lib/facebooker/adapters/adapter_base.rb
48
48
  lib/facebooker/adapters/bebo_adapter.rb
49
49
  lib/facebooker/adapters/facebook_adapter.rb
50
+ lib/facebooker/attachment.rb
50
51
  lib/facebooker/admin.rb
51
52
  lib/facebooker/application.rb
52
53
  lib/facebooker/batch_request.rb
@@ -108,6 +109,7 @@ lib/facebooker/service/net_http_service.rb
108
109
  lib/facebooker/service/typhoeus_service.rb
109
110
  lib/facebooker/service/typhoeus_multi_service.rb
110
111
  lib/facebooker/session.rb
112
+ lib/facebooker/stream_post.rb
111
113
  lib/facebooker/version.rb
112
114
  lib/net/http_multipart_post.rb
113
115
  lib/rack/facebook.rb
@@ -119,6 +121,7 @@ templates/layout.erb
119
121
  test/facebooker/adapters_test.rb
120
122
  test/facebooker/admin_test.rb
121
123
  test/facebooker/application_test.rb
124
+ test/facebooker/attachment_test.rb
122
125
  test/facebooker/batch_request_test.rb
123
126
  test/facebooker/data_test.rb
124
127
  test/facebooker/logging_test.rb
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{facebooker}
5
- s.version = "1.0.56"
5
+ s.version = "1.0.58"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Chad Fowler", "Patrick Ewing", "Mike Mangino", "Shane Vitarana", "Corey Innis", "Mike Mangino"]
9
- s.date = %q{2009-12-04}
9
+ s.date = %q{2009-12-11}
10
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
11
 
12
12
  * Idiomatic Ruby
@@ -15,14 +15,14 @@ Gem::Specification.new do |s|
15
15
  * Well tested}
16
16
  s.email = ["chad@chadfowlwer.com", "", "", "", "", "mmangino@elevatedrails.com"]
17
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_ssl.html", "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/application.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/family_relative_info.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/backwards_compatible_param_checks.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_request_fix_2-3.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/service/base_service.rb", "lib/facebooker/service/curl_service.rb", "lib/facebooker/service/net_http_service.rb", "lib/facebooker/service/typhoeus_service.rb", "lib/facebooker/service/typhoeus_multi_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/application_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/page_test.rb", "test/facebooker/models/photo_test.rb", "test/facebooker/models/user_test.rb", "test/facebooker/rails/publisher_test.rb", "test/facebooker/rails_integration_test.rb", "test/facebooker/rails/facebook_request_fix_2-3_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", "test/facebooker/rails/facebook_url_rewriting_test.rb", "test/facebooker/rails/integration_session_test.rb", "test/facebooker/service_test.rb"]
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_ssl.html", "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/attachment.rb", "lib/facebooker/admin.rb", "lib/facebooker/application.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/family_relative_info.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/backwards_compatible_param_checks.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_request_fix_2-3.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/service/base_service.rb", "lib/facebooker/service/curl_service.rb", "lib/facebooker/service/net_http_service.rb", "lib/facebooker/service/typhoeus_service.rb", "lib/facebooker/service/typhoeus_multi_service.rb", "lib/facebooker/session.rb", "lib/facebooker/stream_post.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/application_test.rb", "test/facebooker/attachment_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/page_test.rb", "test/facebooker/models/photo_test.rb", "test/facebooker/models/user_test.rb", "test/facebooker/rails/publisher_test.rb", "test/facebooker/rails_integration_test.rb", "test/facebooker/rails/facebook_request_fix_2-3_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", "test/facebooker/rails/facebook_url_rewriting_test.rb", "test/facebooker/rails/integration_session_test.rb", "test/facebooker/service_test.rb"]
19
19
  s.homepage = %q{http://facebooker.rubyforge.org}
20
20
  s.rdoc_options = ["--main", "README.rdoc"]
21
21
  s.require_paths = ["lib"]
22
22
  s.rubyforge_project = %q{facebooker}
23
23
  s.rubygems_version = %q{1.3.4}
24
24
  s.summary = %q{Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://wiki.developers.facebook.com/index.php/API]}
25
- s.test_files = ["test/facebooker/adapters_test.rb", "test/facebooker/admin_test.rb", "test/facebooker/application_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/page_test.rb", "test/facebooker/models/photo_test.rb", "test/facebooker/models/user_test.rb", "test/facebooker/rails/facebook_request_fix_2-3_test.rb", "test/facebooker/rails/facebook_url_rewriting_test.rb", "test/facebooker/rails/integration_session_test.rb", "test/facebooker/rails/publisher_test.rb", "test/facebooker/rails_integration_test.rb", "test/facebooker/server_cache_test.rb", "test/facebooker/service_test.rb", "test/facebooker/session_test.rb", "test/facebooker_test.rb", "test/net/http_multipart_post_test.rb", "test/rack/facebook_test.rb"]
25
+ s.test_files = ["test/facebooker/adapters_test.rb", "test/facebooker/admin_test.rb", "test/facebooker/application_test.rb", "test/facebooker/attachment_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/page_test.rb", "test/facebooker/models/photo_test.rb", "test/facebooker/models/user_test.rb", "test/facebooker/rails/facebook_request_fix_2-3_test.rb", "test/facebooker/rails/facebook_url_rewriting_test.rb", "test/facebooker/rails/integration_session_test.rb", "test/facebooker/rails/publisher_test.rb", "test/facebooker/rails_integration_test.rb", "test/facebooker/server_cache_test.rb", "test/facebooker/service_test.rb", "test/facebooker/session_test.rb", "test/facebooker_test.rb", "test/net/http_multipart_post_test.rb", "test/rack/facebook_test.rb"]
26
26
 
27
27
  if s.respond_to? :specification_version then
28
28
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -26,14 +26,14 @@ require 'digest/md5'
26
26
 
27
27
  module Facebooker
28
28
 
29
- @facebooker_configuration = {}
30
- @raw_facebooker_configuration = {}
31
- @current_adapter = nil
32
- @set_asset_host_to_callback_url = true
33
- @path_prefix = nil
34
- @use_curl = false
29
+ @facebooker_configuration = {}
30
+ @raw_facebooker_configuration = {}
31
+ @current_adapter = nil
32
+ @set_asset_host_to_callback_url = true
33
+ @path_prefix = nil
34
+ @use_curl = false
35
35
 
36
- class << self
36
+ class << self
37
37
 
38
38
  def load_configuration(facebooker_yaml_file)
39
39
  return false unless File.exist?(facebooker_yaml_file)
@@ -200,6 +200,7 @@ module Facebooker
200
200
  end
201
201
  end
202
202
 
203
+ require 'facebooker/attachment'
203
204
  require 'facebooker/batch_request'
204
205
  require 'facebooker/feed'
205
206
  require 'facebooker/logging'
@@ -227,6 +228,7 @@ require 'facebooker/admin'
227
228
  require 'facebooker/application'
228
229
  require 'facebooker/mobile'
229
230
  require 'facebooker/session'
231
+ require 'facebooker/stream_post'
230
232
  require 'facebooker/version'
231
233
  require 'facebooker/models/location'
232
234
  require 'facebooker/models/affiliation'
@@ -34,7 +34,7 @@ end
34
34
 
35
35
  # Things that don't actually work as expected in BEBO
36
36
  module Facebooker
37
- class User
37
+ class User
38
38
  def set_profile_fbml_with_bebo_adapter(profile_fbml, mobile_fbml, profile_action_fbml, profile_main = nil)
39
39
  if(Facebooker.is_for?(:bebo))
40
40
  self.session.post('facebook.profile.setFBML', :uid => @id, :markup => profile_fbml)
@@ -61,14 +61,14 @@ module Facebooker
61
61
  end
62
62
 
63
63
 
64
- class PublishTemplatizedAction < Parser#:nodoc:
64
+ class PublishTemplatizedAction < Parser#:nodoc:
65
65
  class <<self
66
- def process_with_bebo_adapter(data)
67
- if(Facebooker.is_for?(:bebo))
68
- element('feed_publishTemplatizedAction_response', data).content
69
- else
70
- process_without_bebo_adapter(data)
71
- end
66
+ def process_with_bebo_adapter(data)
67
+ if(Facebooker.is_for?(:bebo))
68
+ element('feed_publishTemplatizedAction_response', data).content
69
+ else
70
+ process_without_bebo_adapter(data)
71
+ end
72
72
  end
73
73
  alias_method :process_without_bebo_adapter, :process
74
74
  alias_method :process, :process_with_bebo_adapter
@@ -0,0 +1,51 @@
1
+ class Facebooker::Attachment
2
+
3
+ def initialize
4
+ @storage = {}
5
+ end
6
+
7
+ def self.hash_populating_accessor(*names)
8
+ names.each do |name|
9
+ define_method(name) do
10
+ @storage[name]
11
+ end
12
+ define_method("#{name}=") do |val|
13
+ @storage[name]=val
14
+ end
15
+ end
16
+ end
17
+
18
+ hash_populating_accessor :name,:href, :comments_xid, :description, :caption
19
+
20
+ def add_media(hash)
21
+ @storage[:media]||=[]
22
+ @storage[:media] << hash
23
+ end
24
+
25
+ def add_image(source,href)
26
+ add_media({:type=>"image",:src=>source,:href=>href})
27
+ end
28
+
29
+ def add_mp3(source,title=nil,artist=nil,album=nil)
30
+ params = {:src=>source,:type=>"mp3"}
31
+ params[:title] = title unless title.nil?
32
+ params[:artist] = artist unless artist.nil?
33
+ params[:album] = album unless album.nil?
34
+ add_media(params)
35
+ end
36
+
37
+ def add_flash(swfsource, imgsource, width=nil, height=nil, expanded_width=nil, expanded_height=nil)
38
+ params={:type=>"flash",:swfsrc=>swfsource,:imgsrc=>imgsource}
39
+ params[:width] = width unless width.nil?
40
+ params[:height] = height unless height.nil?
41
+ params[:expanded_width] = expanded_width unless expanded_width.nil?
42
+ params[:expanded_height] = expanded_height unless expanded_height.nil?
43
+ add_media(params)
44
+ end
45
+
46
+ def to_hash
47
+ @storage
48
+ end
49
+
50
+
51
+ end
@@ -26,7 +26,7 @@ module Facebooker
26
26
  end
27
27
 
28
28
  include Model
29
- attr_accessor :page_id, :name, :pic_small, :pic_big, :pic_square, :pic_large, :page_url, :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
29
+ attr_accessor :page_id,:name,:pic_small,:pic_big,:pic_square,:pic,:pic_large,:type,:website,:has_added_app,:founded,:company_overview,:mission,:products,:location,:parking,:public_transit,:hours,:attire,:payment_options,:culinary_team,:general_manager,:price_range,:restaurant_services,:restaurant_specialties,:release_date,:genre,:starring,:screenplay_by,:directed_by,:produced_by,:studio,:awards,:plot_outline,:network,:season,:schedule,:written_by,:band_members,:hometown,:current_location,:record_label,:booking_agent,:artists_we_like,:influences,:band_interests,:bio,:affiliation,:birthday,:personal_info,:personal_interests,:members,:built,:features,:mpg,:general_info,:fan_count
30
30
  attr_reader :genre
31
31
 
32
32
  def genre=(value)
@@ -152,8 +152,8 @@ module Facebooker
152
152
  :target_id => target.id,
153
153
  :message => options[:message]}
154
154
 
155
- if(attachment = options[:attachment] && Facebooker.json_encode(options[:attachment]))
156
- opts[:attachment] = attachment
155
+ if a = options[:attachment]
156
+ opts[:attachment] = convert_attachment_to_json(a)
157
157
  end
158
158
  if (links = options[:action_links] && Facebooker.json_encode(options[:action_links]))
159
159
  opts[:action_links] = links
@@ -166,6 +166,11 @@ module Facebooker
166
166
  end
167
167
  opts
168
168
  end
169
+
170
+ def convert_attachment_to_json(attachment)
171
+ a = attachment.respond_to?(:to_hash) ? attachment.to_hash : attachment
172
+ Facebooker.json_encode(a)
173
+ end
169
174
 
170
175
  ###
171
176
  # Publish a comment on a post
@@ -473,10 +473,10 @@ module Facebooker
473
473
  end
474
474
 
475
475
  class EventsRsvp < Parser#:nodoc:
476
- def self.process(data)
476
+ def self.process(data)
477
477
  element('events_rsvp_response', data).content.strip
478
- end
479
- end
478
+ end
479
+ end
480
480
 
481
481
  class EventsCreate < Parser#:nodoc:
482
482
  def self.process(data)
@@ -132,14 +132,17 @@ module Facebooker
132
132
  def secure_with_cookies!
133
133
  parsed = {}
134
134
 
135
- fb_cookie_names.each { |key| parsed[key[fb_cookie_prefix.size,key.size]] = cookies[key] }
136
-
135
+ # josephsofaer finds the cookies[key] returns an array,
136
+ # it doesn't happen for me (mmangino)
137
+ # so force it to array and take the first value
138
+ fb_cookie_names.each { |key| parsed[key[fb_cookie_prefix.size,key.size]] = Array(cookies[key]).first }
139
+
137
140
  #returning gracefully if the cookies aren't set or have expired
138
141
  return unless parsed['session_key'] && parsed['user'] && parsed['expires'] && parsed['ss']
139
- return unless Time.at(parsed['expires'].to_s.to_f) > Time.now || (parsed['expires'] == "0")
142
+ return unless (Time.at(parsed['expires'].to_s.to_f) > Time.now) || (parsed['expires'] == "0")
140
143
  #if we have the unexpired cookies, we'll throw an exception if the sig doesn't verify
141
- verify_signature(parsed,cookies[Facebooker.api_key])
142
-
144
+ verify_signature(parsed,cookies[Facebooker.api_key],true)
145
+
143
146
  @facebook_session = new_facebook_session
144
147
  @facebook_session.secure_with!(parsed['session_key'],parsed['user'],parsed['expires'],parsed['ss'])
145
148
  @facebook_session
@@ -223,9 +226,9 @@ module Facebooker
223
226
  48.hours.ago
224
227
  end
225
228
 
226
- def verify_signature(facebook_sig_params,expected_signature)
229
+ def verify_signature(facebook_sig_params,expected_signature,force=false)
227
230
  # Don't verify the signature if rack has already done so.
228
- unless ::Rails.version >= "2.3" and ActionController::Dispatcher.middleware.include? Rack::Facebook
231
+ unless ::Rails.version >= "2.3" and ActionController::Dispatcher.middleware.include? Rack::Facebook and !force
229
232
  raw_string = facebook_sig_params.map{ |*args| args.join('=') }.sort.join
230
233
  actual_sig = Digest::MD5.hexdigest([raw_string, Facebooker::Session.secret_key].join)
231
234
  raise Facebooker::Session::IncorrectSignature if actual_sig != expected_signature
@@ -11,7 +11,7 @@ module Facebooker
11
11
  define_method name do |field,*args|
12
12
  options = args[offset] || {}
13
13
  build_shell(field,options.with_indifferent_access) do
14
- super
14
+ super(field,*args)
15
15
  end
16
16
  end
17
17
  end
@@ -12,16 +12,20 @@ module Facebooker
12
12
 
13
13
  include Facebooker::Rails::Helpers::FbConnect
14
14
 
15
+ def versioned_concat(string,binding)
16
+ if ignore_binding?
17
+ concat(string)
18
+ else
19
+ concat(string,binding)
20
+ end
21
+ end
22
+
15
23
  # Create an fb:dialog
16
24
  # id must be a unique name e.g. "my_dialog"
17
25
  # cancel_button is true or false
18
26
  def fb_dialog( id, cancel_button, &block )
19
27
  content = capture(&block)
20
- if ignore_binding?
21
- concat( content_tag("fb:dialog", content, {:id => id, :cancel_button => cancel_button}) )
22
- else
23
- concat( content_tag("fb:dialog", content, {:id => id, :cancel_button => cancel_button}), block.binding )
24
- end
28
+ versioned_concat( content_tag("fb:dialog", content, {:id => id, :cancel_button => cancel_button}), block.binding )
25
29
  end
26
30
 
27
31
  def fbjs_library
@@ -43,11 +47,7 @@ module Facebooker
43
47
 
44
48
  def fb_dialog_content( &block )
45
49
  content = capture(&block)
46
- if ignore_binding?
47
- concat( content_tag("fb:dialog-content", content) )
48
- else
49
- concat( content_tag("fb:dialog-content", content), block.binding )
50
- end
50
+ versioned_concat( content_tag("fb:dialog-content", content), block.binding )
51
51
  end
52
52
 
53
53
  def fb_dialog_button( type, value, options={} )
@@ -83,14 +83,9 @@ module Facebooker
83
83
  def fb_request_form(type,message_param,url,options={},&block)
84
84
  content = capture(&block)
85
85
  message = @template.instance_variable_get("@content_for_#{message_param}")
86
- if ignore_binding?
87
- concat(content_tag("fb:request-form", content + token_tag,
88
- {:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>message}.merge(options)))
89
- else
90
- concat(content_tag("fb:request-form", content + token_tag,
91
- {:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>message}.merge(options)),
92
- block.binding)
93
- end
86
+ versioned_concat(content_tag("fb:request-form", content + token_tag,
87
+ {:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>message}.merge(options)),
88
+ block.binding)
94
89
  end
95
90
 
96
91
  # Create a submit button for an <fb:request-form>
@@ -121,18 +116,11 @@ module Facebooker
121
116
  # <% end %>
122
117
  def fb_multi_friend_request(type,friend_selector_message,url,&block)
123
118
  content = capture(&block)
124
- if ignore_binding?
125
- concat(content_tag("fb:request-form",
126
- fb_multi_friend_selector(friend_selector_message) + token_tag,
127
- {:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>content}
128
- ))
129
- else
130
- concat(content_tag("fb:request-form",
131
- fb_multi_friend_selector(friend_selector_message) + token_tag,
132
- {:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>content}
133
- ),
134
- block.binding)
135
- end
119
+ versioned_concat(content_tag("fb:request-form",
120
+ fb_multi_friend_selector(friend_selector_message) + token_tag,
121
+ {:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>content}
122
+ ),
123
+ block.binding)
136
124
  end
137
125
 
138
126
  # Render an <fb:friend-selector> element
@@ -222,19 +210,11 @@ module Facebooker
222
210
  width=options.delete(:labelwidth)
223
211
  editor_options[:labelwidth]=width unless width.blank?
224
212
 
225
- if ignore_binding?
226
- concat(tag("fb:editor",editor_options,true))
227
- concat(tag(:input,{:type=>"hidden",:name=>:_method, :value=>method},false)) unless method.blank?
228
- concat(token_tag)
229
- fields_for( object_name,*(args << options), &proc)
230
- concat("</fb:editor>")
231
- else
232
- concat(tag("fb:editor",editor_options,true) , proc.binding)
233
- concat(tag(:input,{:type=>"hidden",:name=>:_method, :value=>method},false), proc.binding) unless method.blank?
234
- concat(token_tag, proc.binding)
235
- fields_for( object_name,*(args << options), &proc)
236
- concat("</fb:editor>",proc.binding)
237
- end
213
+ versioned_concat(tag("fb:editor",editor_options,true) , proc.binding)
214
+ versioned_concat(tag(:input,{:type=>"hidden",:name=>:_method, :value=>method},false), proc.binding) unless method.blank?
215
+ versioned_concat(token_tag, proc.binding)
216
+ fields_for( object_name,*(args << options), &proc)
217
+ versioned_concat("</fb:editor>",proc.binding)
238
218
  end
239
219
 
240
220
  # Render an fb:application-name tag
@@ -365,11 +345,7 @@ module Facebooker
365
345
  # <% end %>
366
346
  def fb_tabs(&block)
367
347
  content = capture(&block)
368
- if ignore_binding?
369
- concat(content_tag("fb:tabs", content))
370
- else
371
- concat(content_tag("fb:tabs", content), block.binding)
372
- end
348
+ versioned_concat(content_tag("fb:tabs", content), block.binding)
373
349
  end
374
350
 
375
351
  # Render an fb:tab_item tag.
@@ -412,11 +388,7 @@ module Facebooker
412
388
  # <% end %>
413
389
  def fb_wall(&proc)
414
390
  content = capture(&proc)
415
- if ignore_binding?
416
- concat(content_tag("fb:wall",content,{}))
417
- else
418
- concat(content_tag("fb:wall",content,{}),proc.binding)
419
- end
391
+ versioned_concat(content_tag("fb:wall",content,{}),proc.binding)
420
392
  end
421
393
 
422
394
  # Render an <fb:wallpost> tag
@@ -476,11 +448,7 @@ module Facebooker
476
448
  def fb_dashboard(&proc)
477
449
  if block_given?
478
450
  content = capture(&proc)
479
- if ignore_binding?
480
- concat(content_tag("fb:dashboard",content,{}))
481
- else
482
- concat(content_tag("fb:dashboard",content,{}),proc.binding)
483
- end
451
+ versioned_concat(content_tag("fb:dashboard",content,{}),proc.binding)
484
452
  else
485
453
  content_tag("fb:dashboard",content,{})
486
454
  end
@@ -489,21 +457,13 @@ module Facebooker
489
457
  # Content for the wide profile box goes in this tag
490
458
  def fb_wide(&proc)
491
459
  content = capture(&proc)
492
- if ignore_binding?
493
- concat(content_tag("fb:wide", content, {}))
494
- else
495
- concat(content_tag("fb:wide", content, {}), proc.binding)
496
- end
460
+ versioned_concat(content_tag("fb:wide", content, {}), proc.binding)
497
461
  end
498
462
 
499
463
  # Content for the narrow profile box goes in this tag
500
464
  def fb_narrow(&proc)
501
465
  content = capture(&proc)
502
- if ignore_binding?
503
- concat(content_tag("fb:narrow", content, {}))
504
- else
505
- concat(content_tag("fb:narrow", content, {}), proc.binding)
506
- end
466
+ versioned_concat(content_tag("fb:narrow", content, {}), proc.binding)
507
467
  end
508
468
 
509
469
  # Renders an action using the <fb:action> tag
@@ -563,11 +523,7 @@ module Facebooker
563
523
  content = capture(&proc)
564
524
  options = options.dup
565
525
  options.merge!(:uid=>cast_to_facebook_id(user)) if user
566
- if ignore_binding?
567
- concat(content_tag("fb:if-is-app-user",content,stringify_vals(options)))
568
- else
569
- concat(content_tag("fb:if-is-app-user",content,stringify_vals(options)),proc.binding)
570
- end
526
+ versioned_concat(content_tag("fb:if-is-app-user",content,stringify_vals(options)),proc.binding)
571
527
  end
572
528
 
573
529
  # Render if-user-has-added-app tag
@@ -583,11 +539,7 @@ module Facebooker
583
539
  def fb_if_user_has_added_app(user,options={},&proc)
584
540
  content = capture(&proc)
585
541
  options = options.dup
586
- if ignore_binding?
587
- concat(content_tag("fb:if-user-has-added-app", content, stringify_vals(options.merge(:uid=>cast_to_facebook_id(user)))))
588
- else
589
- concat(content_tag("fb:if-user-has-added-app", content, stringify_vals(options.merge(:uid=>cast_to_facebook_id(user)))),proc.binding)
590
- end
542
+ versioned_concat(content_tag("fb:if-user-has-added-app", content, stringify_vals(options.merge(:uid=>cast_to_facebook_id(user)))),proc.binding)
591
543
  end
592
544
 
593
545
  # Render fb:if-is-user tag
@@ -605,22 +557,14 @@ module Facebooker
605
557
  content = capture(&proc)
606
558
  user = [user] unless user.is_a? Array
607
559
  user_list=user.map{|u| cast_to_facebook_id(u)}.join(",")
608
- if ignore_binding?
609
- concat(content_tag("fb:if-is-user",content,{:uid=>user_list}))
610
- else
611
- concat(content_tag("fb:if-is-user",content,{:uid=>user_list}),proc.binding)
612
- end
560
+ versioned_concat(content_tag("fb:if-is-user",content,{:uid=>user_list}),proc.binding)
613
561
  end
614
562
 
615
563
  # Render fb:else tag
616
564
  # Must be used within if block such as fb_if_is_user or fb_if_is_app_user . See example in fb_if_is_app_user
617
565
  def fb_else(&proc)
618
566
  content = capture(&proc)
619
- if ignore_binding?
620
- concat(content_tag("fb:else",content))
621
- else
622
- concat(content_tag("fb:else",content),proc.binding)
623
- end
567
+ versioned_concat(content_tag("fb:else",content),proc.binding)
624
568
  end
625
569
 
626
570
  #
@@ -725,12 +669,12 @@ module Facebooker
725
669
  # Meant to be used for a Facebook Connect site or an iframe application
726
670
  def fb_serverfbml(options={},&proc)
727
671
  inner = capture(&proc)
728
- concat(content_tag("fb:serverfbml",inner,options),&proc.binding)
672
+ versioned_concat(content_tag("fb:serverfbml",inner,options), proc.binding)
729
673
  end
730
674
 
731
675
  def fb_container(options={},&proc)
732
676
  inner = capture(&proc)
733
- concat(content_tag("fb:container",inner,options),&proc.binding)
677
+ versioned_concat(content_tag("fb:container",inner,options), proc.binding)
734
678
  end
735
679
 
736
680
  # Renders an fb:time element
@@ -59,7 +59,7 @@ module Facebooker
59
59
  :block_is_within_action_view? : :block_called_from_erb?
60
60
 
61
61
  if block_given? && send(block_tester, proc)
62
- concat(javascript_tag(init_string))
62
+ versioned_concat(javascript_tag(init_string),proc.binding)
63
63
  else
64
64
  javascript_tag init_string
65
65
  end
@@ -122,6 +122,21 @@ module Facebooker
122
122
  page.call("FB.Connect.showFeedDialog",action.template_id,action.data,action.target_ids,action.body_general,nil,page.literal("FB.RequireConnect.promptConnect"),page.literal(defaulted_callback),prompt,user_message.nil? ? nil : {:value=>user_message})
123
123
  end
124
124
  end
125
+
126
+ def fb_connect_stream_publish(stream_post,user_message_prompt=nil,callback=nil,auto_publish=false,actor=nil)
127
+ defaulted_callback = callback || "null"
128
+ update_page do |page|
129
+ page.call("FB.Connect.streamPublish",
130
+ stream_post.user_message,
131
+ stream_post.attachment.to_hash,
132
+ stream_post.action_links,
133
+ Facebooker::User.cast_to_facebook_id(stream_post.target),
134
+ user_message_prompt,
135
+ page.literal(defaulted_callback),
136
+ auto_publish,
137
+ Facebooker::User.cast_to_facebook_id(actor))
138
+ end
139
+ end
125
140
 
126
141
  end
127
142
  end
@@ -306,7 +306,7 @@ module Facebooker
306
306
  when :user_action
307
307
  UserAction.new
308
308
  when :publish_stream
309
- PublishStream.new
309
+ StreamPost.new
310
310
  else
311
311
  raise UnknownBodyType.new("Unknown type to publish")
312
312
  end
@@ -331,6 +331,9 @@ module Facebooker
331
331
  end
332
332
 
333
333
  def action_links(*links)
334
+ if self._body and self._body.respond_to?(:action_links)
335
+ self._body.send(:action_links,*links)
336
+ end
334
337
  if links.blank?
335
338
  @action_links
336
339
  else
@@ -418,7 +421,7 @@ module Facebooker
418
421
  Facebooker::Session.create.server_cache.set_ref_handle(_body.handle,_body.fbml)
419
422
  when UserAction
420
423
  @from.session.publish_user_action(_body.template_id,_body.data_hash,_body.target_ids,_body.body_general,_body.story_size)
421
- when PublishStream
424
+ when Facebooker::StreamPost
422
425
  @from.publish_to(_body.target, {:attachment => _body.attachment, :action_links => @action_links, :message => _body.message })
423
426
  else
424
427
  raise UnspecifiedBodyType.new("You must specify a valid send_as")
@@ -442,18 +445,18 @@ module Facebooker
442
445
 
443
446
  def initialize_template_class(assigns)
444
447
  template_root = "#{RAILS_ROOT}/app/views"
445
- controller_root = File.join(template_root,self.class.controller_path)
448
+ controller_root = File.join(template_root,self.class.controller_path)
446
449
  #only do this on Rails 2.1
447
- if ActionController::Base.respond_to?(:append_view_path)
448
- # only add the view path once
449
- unless ActionController::Base.view_paths.include?(controller_root)
450
- ActionController::Base.append_view_path(controller_root)
451
- ActionController::Base.append_view_path(controller_root+"/..")
452
- end
450
+ if ActionController::Base.respond_to?(:append_view_path)
451
+ # only add the view path once
452
+ unless ActionController::Base.view_paths.include?(controller_root)
453
+ ActionController::Base.append_view_path(controller_root)
454
+ ActionController::Base.append_view_path(controller_root+"/..")
455
+ end
453
456
  view_paths = ActionController::Base.view_paths
454
457
  else
455
458
  view_paths = [template_root, controller_root]
456
- end
459
+ end
457
460
  returning ActionView::Base.new(view_paths, assigns, self) do |template|
458
461
  template.controller=self
459
462
  template.extend(self.class.master_helper_module)
@@ -0,0 +1,19 @@
1
+ class Facebooker::StreamPost
2
+ attr_accessor :user_message, :attachment, :action_links, :target, :actor
3
+
4
+ def initialize
5
+ self.action_links = []
6
+ end
7
+
8
+ alias_method :message, :user_message
9
+ alias_method :message=, :user_message=
10
+
11
+ def action_links(*args)
12
+ if args.blank?
13
+ @action_links
14
+ else
15
+ @action_links = args.first
16
+ end
17
+ end
18
+
19
+ end
@@ -2,7 +2,7 @@ module Facebooker #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 56
5
+ TINY = 58
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -0,0 +1,72 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
2
+
3
+ class Facebooker::AttachmentTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ super
7
+ @attachment = Facebooker::Attachment.new
8
+ end
9
+
10
+ def test_can_create_attachment
11
+ attachment = Facebooker::Attachment.new
12
+ end
13
+
14
+ def test_can_set_name
15
+ @attachment.name = "my name"
16
+ assert_equal({:name=>"my name"},@attachment.to_hash)
17
+ end
18
+
19
+ def test_can_set_href
20
+ @attachment.href="my href"
21
+ assert_equal({:href=>"my href"},@attachment.to_hash)
22
+ end
23
+
24
+ def test_can_set_caption
25
+ @attachment.caption="my caption"
26
+ assert_equal({:caption=>"my caption"},@attachment.to_hash)
27
+ end
28
+
29
+ def test_can_set_description
30
+ @attachment.description="my description"
31
+ assert_equal({:description=>"my description"},@attachment.to_hash)
32
+ end
33
+
34
+ def test_can_set_comments_xid
35
+ @attachment.comments_xid="my xid"
36
+ assert_equal({:comments_xid=>"my xid"},@attachment.to_hash)
37
+ end
38
+
39
+ def test_can_add_media
40
+ @attachment.add_media(:type=>"image",:src=>"http://www.google.com",:href=>"http://www.bing.com")
41
+ assert_equal({:media=>[{:type=>"image",:src=>"http://www.google.com",:href=>"http://www.bing.com"}]},@attachment.to_hash)
42
+ end
43
+
44
+ def test_can_add_image
45
+ @attachment.add_image("image_source","image_url")
46
+ assert_equal({:media=>[{:type=>"image",:src=>"image_source",:href=>"image_url"}]},@attachment.to_hash)
47
+ end
48
+
49
+ def test_can_add_mp3_with_only_required_params
50
+ @attachment.add_mp3("required_source")
51
+ assert_equal({:media=>[{:type=>"mp3",:src=>"required_source"}]},@attachment.to_hash)
52
+ end
53
+
54
+ def test_only_includes_mp3_optional_params_that_are_provided
55
+ @attachment.add_mp3("required_source","seven nation army","white stripes")
56
+ assert_equal({:media=>[{:type=>"mp3",:src=>"required_source",:title=>"seven nation army",:artist=>"white stripes"}]},@attachment.to_hash)
57
+ end
58
+
59
+ def test_can_add_flash_with_only_required_params
60
+ @attachment.add_flash("swf_source","img_source")
61
+ assert_equal({:media=>[{:type=>"flash",:swfsrc=>"swf_source",:imgsrc=>"img_source"}]},@attachment.to_hash)
62
+ end
63
+ def test_can_add_flash_with_optional_params
64
+ @attachment.add_flash("swf_source","img_source",100,80,160)
65
+ assert_equal({:media=>[{:type=>"flash",
66
+ :swfsrc=>"swf_source",
67
+ :imgsrc=>"img_source",
68
+ :width=>100,
69
+ :height=>80,
70
+ :expanded_width=>160}]},@attachment.to_hash)
71
+ end
72
+ end
@@ -3,6 +3,11 @@ require 'active_support'
3
3
 
4
4
  class Facebooker::PageTest < Test::Unit::TestCase
5
5
 
6
+ def setup
7
+ super
8
+ Facebooker::Session.current = mock("session")
9
+ end
10
+
6
11
  def test_should_be_able_to_populate_with_photo_id_as_integer
7
12
  p = Facebooker::Page.new(12345)
8
13
  assert_equal(12345,p.page_id)
@@ -162,12 +162,21 @@ class Facebooker::UserTest < Test::Unit::TestCase
162
162
  expect_http_posts_with_responses(example_profile_publish_to_get_xml)
163
163
  @user.publish_to(@other_user, :message => 'i love you man')
164
164
  end
165
+
165
166
  def test_publish_to_converts_attachment_to_json
166
167
  @user = Facebooker::User.new(548871286, @session)
167
168
  @user.session.expects(:post).with("facebook.stream.publish",has_entry(:attachment=>instance_of(String)),false)
168
169
  @user.publish_to(@other_user, :message => 'i love you man',:attachment=>{:a=>"b"})
169
170
  end
170
171
 
172
+ def test_publish_to_converts_attachment_from_attachment_objecect
173
+ @user = Facebooker::User.new(548871286, @session)
174
+ @user.session.expects(:post).with("facebook.stream.publish",has_entry(:attachment=>instance_of(String)),false)
175
+ attachment = Facebooker::Attachment.new
176
+ attachment.name = "My name"
177
+ @user.publish_to(@other_user, :message => 'i love you man',:attachment=>attachment)
178
+ end
179
+
171
180
  def test_comment_on
172
181
  @user = Facebooker::User.new(548871286, @session)
173
182
  expect_http_posts_with_responses(example_comment_on_response)
@@ -300,7 +309,7 @@ class Facebooker::UserTest < Test::Unit::TestCase
300
309
  <src>http://ip002.facebook.com/v11/135/18/8055/s1240077_30043524_2020.jpg</src>
301
310
  <src_big>http://ip002.facebook.com/v11/135/18/8055/n1240077_30043524_2020.jpg</src_big>
302
311
  <src_small>http://ip002.facebook.com/v11/135/18/8055/t1240077_30043524_2020.jpg</src_small>
303
- <link>http://www.facebook.com/photo.php?pid=30043524&id=8055</link>
312
+ <link>http://www.facebook.com/photo.php?pid=30043524&amp;id=8055</link>
304
313
  <caption>From The Deathmatch (Trailer) (1999)</caption>
305
314
  <created>1132553361</created>
306
315
  </photo>
@@ -311,7 +320,7 @@ class Facebooker::UserTest < Test::Unit::TestCase
311
320
  <src>http://ip002.facebook.com/v11/135/18/8055/s1240077_30043525_2184.jpg</src>
312
321
  <src_big>http://ip002.facebook.com/v11/135/18/8055/n1240077_30043525_2184.jpg</src_big>
313
322
  <src_small>http://ip002.facebook.com/v11/135/18/8055/t1240077_30043525_2184.jpg</src_small>
314
- <link>http://www.facebook.com/photo.php?pid=30043525&id=8055</link>
323
+ <link>http://www.facebook.com/photo.php?pid=30043525&amp;id=8055</link>
315
324
  <caption>Mexico City, back cover of the CYHS Student Underground 1999.</caption>
316
325
  <created>1132553362</created>
317
326
  </photo>
@@ -70,7 +70,7 @@ class TestPublisher < Facebooker::Rails::Publisher
70
70
 
71
71
  end
72
72
 
73
- def profile_update_with_profile_main(to,f)
73
+ def profile_update_with_profile_main(to,f)
74
74
  send_as :profile
75
75
  recipients to
76
76
  from f
@@ -299,7 +299,7 @@ class Facebooker::Rails::Publisher::PublisherTest < Test::Unit::TestCase
299
299
  assert_equal "profile_action",p.profile_action
300
300
  assert_equal "mobile_profile",p.mobile_profile
301
301
  end
302
- def test_create_profile_update_with_profile_main
302
+ def test_create_profile_update_with_profile_main
303
303
  p=TestPublisher.create_profile_update_with_profile_main(@user,@user)
304
304
  assert_equal Facebooker::Rails::Publisher::Profile,p.class
305
305
  assert_equal "profile",p.profile
@@ -315,7 +315,7 @@ class Facebooker::Rails::Publisher::PublisherTest < Test::Unit::TestCase
315
315
  TestPublisher.deliver_profile_update(@user,@user)
316
316
  end
317
317
 
318
- def test_deliver_profile_with_main
318
+ def test_deliver_profile_with_main
319
319
  Facebooker::User.stubs(:new).returns(@user)
320
320
  @user.expects(:set_profile_fbml).with('profile', 'mobile_profile', 'profile_action','profile_main')
321
321
  TestPublisher.deliver_profile_update_with_profile_main(@user,@user)
@@ -436,6 +436,19 @@ class Facebooker::Rails::Publisher::PublisherTest < Test::Unit::TestCase
436
436
 
437
437
  TestPublisher.deliver_publish_post_to_own_stream(@user)
438
438
  end
439
+
440
+ def test_publish_stream_sets_action_links
441
+ @user = Facebooker::User.new
442
+ stream_post = TestPublisher.create_publish_post_to_own_stream(@user)
443
+ assert_equal [{:text => "Action Link", :href => "http://www.example.com/action_link"}],stream_post.action_links
444
+ end
445
+
446
+ def test_publish_stream_sets_target
447
+ @user = Facebooker::User.new
448
+ stream_post = TestPublisher.create_publish_post_to_own_stream(@user)
449
+ assert_equal @user,stream_post.target
450
+
451
+ end
439
452
 
440
453
  def test_publish_post_to_friends_stream
441
454
  @from_user = Facebooker::User.new
@@ -57,7 +57,7 @@ class ControllerWhichRequiresFacebookAuthentication < NoisyController
57
57
  render :text=>url_for(options)
58
58
  end
59
59
 
60
- def named_route_test
60
+ def named_route_test
61
61
  render :text=>comments_url()
62
62
  end
63
63
 
@@ -171,6 +171,7 @@ class RailsIntegrationTestForFBConnect < Test::Unit::TestCase
171
171
  def test_doesnt_set_cookie_but_facebook_session_is_available
172
172
  setup_fb_connect_cookies
173
173
  get :index
174
+ p "this one"
174
175
  assert_not_nil @controller.facebook_session
175
176
  assert_nil @response.cookies[:facebook_session]
176
177
 
@@ -965,7 +966,7 @@ class RailsHelperTest < Test::Unit::TestCase
965
966
  assert_equal("<fb:request-form-submit />",@h.fb_request_form_submit)
966
967
  end
967
968
 
968
- def test_fb_request_form_submit_with_uid
969
+ def test_fb_request_form_submit_with_uid
969
970
  assert_equal("<fb:request-form-submit uid=\"123456789\" />",@h.fb_request_form_submit({:uid => "123456789"}))
970
971
  end
971
972
 
@@ -1114,7 +1115,17 @@ class RailsHelperTest < Test::Unit::TestCase
1114
1115
  assert_equal "FB.Connect.showFeedDialog(null, null, null, null, null, FB.RequireConnect.promptConnect, null, \"prompt\", #{{"value" => "message"}.to_json});",
1115
1116
  @h.fb_user_action(action,"message","prompt")
1116
1117
  end
1117
-
1118
+
1119
+ def test_fb_connect_stream_publish
1120
+ stream_post = Facebooker::StreamPost.new
1121
+ attachment = Facebooker::Attachment.new
1122
+ attachment.name="name"
1123
+ stream_post.message = "message"
1124
+ stream_post.target="12451752"
1125
+ stream_post.attachment = attachment
1126
+
1127
+ assert @h.fb_connect_stream_publish(stream_post).match(/FB.Connect\.streamPublish\(\"message\", {\"name\":\s?\"name\"}, \[], \"12451752\", null, null, false, null\);/)
1128
+ end
1118
1129
 
1119
1130
  def test_fb_connect_javascript_tag
1120
1131
  silence_warnings do
@@ -1377,8 +1388,8 @@ class RailsUrlHelperExtensionsTest < Test::Unit::TestCase
1377
1388
  @prompt = "Are you sure?"
1378
1389
  @default_title = "Please Confirm"
1379
1390
  @title = "Confirm Request"
1380
- @style = {:color => 'black', :background => 'white'}
1381
- @verbose_style = "{background: 'white', color: 'black'}"
1391
+ @style = {:color => 'black'}
1392
+ @verbose_style = "{color: 'black'}"
1382
1393
  @default_okay = "Okay"
1383
1394
  @default_cancel = "Cancel"
1384
1395
  @default_style = "" #"'width','200px'"
@@ -386,14 +386,14 @@ class Facebooker::SessionTest < Test::Unit::TestCase
386
386
  assert_equal('attending', @fql_response.first.rsvp_status)
387
387
  end
388
388
 
389
- def test_parses_batch_response_with_escaped_chars
390
- @session = Facebooker::Session.create(ENV['FACEBOOK_API_KEY'], ENV['FACEBOOK_SECRET_KEY'])
391
- expect_http_posts_with_responses(example_batch_run_with_escaped_chars_xml)
392
- @session.batch do
393
- @response = @session.events(:start_time => Time.now.to_i)
394
- end
395
- assert_kind_of(Facebooker::Event, @response.first)
396
- assert_equal('Wolf & Crow', @response.first.name)
389
+ def test_parses_batch_response_with_escaped_chars
390
+ @session = Facebooker::Session.create(ENV['FACEBOOK_API_KEY'], ENV['FACEBOOK_SECRET_KEY'])
391
+ expect_http_posts_with_responses(example_batch_run_with_escaped_chars_xml)
392
+ @session.batch do
393
+ @response = @session.events(:start_time => Time.now.to_i)
394
+ end
395
+ assert_kind_of(Facebooker::Event, @response.first)
396
+ assert_equal('Wolf & Crow', @response.first.name)
397
397
  end
398
398
 
399
399
  def test_parses_batch_response_sets_exception
@@ -624,7 +624,7 @@ XML
624
624
  <modified>1132553363</modified>
625
625
  <description>No I will not make out with you</description>
626
626
  <location>York, PA</location>
627
- <link>http://www.facebook.com/album.php?aid=2002205&id=8055</link>
627
+ <link>http://www.facebook.com/album.php?aid=2002205&amp;id=8055</link>
628
628
  <size>30</size>
629
629
  <visible>friends</visible>
630
630
  <modified_major>1241834423</modified_major>
@@ -854,7 +854,7 @@ class TestFacebooker < Test::Unit::TestCase
854
854
  <src>http://ip002.facebook.com/v67/161/72/219074/s219074_31637752_5455.jpg</src>
855
855
  <src_big>http://ip002.facebook.com/v67/161/72/219074/n219074_31637752_5455.jpg</src_big>
856
856
  <src_small>http://ip002.facebook.com/v67/161/72/219074/t219074_31637752_5455.jpg</src_small>
857
- <link>http://www.facebook.com/photo.php?pid=31637752&id=219074</link>
857
+ <link>http://www.facebook.com/photo.php?pid=31637752&amp;id=219074</link>
858
858
  <caption>Under the sunset</caption>
859
859
  </photos_upload_response>
860
860
  XML
@@ -872,7 +872,7 @@ class TestFacebooker < Test::Unit::TestCase
872
872
  <modified>1132553363</modified>
873
873
  <description>No I will not make out with you</description>
874
874
  <location>York, PA</location>
875
- <link>http://www.facebook.com/album.php?aid=2002205&id=8055</link>
875
+ <link>http://www.facebook.com/album.php?aid=2002205&amp;id=8055</link>
876
876
  <size>0</size>
877
877
  </photos_createAlbum_response>
878
878
  XML
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebooker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.56
4
+ version: 1.0.58
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Fowler
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2009-12-04 00:00:00 -05:00
17
+ date: 2009-12-11 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -111,6 +111,7 @@ files:
111
111
  - lib/facebooker/adapters/adapter_base.rb
112
112
  - lib/facebooker/adapters/bebo_adapter.rb
113
113
  - lib/facebooker/adapters/facebook_adapter.rb
114
+ - lib/facebooker/attachment.rb
114
115
  - lib/facebooker/admin.rb
115
116
  - lib/facebooker/application.rb
116
117
  - lib/facebooker/batch_request.rb
@@ -172,6 +173,7 @@ files:
172
173
  - lib/facebooker/service/typhoeus_service.rb
173
174
  - lib/facebooker/service/typhoeus_multi_service.rb
174
175
  - lib/facebooker/session.rb
176
+ - lib/facebooker/stream_post.rb
175
177
  - lib/facebooker/version.rb
176
178
  - lib/net/http_multipart_post.rb
177
179
  - lib/rack/facebook.rb
@@ -183,6 +185,7 @@ files:
183
185
  - test/facebooker/adapters_test.rb
184
186
  - test/facebooker/admin_test.rb
185
187
  - test/facebooker/application_test.rb
188
+ - test/facebooker/attachment_test.rb
186
189
  - test/facebooker/batch_request_test.rb
187
190
  - test/facebooker/data_test.rb
188
191
  - test/facebooker/logging_test.rb
@@ -238,6 +241,7 @@ test_files:
238
241
  - test/facebooker/adapters_test.rb
239
242
  - test/facebooker/admin_test.rb
240
243
  - test/facebooker/application_test.rb
244
+ - test/facebooker/attachment_test.rb
241
245
  - test/facebooker/batch_request_test.rb
242
246
  - test/facebooker/data_test.rb
243
247
  - test/facebooker/logging_test.rb