Class: SecondHandler::FbSinglePost
- Inherits:
-
Object
- Object
- SecondHandler::FbSinglePost
- Includes:
- FbDataHandler
- Defined in:
- lib/second_handler.rb
Constant Summary
Constants included from FbDataHandler
Instance Method Summary collapse
- #first_comment ⇒ Object
- #get_comment ⇒ Object
- #get_post_basic ⇒ Object
-
#initialize(access_token, post_id) ⇒ FbSinglePost
constructor
A new instance of FbSinglePost.
- #next_page_comment ⇒ Object
- #next_page_comment_params ⇒ Object
- #previous_page_comment ⇒ Object
- #previous_page_comment_params ⇒ Object
Constructor Details
#initialize(access_token, post_id) ⇒ FbSinglePost
Returns a new instance of FbSinglePost.
11 12 13 14 |
# File 'lib/second_handler.rb', line 11 def initialize (access_token, post_id) @graph = Koala::Facebook::API.new(access_token) @post_id = post_id end |
Instance Method Details
#first_comment ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/second_handler.rb', line 28 def first_comment @comment = @graph.get_connections(@post_id, "comments", :limit=>1, :fields => ["from{name,id,picture}", "id", "message", "created_time", "like_count", ] ) end |
#get_comment ⇒ Object
40 41 42 43 44 |
# File 'lib/second_handler.rb', line 40 def get_comment @comment.map do |single_comment| clean_comment(single_comment) end end |
#get_post_basic ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/second_handler.rb', line 15 def get_post_basic @basic = @graph.get_object(@post_id, :fields =>[ "attachments{media,subattachments{media}}", "id", "message", "updated_time", "from{id,name,picture}", "comments.summary(1)", "likes.summary(1)" ]) clean_post_content(@basic) end |
#next_page_comment ⇒ Object
56 57 58 |
# File 'lib/second_handler.rb', line 56 def next_page_comment @comment = @comment.next_page end |
#next_page_comment_params ⇒ Object
46 47 48 |
# File 'lib/second_handler.rb', line 46 def next_page_comment_params @comment.next_page_params end |
#previous_page_comment ⇒ Object
60 61 62 |
# File 'lib/second_handler.rb', line 60 def previous_page_comment @comment = @comment.previous_page end |
#previous_page_comment_params ⇒ Object
50 51 52 |
# File 'lib/second_handler.rb', line 50 def previous_page_comment_params @comment.previous_page_params end |