facebooker 1.0.50 → 1.0.51
Sign up to get free protection for your applications and to get access to all the features.
- data/facebooker.gemspec +2 -2
- data/lib/facebooker/models/tag.rb +1 -1
- data/lib/facebooker/models/user.rb +3 -1
- data/lib/facebooker/parser.rb +15 -1
- data/lib/facebooker/rails/controller.rb +2 -2
- data/lib/facebooker/rails/helpers/fb_connect.rb +2 -1
- data/lib/facebooker/version.rb +1 -1
- data/lib/tasks/tunnel.rake +1 -1
- data/test/facebooker/session_test.rb +31 -0
- metadata +2 -2
data/facebooker.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{facebooker}
|
5
|
-
s.version = "1.0.
|
5
|
+
s.version = "1.0.51"
|
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-09-
|
9
|
+
s.date = %q{2009-09-29}
|
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
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'facebooker/model'
|
2
2
|
require 'facebooker/models/affiliation'
|
3
3
|
require 'facebooker/models/work_info'
|
4
|
+
require 'facebooker/models/family_relative_info'
|
4
5
|
module Facebooker
|
5
6
|
#
|
6
7
|
# Holds attributes and behavior for a Facebook User
|
@@ -10,7 +11,7 @@ module Facebooker
|
|
10
11
|
include Model
|
11
12
|
attr_accessor :message, :time, :status_id
|
12
13
|
end
|
13
|
-
FIELDS = [:status, :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, :birthday_date, :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
|
+
FIELDS = [:status, :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, :birthday_date, :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, :online_presence, :verified, :profile_blurb, :username, :website, :is_blocked, :family]
|
14
15
|
STANDARD_FIELDS = [:uid, :first_name, :last_name, :name, :timezone, :birthday, :sex, :affiliations, :locale, :profile_url, :proxied_email]
|
15
16
|
populating_attr_accessor(*FIELDS)
|
16
17
|
attr_reader :affiliations
|
@@ -20,6 +21,7 @@ module Facebooker
|
|
20
21
|
populating_hash_settable_list_accessor :affiliations, Affiliation
|
21
22
|
populating_hash_settable_list_accessor :education_history, EducationInfo
|
22
23
|
populating_hash_settable_list_accessor :work_history, WorkInfo
|
24
|
+
populating_hash_settable_list_accessor :family, FamilyRelativeInfo
|
23
25
|
|
24
26
|
populating_attr_reader :status
|
25
27
|
|
data/lib/facebooker/parser.rb
CHANGED
@@ -465,6 +465,18 @@ module Facebooker
|
|
465
465
|
element('events_rsvp_response', data).content.strip
|
466
466
|
end
|
467
467
|
end
|
468
|
+
|
469
|
+
class EventsCreate < Parser#:nodoc:
|
470
|
+
def self.process(data)
|
471
|
+
element('events_create_response', data).content.strip
|
472
|
+
end
|
473
|
+
end
|
474
|
+
|
475
|
+
class EventsCancel < Parser#:nodoc:
|
476
|
+
def self.process(data)
|
477
|
+
element('events_cancel_response', data).content.strip
|
478
|
+
end
|
479
|
+
end
|
468
480
|
|
469
481
|
class EventsGet < Parser#:nodoc:
|
470
482
|
def self.process(data)
|
@@ -666,7 +678,9 @@ module Facebooker
|
|
666
678
|
'facebook.photos.addTag' => AddTags,
|
667
679
|
'facebook.photos.upload' => UploadPhoto,
|
668
680
|
'facebook.stream.publish' => StreamPublish,
|
669
|
-
'facebook.stream.addComment' => StreamAddComment,
|
681
|
+
'facebook.stream.addComment' => StreamAddComment,
|
682
|
+
'facebook.events.create' => EventsCreate,
|
683
|
+
'facebook.events.cancel' => EventsCancel,
|
670
684
|
'facebook.events.get' => EventsGet,
|
671
685
|
'facebook.events.rsvp' => EventsRsvp,
|
672
686
|
'facebook.groups.get' => GroupsGet,
|
@@ -126,7 +126,7 @@ module Facebooker
|
|
126
126
|
end
|
127
127
|
|
128
128
|
def fb_cookie_names
|
129
|
-
fb_cookie_names = cookies.keys.select{|k| k.starts_with?(fb_cookie_prefix)}
|
129
|
+
fb_cookie_names = cookies.keys.select{|k| k && k.starts_with?(fb_cookie_prefix)}
|
130
130
|
end
|
131
131
|
|
132
132
|
def secure_with_cookies!
|
@@ -189,7 +189,7 @@ module Facebooker
|
|
189
189
|
def create_new_facebook_session_and_redirect!
|
190
190
|
session[:facebook_session] = new_facebook_session
|
191
191
|
next_url = after_facebook_login_url || default_after_facebook_login_url
|
192
|
-
top_redirect_to session[:facebook_session].login_url({:next => next_url}) unless @installation_required
|
192
|
+
top_redirect_to session[:facebook_session].login_url({:next => next_url, :canvas=>params[:fb_sig_in_canvas]}) unless @installation_required
|
193
193
|
false
|
194
194
|
end
|
195
195
|
|
@@ -4,7 +4,8 @@ module Facebooker
|
|
4
4
|
module FbConnect
|
5
5
|
|
6
6
|
def fb_connect_javascript_tag(options = {})
|
7
|
-
|
7
|
+
# accept both Rails and Facebook locale formatting, i.e. "en-US" and "en_US".
|
8
|
+
lang = "/#{options[:lang].to_s.gsub('-', '_')}" if options[:lang]
|
8
9
|
# dont use the javascript_include_tag helper since it adds a .js at the end
|
9
10
|
if request.ssl?
|
10
11
|
"<script src=\"https://www.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php#{lang}\" type=\"text/javascript\"></script>"
|
data/lib/facebooker/version.rb
CHANGED
data/lib/tasks/tunnel.rake
CHANGED
@@ -27,7 +27,7 @@ namespace :facebooker do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
task :config => :environment do
|
30
|
-
facebook_config = File.
|
30
|
+
facebook_config = File.join(RAILS_ROOT, 'config', 'facebooker.yml')
|
31
31
|
FACEBOOKER = YAML.load(ERB.new(File.read(facebook_config)).result)[RAILS_ENV]
|
32
32
|
@public_host_username = FACEBOOKER['tunnel']['public_host_username']
|
33
33
|
@public_host = FACEBOOKER['tunnel']['public_host']
|
@@ -157,6 +157,18 @@ class Facebooker::SessionTest < Test::Unit::TestCase
|
|
157
157
|
assert_equal(["1240077", "222332", "222333", "222335", "222336"], event_attendances.map{|ea| ea.uid}.sort)
|
158
158
|
assert_equal 5, event_attendances.size
|
159
159
|
end
|
160
|
+
|
161
|
+
def test_can_create_events
|
162
|
+
mock_http = establish_session
|
163
|
+
mock_http.should_receive(:post_multipart_form).and_return(example_event_create_xml).once
|
164
|
+
event_id = @session.create_event(:name => 'foo', :category => 'bar')
|
165
|
+
assert_equal '34444349712', event_id
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_can_cancel_events
|
169
|
+
expect_http_posts_with_responses(example_event_cancel_xml)
|
170
|
+
assert @session.cancel_event("12345", :cancel_message => "It's raining")
|
171
|
+
end
|
160
172
|
|
161
173
|
def test_can_query_for_events
|
162
174
|
expect_http_posts_with_responses(example_events_get_xml)
|
@@ -431,6 +443,24 @@ XML
|
|
431
443
|
</groups_get_response>
|
432
444
|
XML
|
433
445
|
end
|
446
|
+
|
447
|
+
def example_event_create_xml
|
448
|
+
<<-XML
|
449
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
450
|
+
<events_create_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
|
451
|
+
34444349712
|
452
|
+
</events_create_response>
|
453
|
+
XML
|
454
|
+
end
|
455
|
+
|
456
|
+
def example_event_cancel_xml
|
457
|
+
<<-XML
|
458
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
459
|
+
<events_cancel_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
|
460
|
+
1
|
461
|
+
</events_cancel_response>
|
462
|
+
XML
|
463
|
+
end
|
434
464
|
|
435
465
|
def example_events_get_xml
|
436
466
|
<<-XML
|
@@ -690,6 +720,7 @@ XML
|
|
690
720
|
</users_getStandardInfo_response>
|
691
721
|
XML
|
692
722
|
end
|
723
|
+
|
693
724
|
end
|
694
725
|
|
695
726
|
|
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.
|
4
|
+
version: 1.0.51
|
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-09-
|
17
|
+
date: 2009-09-29 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|