fb_graph 2.1.0 → 2.1.1

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fb_graph (2.1.0.alpha)
4
+ fb_graph (2.1.0)
5
5
  httpclient (>= 2.2.0.2)
6
6
  rack-oauth2 (>= 0.8.0)
7
7
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.1
@@ -66,6 +66,7 @@ require 'fb_graph/doc'
66
66
  require 'fb_graph/domain'
67
67
  require 'fb_graph/event'
68
68
  require 'fb_graph/friend_list'
69
+ require 'fb_graph/friend_request'
69
70
  require 'fb_graph/group'
70
71
  require 'fb_graph/image'
71
72
  require 'fb_graph/insight'
@@ -0,0 +1,10 @@
1
+ module FbGraph
2
+ module Connections
3
+ module Admins
4
+ def admin?(user, options = {})
5
+ admin = self.connection :admins, options.merge(:connection_scope => user.identifier)
6
+ admin.present?
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ module FbGraph
2
+ module Connections
3
+ module FriendRequests
4
+ def friend_requests(options = {})
5
+ friend_requests = self.connection(:friendrequests, options)
6
+ friend_requests.map! do |friend_request|
7
+ FriendRequest.new friend_request
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ module FbGraph
2
+ class FriendRequest
3
+ include Comparison
4
+ attr_accessor :from, :to, :created_time, :message, :unread
5
+
6
+ def initialize(attributes = {})
7
+ @from = User.new attributes[:from]
8
+ @to = User.new attributes[:to]
9
+ @created_time = Time.parse attributes[:created_time]
10
+ @message = attributes[:message]
11
+ @unread = attributes[:unread]
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,6 @@
1
1
  module FbGraph
2
2
  class Page < Node
3
+ include Connections::Admins
3
4
  include Connections::Albums
4
5
  include Connections::Blocked
5
6
  include Connections::Checkins
@@ -9,6 +9,7 @@ module FbGraph
9
9
  include Connections::Events
10
10
  include Connections::Feed
11
11
  include Connections::FriendLists
12
+ include Connections::FriendRequests
12
13
  include Connections::Friends
13
14
  include Connections::Family
14
15
  include Connections::Games
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph::Connections::Admins do
4
+ let(:page) { FbGraph::Page.new('FbGraph', :access_token => 'page_token') }
5
+ context 'when given user is admin' do
6
+ it 'should be true' do
7
+ mock_graph :get, 'FbGraph/admins/matake', 'pages/admins/sample', :access_token => 'page_token' do
8
+ page.admin?(FbGraph::User.new('matake')).should be_true
9
+ end
10
+ end
11
+ end
12
+
13
+ context 'otherwise' do
14
+ it 'should be false' do
15
+ mock_graph :get, 'FbGraph/admins/nov.matake', 'pages/admins/blank', :access_token => 'page_token' do
16
+ page.admin?(FbGraph::User.new('nov.matake')).should be_false
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe FbGraph::Connections::FriendRequests do
4
+ it 'should return an Array of FriendRequest' do
5
+ mock_graph :get, 'me/friendrequests', 'users/friend_requests/sample', :access_token => 'access_token' do
6
+ friend_request = FbGraph::User.me('access_token').friend_requests.first
7
+ friend_request.should be_a FbGraph::FriendRequest
8
+ friend_request.from.should be_a FbGraph::User
9
+ friend_request.to.should be_a FbGraph::User
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ {
2
+ "data": []
3
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "data": [{
3
+ "id":
4
+ "579612276",
5
+ "name":
6
+ "Nov Matake"
7
+ }]
8
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "from": {
5
+ "name": "Stephen Doyle",
6
+ "id": "533875325"
7
+ },
8
+ "created_time": "2011-08-22T17:13:07+0000",
9
+ "message": "Omg.",
10
+ "unread": true,
11
+ "to": {
12
+ "name": "Cissy Lim",
13
+ "id": "100001147247007"
14
+ }
15
+ }
16
+ ]
17
+ }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
- - 0
10
- version: 2.1.0
9
+ - 1
10
+ version: 2.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake
@@ -170,6 +170,7 @@ files:
170
170
  - lib/fb_graph/connections/activities.rb
171
171
  - lib/fb_graph/connections/ad_campaigns.rb
172
172
  - lib/fb_graph/connections/ad_groups.rb
173
+ - lib/fb_graph/connections/admins.rb
173
174
  - lib/fb_graph/connections/albums.rb
174
175
  - lib/fb_graph/connections/app_requests.rb
175
176
  - lib/fb_graph/connections/attending.rb
@@ -184,6 +185,7 @@ files:
184
185
  - lib/fb_graph/connections/feed.rb
185
186
  - lib/fb_graph/connections/former_participants.rb
186
187
  - lib/fb_graph/connections/friend_lists.rb
188
+ - lib/fb_graph/connections/friend_requests.rb
187
189
  - lib/fb_graph/connections/friends.rb
188
190
  - lib/fb_graph/connections/games.rb
189
191
  - lib/fb_graph/connections/groups.rb
@@ -227,6 +229,7 @@ files:
227
229
  - lib/fb_graph/event.rb
228
230
  - lib/fb_graph/exception.rb
229
231
  - lib/fb_graph/friend_list.rb
232
+ - lib/fb_graph/friend_request.rb
230
233
  - lib/fb_graph/group.rb
231
234
  - lib/fb_graph/image.rb
232
235
  - lib/fb_graph/insight.rb
@@ -278,6 +281,7 @@ files:
278
281
  - spec/fb_graph/connections/accounts_spec.rb
279
282
  - spec/fb_graph/connections/activities_spec.rb
280
283
  - spec/fb_graph/connections/ad_groups_spec.rb
284
+ - spec/fb_graph/connections/admins_spec.rb
281
285
  - spec/fb_graph/connections/albums_spec.rb
282
286
  - spec/fb_graph/connections/app_requests_spec.rb
283
287
  - spec/fb_graph/connections/attending_spec.rb
@@ -292,6 +296,7 @@ files:
292
296
  - spec/fb_graph/connections/feed_spec.rb
293
297
  - spec/fb_graph/connections/former_participants_spec.rb
294
298
  - spec/fb_graph/connections/friend_lists_spec.rb
299
+ - spec/fb_graph/connections/friend_requests_spec.rb
295
300
  - spec/fb_graph/connections/friends_spec.rb
296
301
  - spec/fb_graph/connections/games_spec.rb
297
302
  - spec/fb_graph/connections/groups_spec.rb
@@ -399,6 +404,8 @@ files:
399
404
  - spec/mock_json/exchange_sessions_response.json
400
405
  - spec/mock_json/groups/docs/private.json
401
406
  - spec/mock_json/groups/members/emacs_private.json
407
+ - spec/mock_json/pages/admins/blank.json
408
+ - spec/mock_json/pages/admins/sample.json
402
409
  - spec/mock_json/pages/blocked/create.json
403
410
  - spec/mock_json/pages/blocked/index.json
404
411
  - spec/mock_json/pages/blocked/show_blocked.json
@@ -476,6 +483,7 @@ files:
476
483
  - spec/mock_json/users/feed/post_with_valid_access_token.json
477
484
  - spec/mock_json/users/feed/post_without_access_token.json
478
485
  - spec/mock_json/users/friend_lists/matake.json
486
+ - spec/mock_json/users/friend_requests/sample.json
479
487
  - spec/mock_json/users/friends/arjun_private.json
480
488
  - spec/mock_json/users/friends/arjun_public.json
481
489
  - spec/mock_json/users/friends/me_private.json
@@ -566,6 +574,7 @@ test_files:
566
574
  - spec/fb_graph/connections/accounts_spec.rb
567
575
  - spec/fb_graph/connections/activities_spec.rb
568
576
  - spec/fb_graph/connections/ad_groups_spec.rb
577
+ - spec/fb_graph/connections/admins_spec.rb
569
578
  - spec/fb_graph/connections/albums_spec.rb
570
579
  - spec/fb_graph/connections/app_requests_spec.rb
571
580
  - spec/fb_graph/connections/attending_spec.rb
@@ -580,6 +589,7 @@ test_files:
580
589
  - spec/fb_graph/connections/feed_spec.rb
581
590
  - spec/fb_graph/connections/former_participants_spec.rb
582
591
  - spec/fb_graph/connections/friend_lists_spec.rb
592
+ - spec/fb_graph/connections/friend_requests_spec.rb
583
593
  - spec/fb_graph/connections/friends_spec.rb
584
594
  - spec/fb_graph/connections/games_spec.rb
585
595
  - spec/fb_graph/connections/groups_spec.rb
@@ -687,6 +697,8 @@ test_files:
687
697
  - spec/mock_json/exchange_sessions_response.json
688
698
  - spec/mock_json/groups/docs/private.json
689
699
  - spec/mock_json/groups/members/emacs_private.json
700
+ - spec/mock_json/pages/admins/blank.json
701
+ - spec/mock_json/pages/admins/sample.json
690
702
  - spec/mock_json/pages/blocked/create.json
691
703
  - spec/mock_json/pages/blocked/index.json
692
704
  - spec/mock_json/pages/blocked/show_blocked.json
@@ -764,6 +776,7 @@ test_files:
764
776
  - spec/mock_json/users/feed/post_with_valid_access_token.json
765
777
  - spec/mock_json/users/feed/post_without_access_token.json
766
778
  - spec/mock_json/users/friend_lists/matake.json
779
+ - spec/mock_json/users/friend_requests/sample.json
767
780
  - spec/mock_json/users/friends/arjun_private.json
768
781
  - spec/mock_json/users/friends/arjun_public.json
769
782
  - spec/mock_json/users/friends/me_private.json