fb_graph 0.0.3 → 0.0.4

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.
Files changed (36) hide show
  1. data/README.rdoc +56 -16
  2. data/Rakefile +2 -2
  3. data/VERSION +1 -1
  4. data/fb_graph.gemspec +6 -4
  5. data/lib/fb_graph/collection.rb +1 -1
  6. data/lib/fb_graph/node.rb +10 -5
  7. data/lib/fb_graph/user.rb +2 -2
  8. data/lib/fb_graph.rb +1 -1
  9. data/spec/fake_json/pages/statuses/platform_private.json +2 -2
  10. data/spec/fake_json/users/albums/matake_private.json +2 -2
  11. data/spec/fake_json/users/events/matake_private.json +2 -2
  12. data/spec/fake_json/users/feed/arjun_private.json +2 -2
  13. data/spec/fake_json/users/home/me_private.json +2 -2
  14. data/spec/fake_json/users/home/me_private_next.json +2 -2
  15. data/spec/fake_json/users/home/me_private_previous.json +2 -2
  16. data/spec/fake_json/users/me_private.json +23 -0
  17. data/spec/fake_json/users/me_public.json +6 -0
  18. data/spec/fake_json/users/posts/arjun_private.json +2 -2
  19. data/spec/fake_json/users/statuses/arjun_private.json +2 -2
  20. data/spec/fake_json/users/tagged/arjun_private.json +2 -2
  21. data/spec/fb_graph/collection_spec.rb +6 -6
  22. data/spec/fb_graph/connections/activities_spec.rb +3 -3
  23. data/spec/fb_graph/connections/albums_spec.rb +3 -3
  24. data/spec/fb_graph/connections/events_spec.rb +4 -4
  25. data/spec/fb_graph/connections/feed_spec.rb +2 -2
  26. data/spec/fb_graph/connections/friends_spec.rb +7 -7
  27. data/spec/fb_graph/connections/groups_spec.rb +4 -4
  28. data/spec/fb_graph/connections/home_spec.rb +7 -7
  29. data/spec/fb_graph/connections/likes_spec.rb +3 -3
  30. data/spec/fb_graph/connections/posts_spec.rb +2 -2
  31. data/spec/fb_graph/connections/statuses_spec.rb +6 -6
  32. data/spec/fb_graph/connections/tagged_spec.rb +2 -2
  33. data/spec/fb_graph/node_spec.rb +2 -2
  34. data/spec/fb_graph/page_spec.rb +3 -3
  35. data/spec/fb_graph/user_spec.rb +6 -6
  36. metadata +7 -5
data/README.rdoc CHANGED
@@ -3,28 +3,68 @@
3
3
  A Ruby wrapper for Facebook Graph API.
4
4
  This is a work in progress.
5
5
 
6
+ == Installation
7
+
8
+ gem install fb_graph
9
+
10
+ == Resources
11
+
12
+ * View Source on GitHub (http://github.com/nov/fb_graph)
13
+ * View RDoc on GitHub (http://nov.github.com/fb_graph)
14
+ * Report Issues on GitHub (http://github.com/nov/fb_graph/issues)
15
+
6
16
  == Examples
7
17
 
8
- # Basic Objects
9
- user = FbGraph::User.fetch('matake')
10
- user.name # => 'Nov Matake'
11
- user.picture # => 'https://graph.facebook.com/matake/picture'
18
+ Now FbGraph supports all objects listed here: http://developers.facebook.com/docs/reference/api/
19
+ Almost all connections for each object are also supported. (Private message connections are not supported yet)
20
+
21
+ === Basic Objects
22
+
23
+ user = FbGraph::User.fetch('matake')
24
+ user.name # => 'Nov Matake'
25
+ user.picture # => 'https://graph.facebook.com/matake/picture'
26
+
27
+ # User.new doesn't fetch the user's profile info
28
+ me = User.new('me', :access_token => YOUR_ACCESS_TOKEN)
29
+
30
+ page = FbGraph::Page.fetch('smartfmteam')
31
+ page.name # => 'smart.fm'
32
+ page.picture # => 'https://graph.facebook.com/smart.fm/picture'
33
+
34
+ :
12
35
 
13
- page = FbGraph::Page.fetch('smartfmteam')
14
- page.name # => 'smart.fm'
15
- page.picture # => 'https://graph.facebook.com/smart.fm/picture'
36
+ === Connections
16
37
 
17
- :
18
- :
38
+ # Public connections
39
+ user = FbGraph::User.fetch('matake')
40
+ user.feed
41
+ user.posts
42
+ user.friends
43
+ user.tagged
44
+ :
45
+
46
+ # Private connections requires "access_token"
47
+ FbGraph::User.new('matake').friends # => raise FbGraph::Unauthorized
48
+ user = FbGraph::User.fetch('matake', :access_token => ACCESS_TOKEN)
49
+ user.albums
50
+ user.events
51
+ user.friends
52
+ user.likes
53
+ :
54
+
55
+ # "home" connection is only available for "me"
56
+ me = User.new('me', :access_token => ACCESS_TOKEN)
57
+ me.home
58
+ :
19
59
 
20
- # Connections
21
- likes = user.likes # => Array of FbGraph::Like
22
- likes.next # => {:limit => 25, :until => '...'}
23
- likes.previous # => {:limit => 25, :since => '...'}
60
+ === Pagination
24
61
 
25
- # Pagination
26
- user.likes(likes.next) # => Array of FbGraph::Like
27
- user.likes(likes.previous) # => Array of FbGraph::Like
62
+ user = FbGraph::User.new('matake', :access_token => ACCESS_TOKEN)
63
+ likes = user.likes # => Array of FbGraph::Like
64
+ likes.next # => {:limit => 25, :until => '...'}
65
+ likes.previous # => {:limit => 25, :since => '...'}
66
+ user.likes(likes.next) # => Array of FbGraph::Like
67
+ user.likes(likes.previous) # => Array of FbGraph::Like
28
68
 
29
69
  == Note on Patches/Pull Requests
30
70
 
data/Rakefile CHANGED
@@ -5,8 +5,8 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = 'fb_graph'
8
- gem.summary = %Q{Facebook Graph API library for Ruby}
9
- gem.description = %Q{Facebook Graph API library for Ruby}
8
+ gem.summary = %Q{A Ruby wrapper for Facebook Graph API}
9
+ gem.description = %Q{A Ruby wrapper for Facebook Graph API}
10
10
  gem.email = 'nov@matake.jp'
11
11
  gem.homepage = 'http://github.com/nov/fb_graph'
12
12
  gem.authors = ['nov matake']
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/fb_graph.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fb_graph}
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["nov matake"]
12
- s.date = %q{2010-04-27}
13
- s.description = %q{Facebook Graph API library for Ruby}
12
+ s.date = %q{2010-04-29}
13
+ s.description = %q{A Ruby wrapper for Facebook Graph API}
14
14
  s.email = %q{nov@matake.jp}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
@@ -99,6 +99,8 @@ Gem::Specification.new do |s|
99
99
  "spec/fake_json/users/home/me_public.json",
100
100
  "spec/fake_json/users/likes/arjun_private.json",
101
101
  "spec/fake_json/users/likes/arjun_public.json",
102
+ "spec/fake_json/users/me_private.json",
103
+ "spec/fake_json/users/me_public.json",
102
104
  "spec/fake_json/users/posts/arjun_private.json",
103
105
  "spec/fake_json/users/posts/arjun_public.json",
104
106
  "spec/fake_json/users/statuses/arjun_private.json",
@@ -139,7 +141,7 @@ Gem::Specification.new do |s|
139
141
  s.rdoc_options = ["--charset=UTF-8"]
140
142
  s.require_paths = ["lib"]
141
143
  s.rubygems_version = %q{1.3.6}
142
- s.summary = %q{Facebook Graph API library for Ruby}
144
+ s.summary = %q{A Ruby wrapper for Facebook Graph API}
143
145
  s.test_files = [
144
146
  "spec/fb_graph/album_spec.rb",
145
147
  "spec/fb_graph/collection_spec.rb",
@@ -25,7 +25,7 @@ module FbGraph
25
25
  params[key] = URI.unescape(value)
26
26
  end
27
27
  params.delete_if do |k, v|
28
- k == 'token'
28
+ k == 'access_token'
29
29
  end
30
30
  end
31
31
  end
data/lib/fb_graph/node.rb CHANGED
@@ -2,12 +2,17 @@ module FbGraph
2
2
  class Node
3
3
  include FbGraph::Comparison
4
4
 
5
- attr_accessor :identifier, :endpoint, :token
5
+ attr_accessor :identifier, :endpoint, :access_token
6
6
 
7
7
  def initialize(identifier, options = {})
8
- @identifier = identifier
9
- @endpoint = File.join(FbGraph::ROOT_URL, identifier)
10
- @token = options[:token]
8
+ @identifier = identifier
9
+ @endpoint = File.join(FbGraph::ROOT_URL, identifier.to_s)
10
+ @access_token = options[:access_token]
11
+ end
12
+
13
+ def fetch(options = {})
14
+ options[:access_token] ||= self.access_token if self.access_token
15
+ self.class.fetch(self.identifier, options)
11
16
  end
12
17
 
13
18
  def self.fetch(identifier, options = {})
@@ -30,7 +35,7 @@ module FbGraph
30
35
  else
31
36
  self.endpoint
32
37
  end
33
- options[:token] ||= self.token
38
+ options[:access_token] ||= self.access_token
34
39
  _options_ = options.reject do |k, v|
35
40
  v.blank?
36
41
  end
data/lib/fb_graph/user.rb CHANGED
@@ -43,8 +43,8 @@ module FbGraph
43
43
  @website = options[:website]
44
44
  end
45
45
 
46
- def self.me(token)
47
- new('me', :token => token)
46
+ def self.me(access_token)
47
+ new('me', :access_token => access_token)
48
48
  end
49
49
 
50
50
  end
data/lib/fb_graph.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'json'
3
3
  require 'active_support'
4
- require 'rest_client'
4
+ require 'restclient'
5
5
 
6
6
  module FbGraph
7
7
  ROOT_URL = "https://graph.facebook.com"
@@ -252,7 +252,7 @@
252
252
  }
253
253
  ],
254
254
  "paging": {
255
- "previous": "https://graph.facebook.com/19292868552/statuses?token=2227470867%7C2.WYzVDx_3poIwJP1QNQ2vwg__.3600.1272117600-579612276%7CvNhS2UE8VCENmslKMACDszaJrDw.&limit=25&since=2010-04-21T20%3A17%3A04%2B0000",
256
- "next": "https://graph.facebook.com/19292868552/statuses?token=2227470867%7C2.WYzVDx_3poIwJP1QNQ2vwg__.3600.1272117600-579612276%7CvNhS2UE8VCENmslKMACDszaJrDw.&limit=25&until=2009-03-06T22%3A56%3A36%2B0000"
255
+ "previous": "https://graph.facebook.com/19292868552/statuses?access_token=2227470867%7C2.WYzVDx_3poIwJP1QNQ2vwg__.3600.1272117600-579612276%7CvNhS2UE8VCENmslKMACDszaJrDw.&limit=25&since=2010-04-21T20%3A17%3A04%2B0000",
256
+ "next": "https://graph.facebook.com/19292868552/statuses?access_token=2227470867%7C2.WYzVDx_3poIwJP1QNQ2vwg__.3600.1272117600-579612276%7CvNhS2UE8VCENmslKMACDszaJrDw.&limit=25&until=2009-03-06T22%3A56%3A36%2B0000"
257
257
  }
258
258
  }
@@ -28,7 +28,7 @@
28
28
  }
29
29
  ],
30
30
  "paging": {
31
- "previous": "https://graph.facebook.com/579612276/albums?token=2227470867%7C2.R9XAeEGAiuhhRCcZAgJzTA__.3600.1272362400-579612276%7ChajPs3sLZ2opsOA9TSEGEq-lBrE.&limit=25&since=2008-07-27T11%3A38%3A15%2B0000",
32
- "next": "https://graph.facebook.com/579612276/albums?token=2227470867%7C2.R9XAeEGAiuhhRCcZAgJzTA__.3600.1272362400-579612276%7ChajPs3sLZ2opsOA9TSEGEq-lBrE.&limit=25&until=2007-11-29T08%3A29%3A10%2B0000"
31
+ "previous": "https://graph.facebook.com/579612276/albums?access_token=2227470867%7C2.R9XAeEGAiuhhRCcZAgJzTA__.3600.1272362400-579612276%7ChajPs3sLZ2opsOA9TSEGEq-lBrE.&limit=25&since=2008-07-27T11%3A38%3A15%2B0000",
32
+ "next": "https://graph.facebook.com/579612276/albums?access_token=2227470867%7C2.R9XAeEGAiuhhRCcZAgJzTA__.3600.1272362400-579612276%7ChajPs3sLZ2opsOA9TSEGEq-lBrE.&limit=25&until=2007-11-29T08%3A29%3A10%2B0000"
33
33
  }
34
34
  }
@@ -65,7 +65,7 @@
65
65
  }
66
66
  ],
67
67
  "paging": {
68
- "previous": "https://graph.facebook.com/579612276/events?token=2227470867%7C2.R9XAeEGAiuhhRCcZAgJzTA__.3600.1272362400-579612276%7ChajPs3sLZ2opsOA9TSEGEq-lBrE.&limit=25&since=2010-04-29T01%3A30%3A00%2B0000",
69
- "next": "https://graph.facebook.com/579612276/events?token=2227470867%7C2.R9XAeEGAiuhhRCcZAgJzTA__.3600.1272362400-579612276%7ChajPs3sLZ2opsOA9TSEGEq-lBrE.&limit=25&until=2009-02-10T03%3A00%3A00%2B0000"
68
+ "previous": "https://graph.facebook.com/579612276/events?access_token=2227470867%7C2.R9XAeEGAiuhhRCcZAgJzTA__.3600.1272362400-579612276%7ChajPs3sLZ2opsOA9TSEGEq-lBrE.&limit=25&since=2010-04-29T01%3A30%3A00%2B0000",
69
+ "next": "https://graph.facebook.com/579612276/events?access_token=2227470867%7C2.R9XAeEGAiuhhRCcZAgJzTA__.3600.1272362400-579612276%7ChajPs3sLZ2opsOA9TSEGEq-lBrE.&limit=25&until=2009-02-10T03%3A00%3A00%2B0000"
70
70
  }
71
71
  }
@@ -514,7 +514,7 @@
514
514
  }
515
515
  ],
516
516
  "paging": {
517
- "previous": "https://graph.facebook.com/7901103/feed?token=2227470867%7C2.__B0IPz9qb93HHVcclZX4w__.3600.1272272400-579612276%7CbBfZwiaEZrdEnI6kOODPTy576PQ.&limit=25&since=2010-04-25T04%3A05%3A32%2B0000",
518
- "next": "https://graph.facebook.com/7901103/feed?token=2227470867%7C2.__B0IPz9qb93HHVcclZX4w__.3600.1272272400-579612276%7CbBfZwiaEZrdEnI6kOODPTy576PQ.&limit=25&until=2010-04-21T07%3A55%3A49%2B0000"
517
+ "previous": "https://graph.facebook.com/7901103/feed?access_token=2227470867%7C2.__B0IPz9qb93HHVcclZX4w__.3600.1272272400-579612276%7CbBfZwiaEZrdEnI6kOODPTy576PQ.&limit=25&since=2010-04-25T04%3A05%3A32%2B0000",
518
+ "next": "https://graph.facebook.com/7901103/feed?access_token=2227470867%7C2.__B0IPz9qb93HHVcclZX4w__.3600.1272272400-579612276%7CbBfZwiaEZrdEnI6kOODPTy576PQ.&limit=25&until=2010-04-21T07%3A55%3A49%2B0000"
519
519
  }
520
520
  }
@@ -454,7 +454,7 @@
454
454
  }
455
455
  ],
456
456
  "paging": {
457
- "previous": "https://graph.facebook.com/579612276/home?token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&since=2010-04-27T13%3A06%3A14%2B0000",
458
- "next": "https://graph.facebook.com/579612276/home?token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&until=2010-04-27T11%3A07%3A48%2B0000"
457
+ "previous": "https://graph.facebook.com/579612276/home?access_token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&since=2010-04-27T13%3A06%3A14%2B0000",
458
+ "next": "https://graph.facebook.com/579612276/home?access_token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&until=2010-04-27T11%3A07%3A48%2B0000"
459
459
  }
460
460
  }
@@ -376,7 +376,7 @@
376
376
  }
377
377
  ],
378
378
  "paging": {
379
- "previous": "https://graph.facebook.com/579612276/home?token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&since=2010-04-27T11%3A06%3A29%2B0000",
380
- "next": "https://graph.facebook.com/579612276/home?token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&until=2010-04-27T09%3A44%3A28%2B0000"
379
+ "previous": "https://graph.facebook.com/579612276/home?access_token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&since=2010-04-27T11%3A06%3A29%2B0000",
380
+ "next": "https://graph.facebook.com/579612276/home?access_token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&until=2010-04-27T09%3A44%3A28%2B0000"
381
381
  }
382
382
  }
@@ -30,7 +30,7 @@
30
30
  }
31
31
  ],
32
32
  "paging": {
33
- "previous": "https://graph.facebook.com/579612276/home?token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&since=2010-04-27T13%3A23%3A08%2B0000",
34
- "next": "https://graph.facebook.com/579612276/home?token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&until=2010-04-27T13%3A10%3A56%2B0000"
33
+ "previous": "https://graph.facebook.com/579612276/home?access_token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&since=2010-04-27T13%3A23%3A08%2B0000",
34
+ "next": "https://graph.facebook.com/579612276/home?access_token=2227470867%7C2.WUnvvW0Q_ksjjVOCIEkEiQ__.3600.1272380400-579612276%7CSkfo-M8-vpId32OYv6xLZFlsToY.&limit=25&until=2010-04-27T13%3A10%3A56%2B0000"
35
35
  }
36
36
  }
@@ -0,0 +1,23 @@
1
+ {
2
+ "id": "579612276",
3
+ "name": "Nov Matake",
4
+ "first_name": "Nov",
5
+ "last_name": "Matake",
6
+ "link": "http://www.facebook.com/matake",
7
+ "about": "I'm a Ruby on Rails Developer on smart.fm",
8
+ "birthday": "12/13/1981",
9
+ "interested_in": [
10
+ "\u5973\u6027"
11
+ ],
12
+ "meeting_for": [
13
+ "\u53cb\u60c5",
14
+ "\u30c7\u30fc\u30c8",
15
+ "\u604b\u611b",
16
+ "\u60c5\u5831\u4ea4\u63db"
17
+ ],
18
+ "relationship_status": "\u65e2\u5a5a",
19
+ "website": "http://matake.jp\nhttp://blog.matake.jp\nhttp://railspress.matake.jp",
20
+ "timezone": 9,
21
+ "verified": true,
22
+ "updated_time": "2009-10-01T06:57:02+0000"
23
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "error": {
3
+ "type": "QueryParseException",
4
+ "message": "An active access token must be used to query information about the current user."
5
+ }
6
+ }
@@ -380,7 +380,7 @@
380
380
  }
381
381
  ],
382
382
  "paging": {
383
- "previous": "https://graph.facebook.com/7901103/posts?token=2227470867%7C2.dao7m2Ak0L3D0GcdwgAOxA__.3600.1272276000-579612276%7CDtIxF8whuaOlF3IJ8PQssQYHWk8.&limit=25&since=2010-04-25T04%3A05%3A32%2B0000",
384
- "next": "https://graph.facebook.com/7901103/posts?token=2227470867%7C2.dao7m2Ak0L3D0GcdwgAOxA__.3600.1272276000-579612276%7CDtIxF8whuaOlF3IJ8PQssQYHWk8.&limit=25&until=2010-04-14T00%3A53%3A54%2B0000"
383
+ "previous": "https://graph.facebook.com/7901103/posts?access_token=2227470867%7C2.dao7m2Ak0L3D0GcdwgAOxA__.3600.1272276000-579612276%7CDtIxF8whuaOlF3IJ8PQssQYHWk8.&limit=25&since=2010-04-25T04%3A05%3A32%2B0000",
384
+ "next": "https://graph.facebook.com/7901103/posts?access_token=2227470867%7C2.dao7m2Ak0L3D0GcdwgAOxA__.3600.1272276000-579612276%7CDtIxF8whuaOlF3IJ8PQssQYHWk8.&limit=25&until=2010-04-14T00%3A53%3A54%2B0000"
385
385
  }
386
386
  }
@@ -227,7 +227,7 @@
227
227
  }
228
228
  ],
229
229
  "paging": {
230
- "previous": "https://graph.facebook.com/7901103/statuses?token=2227470867%7C2.WYzVDx_3poIwJP1QNQ2vwg__.3600.1272117600-579612276%7CvNhS2UE8VCENmslKMACDszaJrDw.&limit=25&since=2010-04-21T21%3A10%3A16%2B0000",
231
- "next": "https://graph.facebook.com/7901103/statuses?token=2227470867%7C2.WYzVDx_3poIwJP1QNQ2vwg__.3600.1272117600-579612276%7CvNhS2UE8VCENmslKMACDszaJrDw.&limit=25&until=2010-01-08T06%3A55%3A12%2B0000"
230
+ "previous": "https://graph.facebook.com/7901103/statuses?access_token=2227470867%7C2.WYzVDx_3poIwJP1QNQ2vwg__.3600.1272117600-579612276%7CvNhS2UE8VCENmslKMACDszaJrDw.&limit=25&since=2010-04-21T21%3A10%3A16%2B0000",
231
+ "next": "https://graph.facebook.com/7901103/statuses?access_token=2227470867%7C2.WYzVDx_3poIwJP1QNQ2vwg__.3600.1272117600-579612276%7CvNhS2UE8VCENmslKMACDszaJrDw.&limit=25&until=2010-01-08T06%3A55%3A12%2B0000"
232
232
  }
233
233
  }
@@ -302,7 +302,7 @@
302
302
  }
303
303
  ],
304
304
  "paging": {
305
- "previous": "https://graph.facebook.com/7901103/tagged?token=2227470867%7C2.dao7m2Ak0L3D0GcdwgAOxA__.3600.1272276000-579612276%7CDtIxF8whuaOlF3IJ8PQssQYHWk8.&limit=25&since=2010-04-24T08%3A07%3A59%2B0000",
306
- "next": "https://graph.facebook.com/7901103/tagged?token=2227470867%7C2.dao7m2Ak0L3D0GcdwgAOxA__.3600.1272276000-579612276%7CDtIxF8whuaOlF3IJ8PQssQYHWk8.&limit=25&until=2010-04-21T07%3A55%3A49%2B0000"
305
+ "previous": "https://graph.facebook.com/7901103/tagged?access_token=2227470867%7C2.dao7m2Ak0L3D0GcdwgAOxA__.3600.1272276000-579612276%7CDtIxF8whuaOlF3IJ8PQssQYHWk8.&limit=25&since=2010-04-24T08%3A07%3A59%2B0000",
306
+ "next": "https://graph.facebook.com/7901103/tagged?access_token=2227470867%7C2.dao7m2Ak0L3D0GcdwgAOxA__.3600.1272276000-579612276%7CDtIxF8whuaOlF3IJ8PQssQYHWk8.&limit=25&until=2010-04-21T07%3A55%3A49%2B0000"
307
307
  }
308
308
  }
@@ -2,11 +2,11 @@ require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
3
  describe FbGraph::Collection, '#new' do
4
4
  before(:all) do
5
- fake_json(:get, 'platform/statuses?token=token', 'pages/statuses/platform_private')
5
+ fake_json(:get, 'platform/statuses?access_token=access_token', 'pages/statuses/platform_private')
6
6
  end
7
7
 
8
8
  it 'should return an array with pagination info' do
9
- statuses = FbGraph::Page.new('platform', :token => 'token').statuses
9
+ statuses = FbGraph::Page.new('platform', :access_token => 'access_token').statuses
10
10
  statuses.should be_kind_of(Array)
11
11
  statuses.previous.should be_kind_of(Hash)
12
12
  statuses.next.should be_kind_of(Hash)
@@ -15,13 +15,13 @@ end
15
15
 
16
16
  describe FbGraph::Collection do
17
17
  before(:all) do
18
- fake_json(:get, 'me/home?token=token', 'users/home/me_private')
19
- fake_json(:get, 'me/home?limit=25&since=2010-04-27T13%3A06%3A14%2B0000&token=token', 'users/home/me_private_previous')
20
- fake_json(:get, 'me/home?limit=25&token=token&until=2010-04-27T11%3A07%3A48%2B0000', 'users/home/me_private_next')
18
+ fake_json(:get, 'me/home?access_token=access_token', 'users/home/me_private')
19
+ fake_json(:get, 'me/home?limit=25&since=2010-04-27T13%3A06%3A14%2B0000&access_token=access_token', 'users/home/me_private_previous')
20
+ fake_json(:get, 'me/home?limit=25&access_token=access_token&until=2010-04-27T11%3A07%3A48%2B0000', 'users/home/me_private_next')
21
21
  end
22
22
 
23
23
  it 'should ' do
24
- me = FbGraph::User.new('me', :token => 'token')
24
+ me = FbGraph::User.new('me', :access_token => 'access_token')
25
25
  posts = me.home
26
26
  puts posts.previous.inspect, posts.next.inspect
27
27
  previous_posts = me.home(posts.previous)
@@ -4,17 +4,17 @@ describe FbGraph::Connections::Activities, '#activities' do
4
4
  describe 'when included by FbGraph::User' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'arjun/activities', 'users/activities/arjun_public')
7
- fake_json(:get, 'arjun/activities?token=token', 'users/activities/arjun_private')
7
+ fake_json(:get, 'arjun/activities?access_token=access_token', 'users/activities/arjun_private')
8
8
  end
9
9
 
10
- it 'should raise FbGraph::Unauthorized when no token given' do
10
+ it 'should raise FbGraph::Unauthorized when no access_token given' do
11
11
  lambda do
12
12
  FbGraph::User.new('arjun').activities
13
13
  end.should raise_exception(FbGraph::Unauthorized)
14
14
  end
15
15
 
16
16
  it 'should return liked pages' do
17
- activities = FbGraph::User.new('arjun', :token => 'token').activities
17
+ activities = FbGraph::User.new('arjun', :access_token => 'access_token').activities
18
18
  activities.first.should == FbGraph::Page.new(
19
19
  '378209722137',
20
20
  :name => 'Doing Things at the Last Minute',
@@ -4,17 +4,17 @@ describe FbGraph::Connections::Albums, '#albums' do
4
4
  describe 'when included by FbGraph::User' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'matake/albums', 'users/albums/matake_public')
7
- fake_json(:get, 'matake/albums?token=token', 'users/albums/matake_private')
7
+ fake_json(:get, 'matake/albums?access_token=access_token', 'users/albums/matake_private')
8
8
  end
9
9
 
10
- it 'should raise FbGraph::Unauthorized when no token given' do
10
+ it 'should raise FbGraph::Unauthorized when no access_token given' do
11
11
  lambda do
12
12
  FbGraph::User.new('matake').albums
13
13
  end.should raise_exception(FbGraph::Unauthorized)
14
14
  end
15
15
 
16
16
  it 'should return liked pages' do
17
- albums = FbGraph::User.new('matake', :token => 'token').albums
17
+ albums = FbGraph::User.new('matake', :access_token => 'access_token').albums
18
18
  albums.first.should == FbGraph::Album.new(
19
19
  '19351532276',
20
20
  :from => {
@@ -4,17 +4,17 @@ describe FbGraph::Connections::Events, '#events' do
4
4
  describe 'when included by FbGraph::User' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'matake/events', 'users/events/matake_public')
7
- fake_json(:get, 'matake/events?token=token', 'users/events/matake_private')
7
+ fake_json(:get, 'matake/events?access_token=access_token', 'users/events/matake_private')
8
8
  end
9
9
 
10
- it 'should raise FbGraph::Unauthorized when no token given' do
10
+ it 'should raise FbGraph::Unauthorized when no access_token given' do
11
11
  lambda do
12
12
  FbGraph::User.new('matake').events
13
13
  end.should raise_exception(FbGraph::Unauthorized)
14
14
  end
15
15
 
16
- it 'should return public own posts even when token is not given' do
17
- events = FbGraph::User.new('matake', :token => 'token').events
16
+ it 'should return public own posts even when access_token is not given' do
17
+ events = FbGraph::User.new('matake', :access_token => 'access_token').events
18
18
  events.first.should == FbGraph::Event.new(
19
19
  '116600818359630',
20
20
  :name => 'The Loyal We @ Rainy Day Bookstore and Cafe',
@@ -4,10 +4,10 @@ describe FbGraph::Connections::Feed, '#feed' do
4
4
  describe 'when included by FbGraph::User' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'arjun/feed', 'users/feed/arjun_public')
7
- fake_json(:get, 'arjun/feed?token=token', 'users/feed/arjun_private')
7
+ fake_json(:get, 'arjun/feed?access_token=access_token', 'users/feed/arjun_private')
8
8
  end
9
9
 
10
- it 'should return public wall posts even when token is not given' do
10
+ it 'should return public wall posts even when access_token is not given' do
11
11
  posts = FbGraph::User.new('arjun').feed
12
12
  posts.first.should == FbGraph::Post.new(
13
13
  '7901103_121392141207495',
@@ -4,12 +4,12 @@ describe FbGraph::Connections::Friends, '#friends' do
4
4
  describe 'when included by FbGraph::User' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'me/friends', 'users/friends/me_public')
7
- fake_json(:get, 'me/friends?token=token', 'users/friends/me_private')
7
+ fake_json(:get, 'me/friends?access_token=access_token', 'users/friends/me_private')
8
8
  fake_json(:get, 'arjun/friends', 'users/friends/arjun_public')
9
- fake_json(:get, 'arjun/friends?token=token', 'users/friends/arjun_private')
9
+ fake_json(:get, 'arjun/friends?access_token=access_token', 'users/friends/arjun_private')
10
10
  end
11
11
 
12
- it 'should raise FbGraph::Exception when no token given' do
12
+ it 'should raise FbGraph::Exception when no access_token given' do
13
13
  lambda do
14
14
  FbGraph::User.new('arjun').friends
15
15
  end.should raise_exception(FbGraph::Exception)
@@ -17,18 +17,18 @@ describe FbGraph::Connections::Friends, '#friends' do
17
17
 
18
18
  it 'should raise FbGraph::Exception when identifier is not me' do
19
19
  lambda do
20
- FbGraph::User.new('arjun', :token => 'token').friends
20
+ FbGraph::User.new('arjun', :access_token => 'access_token').friends
21
21
  end.should raise_exception(FbGraph::Exception)
22
22
  end
23
23
 
24
- it 'should raise FbGraph::NotFound when identifier is me and no token is given' do
24
+ it 'should raise FbGraph::NotFound when identifier is me and no access_token is given' do
25
25
  lambda do
26
26
  FbGraph::User.new('me').friends
27
27
  end.should raise_exception(FbGraph::NotFound)
28
28
  end
29
29
 
30
- it 'should return posts when identifier is me and token is given' do
31
- users = FbGraph::User.new('me', :token => 'token').friends
30
+ it 'should return posts when identifier is me and access_token is given' do
31
+ users = FbGraph::User.new('me', :access_token => 'access_token').friends
32
32
  users.first.should == FbGraph::User.new(
33
33
  '6401',
34
34
  :name => 'Kirk McMurray'
@@ -4,17 +4,17 @@ describe FbGraph::Connections::Groups, '#groups' do
4
4
  describe 'when included by FbGraph::User' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'matake/groups', 'users/groups/matake_public')
7
- fake_json(:get, 'matake/groups?token=token', 'users/groups/matake_private')
7
+ fake_json(:get, 'matake/groups?access_token=access_token', 'users/groups/matake_private')
8
8
  end
9
9
 
10
- it 'should raise FbGraph::Unauthorized when no token given' do
10
+ it 'should raise FbGraph::Unauthorized when no access_token given' do
11
11
  lambda do
12
12
  FbGraph::User.new('matake').groups
13
13
  end.should raise_exception(FbGraph::Unauthorized)
14
14
  end
15
15
 
16
- it 'should return public own posts even when token is not given' do
17
- groups = FbGraph::User.new('matake', :token => 'token').groups
16
+ it 'should return public own posts even when access_token is not given' do
17
+ groups = FbGraph::User.new('matake', :access_token => 'access_token').groups
18
18
  groups.first.should == FbGraph::Group.new(
19
19
  '115286585902',
20
20
  :name => 'iPhone 3G S'
@@ -4,12 +4,12 @@ describe FbGraph::Connections::Home, '#home' do
4
4
  describe 'when included by FbGraph::User' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'me/home', 'users/home/me_public')
7
- fake_json(:get, 'me/home?token=token', 'users/home/me_private')
7
+ fake_json(:get, 'me/home?access_token=access_token', 'users/home/me_private')
8
8
  fake_json(:get, 'arjun/home', 'users/home/arjun_public')
9
- fake_json(:get, 'arjun/home?token=token', 'users/home/arjun_private')
9
+ fake_json(:get, 'arjun/home?access_token=access_token', 'users/home/arjun_private')
10
10
  end
11
11
 
12
- it 'should raise FbGraph::Exception when no token given' do
12
+ it 'should raise FbGraph::Exception when no access_token given' do
13
13
  lambda do
14
14
  FbGraph::User.new('arjun').home
15
15
  end.should raise_exception(FbGraph::Exception)
@@ -17,18 +17,18 @@ describe FbGraph::Connections::Home, '#home' do
17
17
 
18
18
  it 'should raise FbGraph::Exception when identifier is not me' do
19
19
  lambda do
20
- FbGraph::User.new('arjun', :token => 'token').home
20
+ FbGraph::User.new('arjun', :access_token => 'access_token').home
21
21
  end.should raise_exception(FbGraph::Exception)
22
22
  end
23
23
 
24
- it 'should raise FbGraph::NotFound when identifier is me and no token is given' do
24
+ it 'should raise FbGraph::NotFound when identifier is me and no access_token is given' do
25
25
  lambda do
26
26
  FbGraph::User.new('me').home
27
27
  end.should raise_exception(FbGraph::NotFound)
28
28
  end
29
29
 
30
- it 'should return posts when identifier is me and token is given' do
31
- posts = FbGraph::User.new('me', :token => 'token').home
30
+ it 'should return posts when identifier is me and access_token is given' do
31
+ posts = FbGraph::User.new('me', :access_token => 'access_token').home
32
32
  posts.first.should == FbGraph::Post.new(
33
33
  '634033380_112599768777073',
34
34
  :from => {
@@ -4,17 +4,17 @@ describe FbGraph::Connections::Likes, '#likes' do
4
4
  describe 'when included by FbGraph::User' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'arjun/likes', 'users/likes/arjun_public')
7
- fake_json(:get, 'arjun/likes?token=token', 'users/likes/arjun_private')
7
+ fake_json(:get, 'arjun/likes?access_token=access_token', 'users/likes/arjun_private')
8
8
  end
9
9
 
10
- it 'should raise FbGraph::Unauthorized when no token given' do
10
+ it 'should raise FbGraph::Unauthorized when no access_token given' do
11
11
  lambda do
12
12
  FbGraph::User.new('arjun').likes
13
13
  end.should raise_exception(FbGraph::Unauthorized)
14
14
  end
15
15
 
16
16
  it 'should return liked pages' do
17
- likes = FbGraph::User.new('arjun', :token => 'token').likes
17
+ likes = FbGraph::User.new('arjun', :access_token => 'access_token').likes
18
18
  likes.first.should == FbGraph::Page.new(
19
19
  '378209722137',
20
20
  :name => 'Doing Things at the Last Minute',
@@ -4,10 +4,10 @@ describe FbGraph::Connections::Posts, '#posts' do
4
4
  describe 'when included by FbGraph::User' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'arjun/posts', 'users/posts/arjun_public')
7
- fake_json(:get, 'arjun/posts?token=token', 'users/posts/arjun_private')
7
+ fake_json(:get, 'arjun/posts?access_token=access_token', 'users/posts/arjun_private')
8
8
  end
9
9
 
10
- it 'should return public own posts even when token is not given' do
10
+ it 'should return public own posts even when access_token is not given' do
11
11
  posts = FbGraph::User.new('arjun').posts
12
12
  posts.first.should == FbGraph::Post.new(
13
13
  '7901103_121392141207495',
@@ -5,17 +5,17 @@ describe FbGraph::Connections::Statuses, '#statuses' do
5
5
  describe 'when included by FbGraph::User' do
6
6
  before(:all) do
7
7
  fake_json(:get, 'arjun/statuses', 'users/statuses/arjun_public')
8
- fake_json(:get, 'arjun/statuses?token=token', 'users/statuses/arjun_private')
8
+ fake_json(:get, 'arjun/statuses?access_token=access_token', 'users/statuses/arjun_private')
9
9
  end
10
10
 
11
- it 'should raise FbGraph::Unauthorized when no token given' do
11
+ it 'should raise FbGraph::Unauthorized when no access_token given' do
12
12
  lambda do
13
13
  FbGraph::User.new('arjun').statuses
14
14
  end.should raise_exception(FbGraph::Unauthorized)
15
15
  end
16
16
 
17
17
  it 'should return statuses' do
18
- statuses = FbGraph::User.new('arjun', :token => 'token').statuses
18
+ statuses = FbGraph::User.new('arjun', :access_token => 'access_token').statuses
19
19
  statuses.first.should == FbGraph::Status.new(
20
20
  '113559395341627',
21
21
  :from => {
@@ -34,17 +34,17 @@ describe FbGraph::Connections::Statuses, '#statuses' do
34
34
  describe 'when included by FbGraph::Page' do
35
35
  before(:all) do
36
36
  fake_json(:get, 'platform/statuses', 'pages/statuses/platform_public')
37
- fake_json(:get, 'platform/statuses?token=token', 'pages/statuses/platform_private')
37
+ fake_json(:get, 'platform/statuses?access_token=access_token', 'pages/statuses/platform_private')
38
38
  end
39
39
 
40
- it 'should raise FbGraph::Unauthorized when no token given' do
40
+ it 'should raise FbGraph::Unauthorized when no access_token given' do
41
41
  lambda do
42
42
  FbGraph::Page.new('platform').statuses
43
43
  end.should raise_exception(FbGraph::Unauthorized)
44
44
  end
45
45
 
46
46
  it 'should return statuses with pagination info' do
47
- statuses = FbGraph::Page.new('platform', :token => 'token').statuses
47
+ statuses = FbGraph::Page.new('platform', :access_token => 'access_token').statuses
48
48
  statuses.first.should == FbGraph::Status.new(
49
49
  '111081598927600',
50
50
  :from => {
@@ -4,10 +4,10 @@ describe FbGraph::Connections::Tagged, '#tagged' do
4
4
  describe 'when included by FbGraph::User' do
5
5
  before(:all) do
6
6
  fake_json(:get, 'arjun/tagged', 'users/tagged/arjun_public')
7
- fake_json(:get, 'arjun/tagged?token=token', 'users/tagged/arjun_private')
7
+ fake_json(:get, 'arjun/tagged?access_token=access_token', 'users/tagged/arjun_private')
8
8
  end
9
9
 
10
- it 'should return public own posts even when token is not given' do
10
+ it 'should return public own posts even when access_token is not given' do
11
11
  posts = FbGraph::User.new('arjun').tagged
12
12
  posts.first.should == FbGraph::Post.new(
13
13
  '7901103_117809521578252',
@@ -6,8 +6,8 @@ describe FbGraph::Node, '#new' do
6
6
  FbGraph::Node.new('matake').endpoint.should == File.join(FbGraph::ROOT_URL, 'matake')
7
7
  end
8
8
 
9
- it 'should support token option' do
10
- FbGraph::Node.new('matake', :token => 'token').token.should == 'token'
9
+ it 'should support access_token option' do
10
+ FbGraph::Node.new('matake', :access_token => 'access_token').access_token.should == 'access_token'
11
11
  end
12
12
 
13
13
  end
@@ -3,7 +3,7 @@ require File.join(File.dirname(__FILE__), '../spec_helper')
3
3
  describe FbGraph::Page, '.fetch' do
4
4
  before(:all) do
5
5
  fake_json(:get, 'platform', 'pages/platform_public')
6
- fake_json(:get, 'platform?token=token', 'pages/platform_private')
6
+ fake_json(:get, 'platform?access_token=access_token', 'pages/platform_private')
7
7
  end
8
8
 
9
9
  it 'should get page attributes' do
@@ -13,7 +13,7 @@ describe FbGraph::Page, '.fetch' do
13
13
  page.category.should == 'Technology'
14
14
  end
15
15
 
16
- it 'should not require token' do
17
- FbGraph::Page.fetch('platform', :token => 'token').should == FbGraph::Page.fetch('platform')
16
+ it 'should not require access_token' do
17
+ FbGraph::Page.fetch('platform', :access_token => 'access_token').should == FbGraph::Page.fetch('platform')
18
18
  end
19
19
  end
@@ -1,18 +1,18 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
3
  describe FbGraph::User, '.me' do
4
- it 'should return FbGraph::User instance with token' do
5
- FbGraph::User.me('token').should == FbGraph::User.new('me', :token => 'token')
4
+ it 'should return FbGraph::User instance with access_token' do
5
+ FbGraph::User.me('access_token').should == FbGraph::User.new('me', :access_token => 'access_token')
6
6
  end
7
7
  end
8
8
 
9
9
  describe FbGraph::User, '.fetch' do
10
10
  before(:all) do
11
11
  fake_json(:get, 'arjun', 'users/arjun_public')
12
- fake_json(:get, 'arjun?token=token', 'users/arjun_private')
12
+ fake_json(:get, 'arjun?access_token=access_token', 'users/arjun_private')
13
13
  end
14
14
 
15
- it 'should get only public profile when no token given' do
15
+ it 'should get only public profile when no access_token given' do
16
16
  user = FbGraph::User.fetch('arjun')
17
17
  user.name.should == 'Arjun Banker'
18
18
  user.first_name.should == 'Arjun'
@@ -21,8 +21,8 @@ describe FbGraph::User, '.fetch' do
21
21
  user.link.should == 'http://www.facebook.com/Arjun'
22
22
  end
23
23
 
24
- it 'should get public + private profile when token given' do
25
- user = FbGraph::User.fetch('arjun', :token => 'token')
24
+ it 'should get public + private profile when access_token given' do
25
+ user = FbGraph::User.fetch('arjun', :access_token => 'access_token')
26
26
  # public
27
27
  user.name.should == 'Arjun Banker'
28
28
  user.first_name.should == 'Arjun'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - nov matake
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-27 00:00:00 +09:00
17
+ date: 2010-04-29 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: "0"
54
54
  type: :development
55
55
  version_requirements: *id003
56
- description: Facebook Graph API library for Ruby
56
+ description: A Ruby wrapper for Facebook Graph API
57
57
  email: nov@matake.jp
58
58
  executables: []
59
59
 
@@ -145,6 +145,8 @@ files:
145
145
  - spec/fake_json/users/home/me_public.json
146
146
  - spec/fake_json/users/likes/arjun_private.json
147
147
  - spec/fake_json/users/likes/arjun_public.json
148
+ - spec/fake_json/users/me_private.json
149
+ - spec/fake_json/users/me_public.json
148
150
  - spec/fake_json/users/posts/arjun_private.json
149
151
  - spec/fake_json/users/posts/arjun_public.json
150
152
  - spec/fake_json/users/statuses/arjun_private.json
@@ -209,7 +211,7 @@ rubyforge_project:
209
211
  rubygems_version: 1.3.6
210
212
  signing_key:
211
213
  specification_version: 3
212
- summary: Facebook Graph API library for Ruby
214
+ summary: A Ruby wrapper for Facebook Graph API
213
215
  test_files:
214
216
  - spec/fb_graph/album_spec.rb
215
217
  - spec/fb_graph/collection_spec.rb