Class: SecondHandler::FbGroupPost
- Inherits:
-
Object
- Object
- SecondHandler::FbGroupPost
- Defined in:
- lib/second_handler.rb
Instance Method Summary collapse
- #first_page ⇒ Object
-
#get_content ⇒ Object
return feed of current page infomation , including image.
-
#initialize(access_token, group_id) ⇒ FbGroupPost
constructor
A new instance of FbGroupPost.
- #next_page ⇒ Object
- #previous_page ⇒ Object
Constructor Details
#initialize(access_token, group_id) ⇒ FbGroupPost
Returns a new instance of FbGroupPost.
6 7 8 9 |
# File 'lib/second_handler.rb', line 6 def initialize (access_token, group_id) @graph = Koala::Facebook::API.new(access_token) @group_id = group_id end |
Instance Method Details
#first_page ⇒ Object
11 12 13 |
# File 'lib/second_handler.rb', line 11 def first_page @feed = @graph.get_connections(@group_id, "feed", :fields => ["attachments{media,subattachments{media}}","id","message","updated_time"]) end |
#get_content ⇒ Object
return feed of current page infomation , including image
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/second_handler.rb', line 24 def get_content @feed.map do |item| tmp = Hash.new tmp["id"] = item["id"] tmp["message"] = item["message"] tmp["updated_time"] = item["updated_time"] tmp["attachments"] = (item["attachments"]) tmp end end |
#next_page ⇒ Object
15 16 17 |
# File 'lib/second_handler.rb', line 15 def next_page @feed = @feed.next_page end |
#previous_page ⇒ Object
19 20 21 |
# File 'lib/second_handler.rb', line 19 def previous_page @feed = @feed.previous_page end |