upstream-simple_facebook_connect 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -21,7 +21,7 @@ When an existing user of your site clicks the button he will also be able to log
21
21
 
22
22
  For basic application setup see the [facebook developer documentation](http://developers.facebook.com/get_started.php).
23
23
 
24
- Set the "Canvas Callback URL" and the "Connect URL" to "http://your.server.com/fb/connect". Write down the API and secret key for later.
24
+ Set the "Canvas Callback URL" to "http://your.server.com/fb/connect" and the "Connect URL" to "http://your.server.com". Write down the API and secret key for later.
25
25
 
26
26
 
27
27
  ## Installation
@@ -89,6 +89,22 @@ This will generate a feature, step definitions and fixtures to test the facebook
89
89
 
90
90
  Finally: run the features and by now everything should be green. Congrats.
91
91
 
92
+ ## What else
93
+
94
+ You can grab some of the facebook profile data (e.g. name, location, picture) when signing up your new users. For a complete list of attributes see `SimpleFacebookConnect::User::FIELDS`. In order to do that you could add a line of code to your signup action:
95
+
96
+ class UsersController < ApplicationController
97
+ def create
98
+ @user = # initialize user
99
+ ....
100
+ if facebook_user
101
+ @user.name = facebook_user.name
102
+ @user.about_me = facebook_user.about_me
103
+ end
104
+ @user.save
105
+ end
106
+ end
107
+
92
108
  ## Links
93
109
 
94
110
  * facebooker: http://facebooker.rubyforge.org/
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -4,14 +4,16 @@ module SimpleFacebookConnect
4
4
 
5
5
  FIELDS = [:uid, :hometown_location, :first_name, :last_name, :current_location, :pic, :locale, :email_hashes, :about_me, :interests]
6
6
  attr_reader(*FIELDS)
7
-
7
+ attr_reader :session
8
+
8
9
  def initialize(uid, session)
9
10
  @uid = uid
10
- populate(session)
11
+ @session = session
12
+ populate
11
13
  end
12
14
 
13
- def populate(session)
14
- session.post('facebook.users.getInfo', :fields => coma_seperated_fields, :uids => uid) do |response|
15
+ def populate
16
+ @session.post('facebook.users.getInfo', :fields => coma_seperated_fields, :uids => uid) do |response|
15
17
  FIELDS.each do |field|
16
18
  instance_variable_set(:"@#{field}", response.first[field.to_s])
17
19
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{simple_facebook_connect}
5
- s.version = "0.0.2"
5
+ s.version = "0.0.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Alexander Lang", "Frank Pr\303\266\303\237dorf"]
9
- s.date = %q{2009-07-15}
9
+ s.date = %q{2009-07-22}
10
10
  s.email = %q{alex@upstream-berlin.com}
11
11
  s.extra_rdoc_files = [
12
12
  "README.md"
@@ -25,6 +25,11 @@ describe SimpleFacebookConnect::User, 'initialize' do
25
25
  user.interests.should == 'snowboarding, philosophy, soccer, talking to strangers'
26
26
  end
27
27
 
28
+ it "should expose the session" do
29
+ user = SimpleFacebookConnect::User.new(8055, @session)
30
+ user.session.should == @session
31
+ end
32
+
28
33
 
29
34
  def user_info_response
30
35
  [{"uid"=>"8055", "about_me"=>"This field perpetuates the glorification of the ego. Also, it has a character limit.", "activities"=>"Here: facebook, etc. There: Glee Club, a capella, teaching.", "affiliations"=>[{"nid"=>"50453093", "name"=>"Facebook Developers", "type"=>"work", "status"=>"", "year"=>""}], "birthday"=>"November 3", "books"=>"The Brothers K, GEB, Ken Wilber, Zen and the Art, Fitzgerald, The Emporer's New Mind, The Wonderful Story of Henry Sugar", "current_location"=>{"city"=>"Palo Alto", "state"=>"California", "country"=>"United States", "zip"=>"94303"}, "education_history"=>[{"name"=>"Harvard", "year"=>"2003", "concentrations"=>["Applied Mathematics", "Computer Science"]}], "email_hashes"=>["2781152470_9f9c29692798573d8c76eaaf053a1911"], "family"=>[{"family_elt_elt"=>"1394244902"}, {"family_elt_elt"=>"48703107"}, {"family_elt_elt"=>"1078767258"}, {"family_elt_elt"=>""}], "first_name"=>"Dave", "hometown_location"=>{"city"=>"York", "state"=>"Pennsylvania", "country"=>"United States"}, "hs_info"=>{"hs1_name"=>"Central York High School", "hs2_name"=>{}, "grad_year"=>"1999", "hs1_id"=>"21846", "hs2_id"=>"0"}, "is_app_user"=>"1", "has_added_app"=>"1", "interests"=>"snowboarding, philosophy, soccer, talking to strangers", "last_name"=>"Fetterman", "locale"=>"en_US", "meeting_for"=>["Friendship"], "meeting_sex"=>["female"], "movies"=>"Tommy Boy, Billy Madison, Fight Club, Dirty Work, Meet the Parents, My Blue Heaven, Office Space", "music"=>"New Found Glory, Daft Punk, Weezer, The Crystal Method, Rage, the KLF, Green Day, Live, Coldplay, Panic at the Disco, Family Force 5", "name"=>"Dave Fetterman", "notes_count"=>"0", "pic"=>"http://photos-055.facebook.com/ip007/profile3/1271/65/s8055_39735.jpg", "pic_big"=>"http://photos-055.facebook.com/ip007/profile3/1271/65/n8055_39735.jpg", "pic_small"=>"http://photos-055.facebook.com/ip007/profile3/1271/65/t8055_39735.jpg", "pic_square"=>"http://photos-055.facebook.com/ip007/profile3/1271/65/q8055_39735.jpg", "political"=>"Moderate", "profile_update_time"=>"1170414620", "quotes"=>"", "relationship_status"=>"In a Relationship", "religion"=>"", "sex"=>"male", "significant_other_id"=>nil, "status"=>{"message"=>"Fast Company, November issue, page 84", "time"=>"1193075616"}, "timezone"=>"-8", "tv"=>"cf. Bob Trahan", "wall_count"=>"121", "work_history"=>[{"location"=>{"city"=>"Palo Alto", "state"=>"CA", "country"=>"United States"}, "company_name"=>"Facebook", "position"=>"Software Engineer", "description"=>"Tech Lead, Facebook Platform", "start_date"=>"2006-01", "end_date"=>""}]}]
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  __DIR__ = File.dirname __FILE__
2
- $LOAD_PATH << __DIR__ + '/../lib'
2
+ $LOAD_PATH.unshift __DIR__ + '/../lib'
3
3
 
4
4
  require 'simple_facebook_connect'
5
-
6
5
  require 'fileutils'
7
6
  require 'rubygems'
8
7
  Gem::RubyGemsVersion.inspect # without this the activerecord gem doesn't load on ruby 1.9 #WTF
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upstream-simple_facebook_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Lang
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-07-15 00:00:00 -07:00
13
+ date: 2009-07-22 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies: []
16
16