From c3c8798893b226cb710b0c495b8faa4bbdf3f85d Mon Sep 17 00:00:00 2001 From: nov Date: Sun, 25 May 2014 15:05:11 +0900 Subject: [PATCH] family & friendlists --- lib/fb_graph2/edge/family.rb | 12 ++++++++++++ lib/fb_graph2/edge/friend_lists.rb | 13 +++++++++++++ lib/fb_graph2/friend_list.rb | 7 +++++++ lib/fb_graph2/user.rb | 6 +++++- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 lib/fb_graph2/edge/family.rb create mode 100644 lib/fb_graph2/edge/friend_lists.rb create mode 100644 lib/fb_graph2/friend_list.rb diff --git a/lib/fb_graph2/edge/family.rb b/lib/fb_graph2/edge/family.rb new file mode 100644 index 0000000..07cb8d5 --- /dev/null +++ b/lib/fb_graph2/edge/family.rb @@ -0,0 +1,12 @@ +module FbGraph2 + class Edge + module Family + def family(params = {}) + users = self.edge :family, params + users.collect do |user| + User.new(user[:id], user).authenticate self.access_token + end + end + end + end +end \ No newline at end of file diff --git a/lib/fb_graph2/edge/friend_lists.rb b/lib/fb_graph2/edge/friend_lists.rb new file mode 100644 index 0000000..e0d7be0 --- /dev/null +++ b/lib/fb_graph2/edge/friend_lists.rb @@ -0,0 +1,13 @@ +module FbGraph2 + class Edge + module FriendLists + def friend_lists(params = {}) + friend_lists = self.edge :friendlists, params + friend_lists.collect do |friend_list| + FriendList.new(friend_list[:id], friend_list).authenticate self.access_token + end + end + alias_method :friendlists, :friend_lists + end + end +end \ No newline at end of file diff --git a/lib/fb_graph2/friend_list.rb b/lib/fb_graph2/friend_list.rb new file mode 100644 index 0000000..8d5344a --- /dev/null +++ b/lib/fb_graph2/friend_list.rb @@ -0,0 +1,7 @@ +module FbGraph2 + class FriendList < Node + register_attributes( + raw: [:name, :list_type] + ) + end +end \ No newline at end of file diff --git a/lib/fb_graph2/user.rb b/lib/fb_graph2/user.rb index bbf262a..557789b 100644 --- a/lib/fb_graph2/user.rb +++ b/lib/fb_graph2/user.rb @@ -6,7 +6,9 @@ module FbGraph2 include Edge::Albums include Edge::Books include Edge::Events + include Edge::Family include Edge::Feed + include Edge::FriendLists include Edge::Friends include Edge::Games include Edge::Home @@ -24,7 +26,9 @@ module FbGraph2 raw: [ :about, :bio, :email, :first_name, :gender, :installed, :is_verified, :link, :locale, :middle_name, :name, :name_format, :political, :quotes, :relationship_status, :religion, - :timezone, :third_party_id, :verified, :website + :timezone, :third_party_id, :verified, :website, + # NOTE: in family edge context + :relationship ], time: [:updated_time], # NOTE: undocumented attribute date: [:birthday],