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
-
#specified_comment(token, action) ⇒ Object
- Get specified page comment == Parameters: token
- paging token actions
-
canbe :before or :after.
Constructor Details
#initialize(access_token, post_id) ⇒ FbSinglePost
Returns a new instance of FbSinglePost.
20 21 22 23 |
# File 'lib/second_handler.rb', line 20 def initialize (access_token, post_id) @graph = Koala::Facebook::API.new(access_token) @post_id = post_id end |
Instance Method Details
#first_comment ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/second_handler.rb', line 37 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
71 72 73 74 75 |
# File 'lib/second_handler.rb', line 71 def get_comment @comment.map do |single_comment| clean_comment(single_comment) end end |
#get_post_basic ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/second_handler.rb', line 24 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
87 88 89 |
# File 'lib/second_handler.rb', line 87 def next_page_comment @comment = @comment.next_page end |
#next_page_comment_params ⇒ Object
77 78 79 |
# File 'lib/second_handler.rb', line 77 def next_page_comment_params @comment.next_page_params end |
#previous_page_comment ⇒ Object
91 92 93 |
# File 'lib/second_handler.rb', line 91 def previous_page_comment @comment = @comment.previous_page end |
#previous_page_comment_params ⇒ Object
81 82 83 |
# File 'lib/second_handler.rb', line 81 def previous_page_comment_params @comment.previous_page_params end |
#specified_comment(token, action) ⇒ Object
Get specified page comment
Parameters:
- token
-
paging token
- actions
-
canbe :before or :after
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/second_handler.rb', line 56 def specified_comment(token, action) @comment = @graph.get_connections(@post_id, "comments", :limit=>1, :fields => ["from{name,id,picture}", "id", "message", "created_time", "like_count", ], action => token, ) end |