fb_graph 2.2.6 → 2.3.0
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/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/fb_graph/connections/accounts.rb +3 -3
- data/lib/fb_graph/connections/achievements.rb +2 -2
- data/lib/fb_graph/connections/activities.rb +3 -3
- data/lib/fb_graph/connections/ad_accounts.rb +3 -3
- data/lib/fb_graph/connections/ad_campaign_stats.rb +3 -3
- data/lib/fb_graph/connections/ad_campaigns.rb +6 -6
- data/lib/fb_graph/connections/ad_connection_objects.rb +3 -3
- data/lib/fb_graph/connections/ad_group_stats.rb +3 -3
- data/lib/fb_graph/connections/ad_groups.rb +6 -6
- data/lib/fb_graph/connections/ad_previews.rb +2 -2
- data/lib/fb_graph/connections/albums.rb +6 -6
- data/lib/fb_graph/connections/app_requests.rb +5 -5
- data/lib/fb_graph/connections/attending.rb +4 -4
- data/lib/fb_graph/connections/blocked.rb +1 -1
- data/lib/fb_graph/connections/books.rb +3 -3
- data/lib/fb_graph/connections/broad_targeting_categories.rb +3 -3
- data/lib/fb_graph/connections/checkins.rb +6 -6
- data/lib/fb_graph/connections/comments.rb +6 -6
- data/lib/fb_graph/connections/declined.rb +4 -4
- data/lib/fb_graph/connections/docs.rb +3 -3
- data/lib/fb_graph/connections/events.rb +6 -6
- data/lib/fb_graph/connections/family.rb +3 -3
- data/lib/fb_graph/connections/feed.rb +6 -6
- data/lib/fb_graph/connections/former_participants.rb +3 -3
- data/lib/fb_graph/connections/friend_lists.rb +5 -5
- data/lib/fb_graph/connections/friend_requests.rb +1 -1
- data/lib/fb_graph/connections/friends.rb +3 -3
- data/lib/fb_graph/connections/games.rb +3 -3
- data/lib/fb_graph/connections/groups.rb +3 -3
- data/lib/fb_graph/connections/home.rb +3 -3
- data/lib/fb_graph/connections/inbox.rb +5 -5
- data/lib/fb_graph/connections/insights.rb +7 -3
- data/lib/fb_graph/connections/interests.rb +3 -3
- data/lib/fb_graph/connections/invited.rb +3 -3
- data/lib/fb_graph/connections/likes.rb +5 -5
- data/lib/fb_graph/connections/links.rb +6 -6
- data/lib/fb_graph/connections/maybe.rb +4 -4
- data/lib/fb_graph/connections/members.rb +3 -3
- data/lib/fb_graph/connections/messages.rb +3 -3
- data/lib/fb_graph/connections/movies.rb +3 -3
- data/lib/fb_graph/connections/music.rb +3 -3
- data/lib/fb_graph/connections/mutual_friends.rb +6 -2
- data/lib/fb_graph/connections/noreply.rb +3 -3
- data/lib/fb_graph/connections/notes.rb +6 -6
- data/lib/fb_graph/connections/notifications.rb +14 -0
- data/lib/fb_graph/connections/outbox.rb +5 -5
- data/lib/fb_graph/connections/participants.rb +3 -3
- data/lib/fb_graph/connections/payments.rb +3 -3
- data/lib/fb_graph/connections/photos.rb +6 -6
- data/lib/fb_graph/connections/pokes.rb +2 -2
- data/lib/fb_graph/connections/posts.rb +3 -3
- data/lib/fb_graph/connections/question_options.rb +6 -6
- data/lib/fb_graph/connections/questions.rb +8 -0
- data/lib/fb_graph/connections/reach_estimates.rb +2 -2
- data/lib/fb_graph/connections/reviews.rb +3 -3
- data/lib/fb_graph/connections/senders.rb +3 -3
- data/lib/fb_graph/connections/statuses.rb +3 -3
- data/lib/fb_graph/connections/subscriptions.rb +4 -4
- data/lib/fb_graph/connections/tabs.rb +3 -3
- data/lib/fb_graph/connections/tagged.rb +3 -3
- data/lib/fb_graph/connections/tags.rb +3 -3
- data/lib/fb_graph/connections/television.rb +3 -3
- data/lib/fb_graph/connections/test_users.rb +4 -4
- data/lib/fb_graph/connections/threads.rb +3 -3
- data/lib/fb_graph/connections/user_achievements.rb +2 -2
- data/lib/fb_graph/connections/user_likes.rb +3 -3
- data/lib/fb_graph/connections/videos.rb +6 -6
- data/lib/fb_graph/connections/votes.rb +1 -1
- data/lib/fb_graph/node.rb +1 -2
- data/lib/fb_graph/notification.rb +32 -0
- data/lib/fb_graph/question.rb +3 -1
- data/lib/fb_graph/user.rb +1 -0
- data/lib/fb_graph.rb +1 -0
- data/spec/fb_graph/connections/notifications_spec.rb +16 -0
- data/spec/fb_graph/connections/question_options_spec.rb +1 -1
- data/spec/fb_graph/connections/questions_spec.rb +25 -5
- data/spec/fb_graph/connections/reach_estimates_spec.rb +3 -1
- data/spec/fb_graph/notification_spec.rb +59 -0
- data/spec/mock_json/users/notifications/all.json +407 -0
- data/spec/mock_json/users/questions/created.json +1 -0
- metadata +26 -16
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
@@ -2,14 +2,14 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Accounts
|
4
4
|
def accounts(options = {})
|
5
|
-
accounts = self.connection
|
5
|
+
accounts = self.connection :accounts, options
|
6
6
|
accounts.map! do |account|
|
7
7
|
account[:access_token] ||= options[:access_token] || self.access_token
|
8
8
|
case self
|
9
9
|
when User
|
10
|
-
Page.new
|
10
|
+
Page.new account[:id], account
|
11
11
|
when Application
|
12
|
-
TestUser.new
|
12
|
+
TestUser.new account[:id], account
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -3,9 +3,9 @@ module FbGraph
|
|
3
3
|
module Achievements
|
4
4
|
def achievements(options = {})
|
5
5
|
options[:access_token] ||= self.access_token
|
6
|
-
achievements = self.connection
|
6
|
+
achievements = self.connection :achievements, options
|
7
7
|
achievements.map! do |achievement|
|
8
|
-
Achievement.new
|
8
|
+
Achievement.new achievement[:id], achievement.merge(:access_token => options[:access_token])
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Activities
|
4
4
|
def activities(options = {})
|
5
|
-
activities = self.connection
|
5
|
+
activities = self.connection :activities, options
|
6
6
|
activities.map! do |activity|
|
7
|
-
Page.new
|
7
|
+
Page.new activity[:id], activity.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module AdAccounts
|
4
4
|
def ad_accounts(options = {})
|
5
|
-
ad_accounts = self.connection
|
5
|
+
ad_accounts = self.connection :adaccounts, options
|
6
6
|
ad_accounts.map! do |ad_account|
|
7
|
-
AdAccount.new
|
7
|
+
AdAccount.new ad_account[:id], ad_account.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -4,11 +4,11 @@ module FbGraph
|
|
4
4
|
# When retrieving stats at the AdAccount level we use the 'adcampaignstats' connection
|
5
5
|
# This returns an Array of statistics
|
6
6
|
def ad_campaign_stats(options = {})
|
7
|
-
ad_campaign_stats = self.connection
|
7
|
+
ad_campaign_stats = self.connection :adcampaignstats, options
|
8
8
|
ad_campaign_stats.map! do |ad_campaign_stat|
|
9
|
-
AdCampaignStat.new
|
9
|
+
AdCampaignStat.new ad_campaign_stat[:id], ad_campaign_stat.merge(
|
10
10
|
:access_token => options[:access_token] || self.access_token
|
11
|
-
)
|
11
|
+
)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -2,19 +2,19 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module AdCampaigns
|
4
4
|
def ad_campaigns(options = {})
|
5
|
-
ad_campaigns = self.connection
|
5
|
+
ad_campaigns = self.connection :adcampaigns, options
|
6
6
|
ad_campaigns.map! do |ad_campaign|
|
7
|
-
AdCampaign.new
|
7
|
+
AdCampaign.new ad_campaign[:id], ad_campaign.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def ad_campaign!(options = {})
|
14
|
-
ad_campaign = post
|
15
|
-
AdCampaign.new
|
14
|
+
ad_campaign = post options.merge(:connection => :adcampaigns)
|
15
|
+
AdCampaign.new ad_campaign[:id], options.merge(ad_campaign).merge(
|
16
16
|
:access_token => options[:access_token] || self.access_token
|
17
|
-
)
|
17
|
+
)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module AdConnectionObjects
|
4
4
|
def connection_objects(options = {})
|
5
|
-
connection_objects = self.connection
|
5
|
+
connection_objects = self.connection :connectionobjects, options
|
6
6
|
connection_objects.map! do |connection_object|
|
7
|
-
AdConnectionObject.new
|
7
|
+
AdConnectionObject.new connection_object[:id], connection_object.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -4,11 +4,11 @@ module FbGraph
|
|
4
4
|
# When retrieving stats at the AdAccount level we use the 'adgroupstats' connection
|
5
5
|
# This returns an Array of statistics
|
6
6
|
def ad_group_stats(options = {})
|
7
|
-
ad_group_stats = self.connection
|
7
|
+
ad_group_stats = self.connection :adgroupstats, options
|
8
8
|
ad_group_stats.map! do |ad_group_stat|
|
9
|
-
AdGroupStat.new
|
9
|
+
AdGroupStat.new ad_group_stat[:id], ad_group_stat.merge(
|
10
10
|
:access_token => options[:access_token] || self.access_token
|
11
|
-
)
|
11
|
+
)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -2,23 +2,23 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module AdGroups
|
4
4
|
def ad_groups(options = {})
|
5
|
-
ad_groups = self.connection
|
5
|
+
ad_groups = self.connection :adgroups, options
|
6
6
|
ad_groups.map! do |ad_group|
|
7
|
-
AdGroup.new
|
7
|
+
AdGroup.new ad_group[:id], ad_group.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
# Note: AdGroups can only be created via the AdAccount connection. Even though it makes sense, they
|
14
14
|
# cannot be created via the AdCampaign connection
|
15
15
|
def ad_group!(options = {})
|
16
|
-
ad_group = post
|
17
|
-
AdGroup.new
|
16
|
+
ad_group = post options.merge(:connection => :adgroups)
|
17
|
+
AdGroup.new ad_group[:id], options.merge(ad_group).merge(
|
18
18
|
:access_token => options[:access_token] || self.access_token,
|
19
19
|
:ad_id => ad_group[:id].to_i,
|
20
20
|
:adgroup_id => ad_group[:id].to_i
|
21
|
-
)
|
21
|
+
)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -2,8 +2,8 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module AdPreviews
|
4
4
|
def ad_previews(options = {})
|
5
|
-
ad_previews = self.post
|
6
|
-
AdPreview.new
|
5
|
+
ad_previews = self.post options.merge(:method => 'get', :connection => :adpreviews)
|
6
|
+
AdPreview.new ad_previews.merge(:access_token => options[:access_token] || self.access_token)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
@@ -2,19 +2,19 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Albums
|
4
4
|
def albums(options = {})
|
5
|
-
albums = self.connection
|
5
|
+
albums = self.connection :albums, options
|
6
6
|
albums.map! do |album|
|
7
|
-
Album.new
|
7
|
+
Album.new album[:id], album.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def album!(options = {})
|
14
|
-
album = post
|
15
|
-
Album.new
|
14
|
+
album = post options.merge(:connection => :albums)
|
15
|
+
Album.new album[:id], options.merge(album).merge(
|
16
16
|
:access_token => options[:access_token] || self.access_token
|
17
|
-
)
|
17
|
+
)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -2,19 +2,19 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module AppRequests
|
4
4
|
def app_requests(options = {})
|
5
|
-
app_requests = self.connection
|
5
|
+
app_requests = self.connection :apprequests, options
|
6
6
|
app_requests.map! do |app_request|
|
7
|
-
AppRequest.new
|
7
|
+
AppRequest.new app_request[:id], app_request.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def app_request!(options = {})
|
14
14
|
app_request_id = post options.merge(:connection => :apprequests)
|
15
|
-
AppRequest.new
|
15
|
+
AppRequest.new app_request_id, options.merge(
|
16
16
|
:access_token => options[:access_token] || self.access_token
|
17
|
-
)
|
17
|
+
)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -2,16 +2,16 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Attending
|
4
4
|
def attending(options = {})
|
5
|
-
members = self.connection
|
5
|
+
members = self.connection :attending, options
|
6
6
|
members.map! do |member|
|
7
|
-
User.new
|
7
|
+
User.new member[:id], member.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def attending!(options = {})
|
14
|
-
post
|
14
|
+
post options.merge(:connection => :attending)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -21,7 +21,7 @@ module FbGraph
|
|
21
21
|
blocked.delete_if do |user_id, succeeded|
|
22
22
|
!succeeded
|
23
23
|
end.keys.map! do |user_id|
|
24
|
-
User.new
|
24
|
+
User.new user_id, :access_token => (options[:access_token] || self.access_token)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Books
|
4
4
|
def books(options = {})
|
5
|
-
books = self.connection
|
5
|
+
books = self.connection :books, options
|
6
6
|
books.map! do |book|
|
7
|
-
Page.new
|
7
|
+
Page.new book[:id], book.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module BroadTargetingCategories
|
4
4
|
def broad_targeting_categories(options = {})
|
5
|
-
broad_targeting_categories = self.connection
|
5
|
+
broad_targeting_categories = self.connection :broadtargetingcategories, options
|
6
6
|
broad_targeting_categories.map! do |btc|
|
7
|
-
BroadTargetingCategory.new
|
7
|
+
BroadTargetingCategory.new btc[:id], btc.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,19 +2,19 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Checkins
|
4
4
|
def checkins(options = {})
|
5
|
-
checkins = self.connection
|
5
|
+
checkins = self.connection :checkins, options
|
6
6
|
checkins.map! do |checkin|
|
7
|
-
Checkin.new
|
7
|
+
Checkin.new checkin[:id], checkin.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def checkin!(options = {})
|
14
|
-
checkin = post
|
15
|
-
Checkin.new
|
14
|
+
checkin = post options.merge(:connection => :checkins)
|
15
|
+
Checkin.new checkin[:id], options.merge(checkin).merge(
|
16
16
|
:access_token => options[:access_token] || self.access_token
|
17
|
-
)
|
17
|
+
)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -2,19 +2,19 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Comments
|
4
4
|
def comments(options = {})
|
5
|
-
comments = self.connection
|
5
|
+
comments = self.connection :comments, options
|
6
6
|
comments.map! do |comment|
|
7
|
-
Comment.new
|
7
|
+
Comment.new comment[:id], comment.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def comment!(options = {})
|
14
|
-
comment = post
|
15
|
-
Comment.new
|
14
|
+
comment = post options.merge(:connection => :comments)
|
15
|
+
Comment.new comment[:id], options.merge(comment).merge(
|
16
16
|
:access_token => options[:access_token] || self.access_token
|
17
|
-
)
|
17
|
+
)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -2,16 +2,16 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Declined
|
4
4
|
def declined(options = {})
|
5
|
-
members = self.connection
|
5
|
+
members = self.connection :declined, options
|
6
6
|
members.map! do |member|
|
7
|
-
User.new
|
7
|
+
User.new member[:id], member.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def declined!(options = {})
|
14
|
-
post
|
14
|
+
post options.merge(:connection => :declined)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Docs
|
4
4
|
def docs(options = {})
|
5
|
-
docs = self.connection
|
5
|
+
docs = self.connection :docs, options
|
6
6
|
docs.map! do |doc|
|
7
|
-
Doc.new
|
7
|
+
Doc.new doc[:id], doc.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,19 +2,19 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Events
|
4
4
|
def events(options = {})
|
5
|
-
events = self.connection
|
5
|
+
events = self.connection :events, options
|
6
6
|
events.map! do |event|
|
7
|
-
Event.new
|
7
|
+
Event.new event[:id], event.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def event!(options = {})
|
14
|
-
event = post
|
15
|
-
Event.new
|
14
|
+
event = post options.merge(:connection => :events)
|
15
|
+
Event.new event[:id], options.merge(event).merge(
|
16
16
|
:access_token => options[:access_token] || self.access_token
|
17
|
-
)
|
17
|
+
)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Family
|
4
4
|
def family(options = {})
|
5
|
-
users = self.connection
|
5
|
+
users = self.connection :family, options
|
6
6
|
users.map! do |user|
|
7
|
-
User.new
|
7
|
+
User.new user[:id], user.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,20 +2,20 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Feed
|
4
4
|
def feed(options = {})
|
5
|
-
posts = self.connection
|
5
|
+
posts = self.connection :feed, options
|
6
6
|
posts.map! do |post|
|
7
|
-
Post.new
|
7
|
+
Post.new post[:id], post.merge(
|
8
8
|
:context => self.class,
|
9
9
|
:access_token => options[:access_token] || self.access_token
|
10
|
-
)
|
10
|
+
)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
def feed!(options = {})
|
15
|
-
post = post
|
16
|
-
Post.new
|
15
|
+
post = post options.merge(:connection => :feed)
|
16
|
+
Post.new post[:id], options.merge(post).merge(
|
17
17
|
:access_token => options[:access_token] || self.access_token
|
18
|
-
)
|
18
|
+
)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module FormerParticipants
|
4
4
|
def former_participants(options = {})
|
5
|
-
users = self.connection
|
5
|
+
users = self.connection :former_participants, options
|
6
6
|
users.map! do |user|
|
7
|
-
User.new
|
7
|
+
User.new user[:id], user.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,19 +2,19 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module FriendLists
|
4
4
|
def friend_lists(options = {})
|
5
|
-
friend_lists = self.connection
|
5
|
+
friend_lists = self.connection :friendlists, options
|
6
6
|
friend_lists.map! do |friend_list|
|
7
|
-
FriendList.new
|
7
|
+
FriendList.new friend_list[:id], friend_list.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def friend_list!(options = {})
|
14
14
|
friend_list = post options.merge(:connection => :friendlists)
|
15
|
-
FriendList.new
|
15
|
+
FriendList.new friend_list[:id], options.merge(friend_list).merge(
|
16
16
|
:access_token => options[:access_token] || self.access_token
|
17
|
-
)
|
17
|
+
)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -2,7 +2,7 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module FriendRequests
|
4
4
|
def friend_requests(options = {})
|
5
|
-
friend_requests = self.connection
|
5
|
+
friend_requests = self.connection :friendrequests, options
|
6
6
|
friend_requests.map! do |friend_request|
|
7
7
|
FriendRequest.new friend_request
|
8
8
|
end
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Friends
|
4
4
|
def friends(options = {})
|
5
|
-
users = self.connection
|
5
|
+
users = self.connection :friends, options
|
6
6
|
users.map! do |user|
|
7
|
-
User.new
|
7
|
+
User.new user[:id], user.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Games
|
4
4
|
def games(options = {})
|
5
|
-
games = self.connection
|
5
|
+
games = self.connection :games, options
|
6
6
|
games.map! do |game|
|
7
|
-
Page.new
|
7
|
+
Page.new game[:id], game.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Groups
|
4
4
|
def groups(options = {})
|
5
|
-
groups = self.connection
|
5
|
+
groups = self.connection :groups, options
|
6
6
|
groups.map! do |group|
|
7
|
-
Group.new
|
7
|
+
Group.new group[:id], group.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,11 +2,11 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Home
|
4
4
|
def home(options = {})
|
5
|
-
posts = self.connection
|
5
|
+
posts = self.connection :home, options
|
6
6
|
posts.map! do |post|
|
7
|
-
Post.new
|
7
|
+
Post.new post[:id], post.merge(
|
8
8
|
:access_token => options[:access_token] || self.access_token
|
9
|
-
)
|
9
|
+
)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -2,16 +2,16 @@ module FbGraph
|
|
2
2
|
module Connections
|
3
3
|
module Inbox
|
4
4
|
def inbox(options = {})
|
5
|
-
threads = self.connection
|
5
|
+
threads = self.connection :inbox, options
|
6
6
|
threads.map! do |thread|
|
7
7
|
if thread[:message]
|
8
|
-
Thread::BeforeTransition.new
|
8
|
+
Thread::BeforeTransition.new thread[:id], thread.merge(
|
9
9
|
:access_token => options[:access_token] || self.access_token
|
10
|
-
)
|
10
|
+
)
|
11
11
|
else
|
12
|
-
Thread.new
|
12
|
+
Thread.new thread[:id], thread.merge(
|
13
13
|
:access_token => options[:access_token] || self.access_token
|
14
|
-
)
|
14
|
+
)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -3,9 +3,13 @@ module FbGraph
|
|
3
3
|
module Insights
|
4
4
|
def insights(options = {})
|
5
5
|
options[:access_token] ||= self.access_token
|
6
|
-
insights = self.connection
|
6
|
+
insights = self.connection :insights, options.merge(
|
7
|
+
:connection_scope => connection_scope(options)
|
8
|
+
)
|
7
9
|
insights.map! do |insight|
|
8
|
-
Insight.new
|
10
|
+
Insight.new insight[:id], insight.merge(
|
11
|
+
:access_token => options[:access_token]
|
12
|
+
)
|
9
13
|
end
|
10
14
|
end
|
11
15
|
|
@@ -13,7 +17,7 @@ module FbGraph
|
|
13
17
|
|
14
18
|
def connection_scope(options)
|
15
19
|
if metrics = options.delete(:metrics)
|
16
|
-
File.join
|
20
|
+
File.join [metrics, options.delete(:period)].compact.collect(&:to_s)
|
17
21
|
else
|
18
22
|
options[:connection_scope]
|
19
23
|
end
|