Module: FbGraph::Connections::Feed
- Included in:
- Application, Event, Group, Page, User
- Defined in:
- lib/fb_graph/connections/feed.rb
Instance Method Summary collapse
-
#feed(options = {}) ⇒ Object
Fetching Wall posts.
-
#feed!(options = {}) ⇒ Object
Updating Wall.
Instance Method Details
#feed(options = {}) ⇒ Object
Fetching Wall posts
User Wall
FbGraph::User.new(username).feed
# => Array of FbGraph::Post
Page Wall
FbGraph::Page.new(page_id).feed
# => Array of FbGraph::Post
Application Wall
FbGraph::Application.new(page_id).feed
# => Array of FbGraph::Post
Event Wall
FbGraph::Event.new(page_id).feed
# => Array of FbGraph::Post
Group Wall
FbGraph::Group.new(page_id).feed
# => Array of FbGraph::Post
30 31 32 33 34 35 36 37 |
# File 'lib/fb_graph/connections/feed.rb', line 30 def feed( = {}) posts = self.connection(:feed, ) posts.map! do |post| Post.new(post.delete(:id), post.merge( :access_token => [:access_token] || self.access_token )) end end |
#feed!(options = {}) ⇒ Object
Updating Wall
-
See supported arguments here developers.facebook.com/docs/reference/api/post
-
You need admin user’s access_token to update Page/Application/Event/Group wall as itself
User Wall
me = FbGraph::User.me(ACCESS_TOKEN)
me.feed!(
:message => 'Updating via FbGraph'
)
Page Wall
page = FbGraph::Page.new(page_id)
page.feed!(
:access_token => ACCESS_TOKEN,
:message => 'Updating via FbGraph'
)
Application Wall
application = FbGraph::Page.new(application_id)
application.feed!(
:access_token => ACCESS_TOKEN,
:message => 'Updating via FbGraph'
)
Event Wall
event = FbGraph::Event.new(event_id)
event.feed!(
:access_token => ACCESS_TOKEN,
:message => 'Updating via FbGraph'
)
Group Wall
group = FbGraph::Group.new(group_id)
group.feed!(
:access_token => ACCESS_TOKEN,
:message => 'Updating via FbGraph'
)
82 83 84 85 86 87 |
# File 'lib/fb_graph/connections/feed.rb', line 82 def feed!( = {}) post = post(.merge(:connection => 'feed')) Post.new(post.delete(:id), .merge(post).merge( :access_token => [:access_token] || self.access_token )) end |