fb_graph 2.6.2 → 2.6.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fb_graph (2.6.2)
4
+ fb_graph (2.6.3)
5
5
  httpclient (>= 2.2.0.2)
6
6
  multi_json (>= 1.3)
7
7
  rack-oauth2 (>= 0.14.4)
@@ -37,7 +37,7 @@ GEM
37
37
  crack (0.3.2)
38
38
  diff-lcs (1.1.3)
39
39
  erubis (2.7.0)
40
- fb_graph-mock (0.0.3)
40
+ fb_graph-mock (0.1.0)
41
41
  fb_graph
42
42
  rspec
43
43
  webmock
@@ -47,8 +47,8 @@ GEM
47
47
  i18n (0.6.1)
48
48
  journey (1.0.4)
49
49
  multi_json (1.5.0)
50
- oj (2.0.0)
51
- rack (1.4.3)
50
+ oj (2.0.2)
51
+ rack (1.4.4)
52
52
  rack-cache (1.2)
53
53
  rack (>= 0.4)
54
54
  rack-oauth2 (1.0.0)
@@ -68,7 +68,7 @@ GEM
68
68
  rspec-core (2.12.2)
69
69
  rspec-expectations (2.12.1)
70
70
  diff-lcs (~> 1.1.3)
71
- rspec-mocks (2.12.1)
71
+ rspec-mocks (2.12.2)
72
72
  sprockets (2.2.2)
73
73
  hike (~> 1.2)
74
74
  multi_json (~> 1.0)
@@ -88,7 +88,7 @@ DEPENDENCIES
88
88
  actionpack (>= 3.0.6)
89
89
  cover_me (>= 1.2.0)
90
90
  fb_graph!
91
- fb_graph-mock
91
+ fb_graph-mock (>= 0.1.0)
92
92
  jruby-openssl (>= 0.7)
93
93
  oj
94
94
  rake (>= 0.8)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.6.2
1
+ 2.6.3
data/fb_graph.gemspec CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency "rcov", ">= 0.9"
24
24
  end
25
25
  s.add_development_dependency "rspec", ">= 2"
26
- s.add_development_dependency "fb_graph-mock"
26
+ s.add_development_dependency "fb_graph-mock", ">= 0.1.0"
27
27
  s.add_development_dependency "actionpack", ">= 3.0.6"
28
28
  end
@@ -0,0 +1,12 @@
1
+ module FbGraph
2
+ class AgeRange < Range
3
+ DEFAULT_MAX_AGE = 9999
4
+
5
+ def initialize(attributes = {})
6
+ super attributes[:min], attributes[:max] || DEFAULT_MAX_AGE
7
+ end
8
+
9
+ alias_method :min, :first
10
+ alias_method :max, :last
11
+ end
12
+ end
@@ -96,6 +96,7 @@ module FbGraph
96
96
  auth = Auth.new(self.identifier, self.secret)
97
97
  self.access_token = auth.client.access_token! :client_auth_body
98
98
  end
99
+ alias_method :app_access_token, :get_access_token
99
100
 
100
101
  def access_token_with_auto_fetch
101
102
  access_token_without_auto_fetch ||
@@ -26,7 +26,7 @@ module FbGraph
26
26
  end
27
27
 
28
28
  def self.decode_json(json)
29
- MultiJson::load(json).with_indifferent_access
29
+ MultiJson.load(json).with_indifferent_access
30
30
  rescue => e
31
31
  raise VerificationFailed.new('Invalid JSON')
32
32
  end
@@ -0,0 +1,11 @@
1
+ module FbGraph
2
+ class Device
3
+ include Comparison
4
+ attr_accessor :os, :hardware
5
+
6
+ def initialize(attributes = {})
7
+ @os = attributes[:os]
8
+ @hardware = attributes[:hardware]
9
+ end
10
+ end
11
+ end
@@ -81,7 +81,7 @@ module FbGraph
81
81
  def initialize(code, message, body = '')
82
82
  @code = code
83
83
  if body.present?
84
- response = MultiJson::load(body).with_indifferent_access
84
+ response = MultiJson.load(body).with_indifferent_access
85
85
  message = response[:error][:message]
86
86
  @type = response[:error][:type]
87
87
  end
data/lib/fb_graph/node.rb CHANGED
@@ -135,7 +135,7 @@ module FbGraph
135
135
  when 'null'
136
136
  nil
137
137
  else
138
- _response_ = MultiJson::load(response.body).with_indifferent_access
138
+ _response_ = MultiJson.load(response.body).with_indifferent_access
139
139
  if (200...300).include?(response.status)
140
140
  _response_
141
141
  else
data/lib/fb_graph/page.rb CHANGED
@@ -46,11 +46,11 @@ module FbGraph
46
46
  end
47
47
  end
48
48
 
49
- protected
50
-
51
- def page_access_token
52
- get({:fields => "access_token"})["access_token"]
49
+ def get_access_token(options = {})
50
+ access_token = get options.merge(:fields => "access_token")
51
+ self.access_token = Rack::OAuth2::AccessToken::Legacy.new access_token
53
52
  end
53
+ alias_method :page_access_token, :get_access_token
54
54
  end
55
55
  end
56
56
 
@@ -1,10 +1,9 @@
1
1
  module FbGraph
2
2
  class TaggedObject < Node
3
- attr_accessor :name, :offset, :length, :raw_attributes
3
+ attr_accessor :name, :offset, :length
4
4
 
5
5
  def initialize(identifier, attributes = {})
6
6
  super
7
- @raw_attributes = attributes
8
7
  [:name, :offset, :length].each do |key|
9
8
  self.send("#{key}=", attributes[key])
10
9
  end
data/lib/fb_graph/user.rb CHANGED
@@ -46,35 +46,40 @@ module FbGraph
46
46
  include OpenGraph::UserContext
47
47
  extend Searchable
48
48
 
49
- attr_accessor :name, :first_name, :middle_name, :last_name, :gender, :locale, :languages, :link, :username, :third_party_id, :timezone, :updated_time, :verified, :about, :bio, :birthday, :education, :email, :hometown, :interested_in, :location, :political, :favorite_teams, :quotes, :relationship, :relationship_status, :religion, :significant_other, :video_upload_limits, :website, :work
49
+ @@attributes = {
50
+ :raw => [
51
+ :name, :first_name, :middle_name, :last_name, :gender,
52
+ :locale, :link, :username, :third_party_id, :timezone,
53
+ :verified, :about, :bio, :email, :political, :quotes,
54
+ :relationship_status, :relationship, :video_upload_limits,
55
+ :website, :mobile_phone, :installed, :rsvp_status,
56
+ :security_settings, :currency, :religion
57
+ ],
58
+ :custom => [
59
+ :languages, :like_count, :updated_time,
60
+ :birthday, :education, :hometown, :interested_in, :location,
61
+ :favorite_teams, :age_range, :significant_other,
62
+ :work, :devices, :sports, :favorite_athletes, :inspirational_people,
63
+ :address, :mobile_phone
64
+ ]
65
+ }
50
66
 
51
- # NOTE: below are non-documented
52
- attr_accessor :sports, :favorite_athletes, :inspirational_people, :address, :mobile_phone, :installed, :rsvp_status
67
+ attr_accessor *@@attributes.values.flatten
53
68
 
54
69
  def initialize(identifier, attributes = {})
55
70
  super
56
- @name = attributes[:name]
57
- @first_name = attributes[:first_name]
58
- @middle_name = attributes[:middle_name]
59
- @last_name = attributes[:last_name]
60
- @gender = attributes[:gender]
61
- @locale = attributes[:locale]
71
+ @@attributes[:raw].each do |key|
72
+ self.send :"#{key}=", attributes[key]
73
+ end
62
74
  @languages = []
63
75
  if attributes[:languages]
64
76
  attributes[:languages].each do |language|
65
77
  @languages << Page.new(language[:id], language)
66
78
  end
67
79
  end
68
- @link = attributes[:link]
69
- @username = attributes[:username]
70
- @third_party_id = attributes[:third_party_id]
71
- @timezone = attributes[:timezone]
72
80
  if attributes[:updated_time]
73
81
  @updated_time = Time.parse(attributes[:updated_time]).utc
74
82
  end
75
- @verified = attributes[:verified]
76
- @about = attributes[:about]
77
- @bio = attributes[:bio]
78
83
  if attributes[:birthday]
79
84
  month, day, year = attributes[:birthday].split('/').collect(&:to_i)
80
85
  year ||= 0
@@ -86,7 +91,6 @@ module FbGraph
86
91
  @education << Education.new(education)
87
92
  end
88
93
  end
89
- @email = attributes[:email]
90
94
  if (hometown = attributes[:hometown])
91
95
  @hometown = Page.new(hometown[:id], hometown)
92
96
  end
@@ -94,32 +98,31 @@ module FbGraph
94
98
  if (location = attributes[:location])
95
99
  @location = Page.new(location[:id], location)
96
100
  end
97
- @political = attributes[:political]
98
101
  @favorite_teams = []
99
102
  if attributes[:favorite_teams]
100
103
  attributes[:favorite_teams].each do |favorite_team|
101
104
  @favorite_teams << Page.new(favorite_team[:id], favorite_team)
102
105
  end
103
106
  end
104
- @quotes = attributes[:quotes]
105
- @relationship_status = attributes[:relationship_status]
106
- @religion = attributes[:religion]
107
107
  if (significant_other = attributes[:significant_other])
108
108
  @significant_other = User.new(significant_other[:id], significant_other)
109
109
  end
110
- # If this user was build from the family connection, set the relationship type
111
- @relationship = attributes[:relationship]
112
- # NOTE: couldn't find "video_upload_limits" in the response..
113
- # @video_upload_limits = ??
114
- @website = attributes[:website]
115
110
  @work = []
116
111
  if attributes[:work]
117
112
  attributes[:work].each do |work|
118
113
  @work << Work.new(work)
119
114
  end
120
115
  end
121
-
122
- # NOTE: below are non-documented
116
+ @devices = []
117
+ if attributes[:devices]
118
+ attributes[:devices].each do |device|
119
+ @devices << Device.new(device)
120
+ end
121
+ end
122
+ @security_settings = attributes[:security_settings]
123
+ if attributes[:age_range]
124
+ @age_range = AgeRange.new(attributes[:age_range])
125
+ end
123
126
  @sports = []
124
127
  if (sports = attributes[:sports])
125
128
  sports.each do |sport|
@@ -141,14 +144,10 @@ module FbGraph
141
144
  if attributes[:address]
142
145
  @address = Venue.new(attributes[:address])
143
146
  end
144
- @mobile_phone = attributes[:mobile_phone]
145
- @installed = attributes[:installed]
146
- @rsvp_status = attributes[:rsvp_status]
147
147
  end
148
148
 
149
149
  def self.me(access_token)
150
150
  new('me', :access_token => access_token)
151
151
  end
152
-
153
152
  end
154
153
  end
data/lib/fb_graph.rb CHANGED
@@ -67,6 +67,8 @@ require 'fb_graph/connections'
67
67
  require 'fb_graph/searchable'
68
68
 
69
69
  require 'fb_graph/action'
70
+ require 'fb_graph/age_range'
71
+ require 'fb_graph/device'
70
72
  require 'fb_graph/education'
71
73
  require 'fb_graph/location'
72
74
  require 'fb_graph/picture'
@@ -5,7 +5,7 @@ describe FbGraph::OpenGraph::Action do
5
5
  FbGraph::OpenGraph::Action.new attributes[:id], attributes
6
6
  end
7
7
  let :attributes do
8
- MultiJson::load(json).with_indifferent_access
8
+ MultiJson.load(json).with_indifferent_access
9
9
  end
10
10
  shared_examples_for :og_action_initialized do
11
11
  its(:from) do
@@ -5,7 +5,7 @@ describe FbGraph::OpenGraph::Object do
5
5
  FbGraph::OpenGraph::Object.new attributes[:id], attributes
6
6
  end
7
7
  let :attributes do
8
- MultiJson::load(json).with_indifferent_access
8
+ MultiJson.load(json).with_indifferent_access
9
9
  end
10
10
 
11
11
  context 'with play action' do
@@ -51,7 +51,7 @@ describe FbGraph::Page do
51
51
  context 'when access_token field fetched' do
52
52
  subject do
53
53
  mock_graph :get, 'my_page', 'pages/with_token', :access_token => 'user_token', :params => {
54
- :fields => :access_token
54
+ :fields => 'access_token'
55
55
  } do
56
56
  FbGraph::Page.fetch('my_page', :fields => :access_token, :access_token => 'user_token')
57
57
  end
@@ -59,4 +59,23 @@ describe FbGraph::Page do
59
59
  its(:access_token) { should == 'page_token' }
60
60
  end
61
61
  end
62
+
63
+ describe '#get_access_token' do
64
+ it 'should specify fields=access_token' do
65
+ expect do
66
+ FbGraph::Page.new('FbGraph').page_access_token
67
+ end.to request_to 'FbGraph?fields=access_token', :GET
68
+ end
69
+
70
+ it 'should return Rack::OAuth2::AccessToken::Legacy' do
71
+ mock_graph :get, 'page_id', 'pages/with_token', :access_token => 'user_token', :params => {
72
+ :fields => 'access_token'
73
+ } do
74
+ page = FbGraph::Page.new('page_id', :access_token => 'user_token')
75
+ page_token = page.get_access_token
76
+ page_token.should be_instance_of Rack::OAuth2::AccessToken::Legacy
77
+ page.access_token.should == page_token
78
+ end
79
+ end
80
+ end
62
81
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe FbGraph::TaggedObject do
4
4
  let :attributes do
5
- MultiJson::load(json).with_indifferent_access
5
+ MultiJson.load(json).with_indifferent_access
6
6
  end
7
7
  let :json do
8
8
  <<-JSON
@@ -25,7 +25,7 @@ describe FbGraph::Targeting, '.to_json' do
25
25
  :region => 'Tokyo'
26
26
  }
27
27
  targeting = FbGraph::Targeting.new(attributes)
28
- hash = MultiJson::load(targeting.to_json).with_indifferent_access
28
+ hash = MultiJson.load(targeting.to_json).with_indifferent_access
29
29
  hash[:country].should == attributes[:country]
30
30
  hash[:city].should == attributes[:city]
31
31
  hash[:locale].should == attributes[:locale]
@@ -1,150 +1,184 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe FbGraph::User, '.new' do
4
- it 'should setup all supported attributes' do
5
- attributes = {
6
- :id => '12345',
7
- :address => {
8
- :city => "Kawasaki",
9
- :state => "Kanagawa",
10
- :country => "Japan"
11
- },
12
- :mobile_phone => '810000000000',
13
- :installed => true
14
- }
15
- user = FbGraph::User.new(attributes.delete(:id), attributes)
16
- user.address.should == FbGraph::Venue.new(attributes[:address])
17
- user.mobile_phone.should == '810000000000'
18
- user.installed.should be_true
19
- end
3
+ describe FbGraph::User do
4
+ describe '.new' do
5
+ it 'should setup all supported attributes' do
6
+ attributes = {
7
+ :id => '12345',
8
+ :address => {
9
+ :city => "Kawasaki",
10
+ :state => "Kanagawa",
11
+ :country => "Japan"
12
+ },
13
+ :mobile_phone => '810000000000',
14
+ :installed => true
15
+ }
16
+ user = FbGraph::User.new(attributes.delete(:id), attributes)
17
+ user.address.should == FbGraph::Venue.new(attributes[:address])
18
+ user.mobile_phone.should == '810000000000'
19
+ user.installed.should be_true
20
+ end
21
+
22
+ it 'should support year-hidden birthday' do
23
+ user = FbGraph::User.new(12345, :birthday => '12/13')
24
+ user.birthday.year.should == 0
25
+ user.birthday.month.should == 12
26
+ user.birthday.day.should == 13
27
+ end
28
+
29
+ it 'should support non-default fields' do
30
+ mock_graph :get, 'me', 'users/with_non_default_fields', :access_token => 'access_token', :params => {
31
+ :fields => 'devices, video_upload_limits, age_range, currency'
32
+ } do
33
+ me = FbGraph::User.me('access_token').fetch(:fields => 'devices, video_upload_limits, age_range, currency')
34
+
35
+ # devices
36
+ me.devices.should be_instance_of Array
37
+ me.devices.each do |device|
38
+ device.should be_instance_of FbGraph::Device
39
+ end
40
+ me.devices.should == [FbGraph::Device.new(:os => 'iOS', :hardware => 'iPhone')]
20
41
 
21
- it 'should support year-hidden birthday' do
22
- user = FbGraph::User.new(12345, :birthday => '12/13')
23
- user.birthday.year.should == 0
24
- user.birthday.month.should == 12
25
- user.birthday.day.should == 13
42
+ # video_upload_limits
43
+ me.video_upload_limits.should be_instance_of ActiveSupport::HashWithIndifferentAccess
44
+ me.video_upload_limits.should == {'length' => 1200, 'size' => 1073741824}
45
+
46
+ # age_range
47
+ me.age_range.should be_instance_of FbGraph::AgeRange
48
+ me.age_range.should == (21..FbGraph::AgeRange::DEFAULT_MAX_AGE)
49
+
50
+ # currency
51
+ me.currency.should be_instance_of ActiveSupport::HashWithIndifferentAccess
52
+ me.currency.should == {
53
+ 'user_currency' => 'JPY',
54
+ 'currency_exchange' => 0.10846341,
55
+ 'currency_exchange_inverse' => 9.2196990672,
56
+ 'currency_offset' => 1
57
+ }
58
+ end
59
+ end
26
60
  end
27
- end
28
61
 
29
- describe FbGraph::User, '.me' do
30
- it 'should return FbGraph::User instance with access_token' do
31
- FbGraph::User.me('access_token').should == FbGraph::User.new('me', :access_token => 'access_token')
62
+ describe '.me' do
63
+ it 'should return FbGraph::User instance with access_token' do
64
+ FbGraph::User.me('access_token').should == FbGraph::User.new('me', :access_token => 'access_token')
65
+ end
32
66
  end
33
- end
34
67
 
35
- describe FbGraph::User, '.fetch' do
36
- context 'with me context' do
68
+ describe '.fetch' do
69
+ context 'with me context' do
37
70
 
38
- context 'when no access_token given' do
39
- it 'should raise FbGraph::Unauthorized' do
40
- mock_graph :get, 'me', 'users/me_public', :status => [401, 'Unauthorized'] do
41
- lambda do
42
- FbGraph::User.fetch('me')
43
- end.should raise_exception(FbGraph::Unauthorized)
71
+ context 'when no access_token given' do
72
+ it 'should raise FbGraph::Unauthorized' do
73
+ mock_graph :get, 'me', 'users/me_public', :status => [401, 'Unauthorized'] do
74
+ lambda do
75
+ FbGraph::User.fetch('me')
76
+ end.should raise_exception(FbGraph::Unauthorized)
77
+ end
44
78
  end
45
79
  end
46
- end
47
80
 
48
- context 'when access_token given' do
49
- it 'should get current user profile' do
50
- mock_graph :get, 'me', 'users/me_private', :access_token => 'access_token' do
51
- user = FbGraph::User.me('access_token').fetch
52
- user.interested_in.should == ['female']
53
- user.relationship_status.should == 'Married'
54
- user.website.should == 'http://matake.jp'
55
- user.religion.should be_nil
56
- user.political.should be_nil
57
- user.timezone.should == 9
58
- user.verified.should be_true
81
+ context 'when access_token given' do
82
+ it 'should get current user profile' do
83
+ mock_graph :get, 'me', 'users/me_private', :access_token => 'access_token' do
84
+ user = FbGraph::User.me('access_token').fetch
85
+ user.interested_in.should == ['female']
86
+ user.relationship_status.should == 'Married'
87
+ user.website.should == 'http://matake.jp'
88
+ user.religion.should be_nil
89
+ user.political.should be_nil
90
+ user.timezone.should == 9
91
+ user.verified.should be_true
92
+ end
59
93
  end
60
94
  end
61
- end
62
95
 
63
- end
96
+ end
64
97
 
65
- context 'when no access_token given' do
66
- it 'should get only public profile' do
67
- mock_graph :get, 'arjun', 'users/arjun_public' do
68
- user = FbGraph::User.fetch('arjun')
69
- user.name.should == 'Arjun Banker'
70
- user.first_name.should == 'Arjun'
71
- user.last_name.should == 'Banker'
72
- user.identifier.should == '7901103'
73
- user.link.should == 'http://www.facebook.com/Arjun'
74
- user.location.should == FbGraph::Page.new(114952118516947, :name => 'San Francisco, California')
75
- user.gender.should == 'male'
98
+ context 'when no access_token given' do
99
+ it 'should get only public profile' do
100
+ mock_graph :get, 'arjun', 'users/arjun_public' do
101
+ user = FbGraph::User.fetch('arjun')
102
+ user.name.should == 'Arjun Banker'
103
+ user.first_name.should == 'Arjun'
104
+ user.last_name.should == 'Banker'
105
+ user.identifier.should == '7901103'
106
+ user.link.should == 'http://www.facebook.com/Arjun'
107
+ user.location.should == FbGraph::Page.new(114952118516947, :name => 'San Francisco, California')
108
+ user.gender.should == 'male'
109
+ end
76
110
  end
77
111
  end
78
- end
79
112
 
80
- context 'when access_token given' do
81
- it 'should get public + private profile' do
82
- mock_graph :get, 'arjun', 'users/arjun_private', :access_token => 'access_token' do
83
- user = FbGraph::User.fetch('arjun', :access_token => 'access_token')
84
-
85
- # public
86
- user.name.should == 'Arjun Banker'
87
- user.first_name.should == 'Arjun'
88
- user.last_name.should == 'Banker'
89
- user.identifier.should == '7901103'
90
- user.link.should == 'http://www.facebook.com/Arjun'
91
- user.location.should == FbGraph::Page.new(114952118516947, :name => 'San Francisco, California')
92
- user.gender.should == 'male'
93
-
94
- # private
95
- user.about.should == 'daydrea'
96
- user.birthday.should == Date.strptime("04/15/1984", "%m/%d/%Y")
97
- user.work.should == [
98
- FbGraph::Work.new({
99
- :employer => {:name => 'Facebook', :id => 20531316728},
100
- :position => {:name => 'Software Engineer', :id => 107879555911138},
101
- :location => {:name => 'Palo Alto, California', :id => 104022926303756},
102
- :start_date => '2007-11'
103
- }),
104
- FbGraph::Work.new({
105
- :employer => {:name => 'Zillow', :id => 113816405300191},
106
- :position => {:name => 'Business Intelligence Analyst', :id => 105918922782444},
107
- :start_date => '2006-03',
108
- :end_date => '2007-10'
109
- }),
110
- FbGraph::Work.new({
111
- :employer => {:name => 'Microsoft', :id => 20528438720},
112
- :position => {:name => 'SDET', :id => 110006949022640},
113
- :start_date => '2004-08',
114
- :end_date => '2006-03'
115
- }),
116
- FbGraph::Work.new({
117
- :employer => {:name => 'Dell', :id => 7706457055},
118
- :position => {:name => 'Programmer Analyst', :id => 110344568993267},
119
- :start_date => '2003-06',
120
- :end_date => '2004-07'
121
- })
122
- ]
123
- user.education.should == [
124
- FbGraph::Education.new({
125
- :school => {:name => 'Texas Academy Of Math And Science', :id => 107922345906866},
126
- :year => {:name => '2001', :id => 102241906483610}
127
- }),
128
- FbGraph::Education.new({
129
- :school => {:name => 'The University of Texas at Austin', :id => 24147741537},
130
- :year => {:name => '2003', :id => 108077232558120},
131
- :concentration => [
132
- {:name => 'Computer Science', :id => 116831821660155}
133
- ]
134
- })
135
- ]
136
- user.email.should == nil
137
- user.website.should == nil
138
- user.hometown.should == FbGraph::Page.new(109533479072558, :name => 'Minnetonka, Minnesota')
139
- user.interested_in.should == ['female']
140
- user.relationship_status.should == 'In a Relationship'
141
- user.religion.should == 'zorp'
142
- user.political.should == 'Liberal'
143
- user.verified.should be_nil
144
- # What's this?
145
- # user.significant_other
146
- user.timezone.should be_nil
147
- user.updated_time.should == Time.parse('2010-05-29T04:29:23+0000')
113
+ context 'when access_token given' do
114
+ it 'should get public + private profile' do
115
+ mock_graph :get, 'arjun', 'users/arjun_private', :access_token => 'access_token' do
116
+ user = FbGraph::User.fetch('arjun', :access_token => 'access_token')
117
+
118
+ # public
119
+ user.name.should == 'Arjun Banker'
120
+ user.first_name.should == 'Arjun'
121
+ user.last_name.should == 'Banker'
122
+ user.identifier.should == '7901103'
123
+ user.link.should == 'http://www.facebook.com/Arjun'
124
+ user.location.should == FbGraph::Page.new(114952118516947, :name => 'San Francisco, California')
125
+ user.gender.should == 'male'
126
+
127
+ # private
128
+ user.about.should == 'daydrea'
129
+ user.birthday.should == Date.strptime("04/15/1984", "%m/%d/%Y")
130
+ user.work.should == [
131
+ FbGraph::Work.new({
132
+ :employer => {:name => 'Facebook', :id => 20531316728},
133
+ :position => {:name => 'Software Engineer', :id => 107879555911138},
134
+ :location => {:name => 'Palo Alto, California', :id => 104022926303756},
135
+ :start_date => '2007-11'
136
+ }),
137
+ FbGraph::Work.new({
138
+ :employer => {:name => 'Zillow', :id => 113816405300191},
139
+ :position => {:name => 'Business Intelligence Analyst', :id => 105918922782444},
140
+ :start_date => '2006-03',
141
+ :end_date => '2007-10'
142
+ }),
143
+ FbGraph::Work.new({
144
+ :employer => {:name => 'Microsoft', :id => 20528438720},
145
+ :position => {:name => 'SDET', :id => 110006949022640},
146
+ :start_date => '2004-08',
147
+ :end_date => '2006-03'
148
+ }),
149
+ FbGraph::Work.new({
150
+ :employer => {:name => 'Dell', :id => 7706457055},
151
+ :position => {:name => 'Programmer Analyst', :id => 110344568993267},
152
+ :start_date => '2003-06',
153
+ :end_date => '2004-07'
154
+ })
155
+ ]
156
+ user.education.should == [
157
+ FbGraph::Education.new({
158
+ :school => {:name => 'Texas Academy Of Math And Science', :id => 107922345906866},
159
+ :year => {:name => '2001', :id => 102241906483610}
160
+ }),
161
+ FbGraph::Education.new({
162
+ :school => {:name => 'The University of Texas at Austin', :id => 24147741537},
163
+ :year => {:name => '2003', :id => 108077232558120},
164
+ :concentration => [
165
+ {:name => 'Computer Science', :id => 116831821660155}
166
+ ]
167
+ })
168
+ ]
169
+ user.email.should == nil
170
+ user.website.should == nil
171
+ user.hometown.should == FbGraph::Page.new(109533479072558, :name => 'Minnetonka, Minnesota')
172
+ user.interested_in.should == ['female']
173
+ user.relationship_status.should == 'In a Relationship'
174
+ user.religion.should == 'zorp'
175
+ user.political.should == 'Liberal'
176
+ user.verified.should be_nil
177
+ # What's this?
178
+ # user.significant_other
179
+ user.timezone.should be_nil
180
+ user.updated_time.should == Time.parse('2010-05-29T04:29:23+0000')
181
+ end
148
182
  end
149
183
  end
150
184
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.2
4
+ version: 2.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-16 00:00:00.000000000 Z
12
+ date: 2013-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httpclient
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ! '>='
132
132
  - !ruby/object:Gem::Version
133
- version: '0'
133
+ version: 0.1.0
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  requirements:
139
139
  - - ! '>='
140
140
  - !ruby/object:Gem::Version
141
- version: '0'
141
+ version: 0.1.0
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: actionpack
144
144
  requirement: !ruby/object:Gem::Requirement
@@ -191,6 +191,7 @@ files:
191
191
  - lib/fb_graph/ad_keyword_valid.rb
192
192
  - lib/fb_graph/ad_preview.rb
193
193
  - lib/fb_graph/ad_user.rb
194
+ - lib/fb_graph/age_range.rb
194
195
  - lib/fb_graph/album.rb
195
196
  - lib/fb_graph/app_request.rb
196
197
  - lib/fb_graph/application.rb
@@ -288,6 +289,7 @@ files:
288
289
  - lib/fb_graph/connections/votes.rb
289
290
  - lib/fb_graph/cover.rb
290
291
  - lib/fb_graph/debugger.rb
292
+ - lib/fb_graph/device.rb
291
293
  - lib/fb_graph/doc.rb
292
294
  - lib/fb_graph/domain.rb
293
295
  - lib/fb_graph/education.rb
@@ -522,7 +524,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
522
524
  version: '0'
523
525
  segments:
524
526
  - 0
525
- hash: 89501817370489109
527
+ hash: 1720782367254273780
526
528
  required_rubygems_version: !ruby/object:Gem::Requirement
527
529
  none: false
528
530
  requirements:
@@ -531,7 +533,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
531
533
  version: '0'
532
534
  segments:
533
535
  - 0
534
- hash: 89501817370489109
536
+ hash: 1720782367254273780
535
537
  requirements: []
536
538
  rubyforge_project:
537
539
  rubygems_version: 1.8.24