Class: SecondHandler::FbGroupPost
- Inherits:
-
Object
- Object
- SecondHandler::FbGroupPost
show all
- Includes:
- FbDataHandler
- Defined in:
- lib/second_handler.rb
Constant Summary
collapse
- FB_POSTS_FIELDS =
[
"attachments{media,subattachments{media}}",
"id",
"message",
"updated_time",
"from{id,name,picture}",
"comments.summary(1)",
"likes.summary(1)"
]
FbDataHandler::FACEBOOK_URL
Instance Method Summary
collapse
Constructor Details
#initialize(access_token, group_id) ⇒ FbGroupPost
Returns a new instance of FbGroupPost.
110
111
112
113
114
|
# File 'lib/second_handler.rb', line 110
def initialize (access_token, group_id)
@graph = Koala::Facebook::API.new(access_token)
@group_id = group_id
@message_parser = FBParsers.message_parser @group_id
end
|
Instance Method Details
#first_page(page_token = nil, until_stamp = nil) ⇒ Object
116
117
118
|
# File 'lib/second_handler.rb', line 116
def first_page(page_token=nil,until_stamp=nil)
@feed = @graph.get_connections(@group_id, "feed",:fields => FB_POSTS_FIELDS )
end
|
#get_content(&func) ⇒ Object
return feed of current page infomation , including image
147
148
149
150
151
152
153
154
155
156
|
# File 'lib/second_handler.rb', line 147
def get_content (&func)
data = Array.new
@feed.to_a.each do |single_post|
begin
data << clean_post_content(single_post, &@message_parser)
rescue
end
end
data
end
|
#next_page ⇒ Object
130
131
132
|
# File 'lib/second_handler.rb', line 130
def next_page
@feed = @feed.next_page
end
|
#next_page_params ⇒ Object
134
135
136
|
# File 'lib/second_handler.rb', line 134
def next_page_params
@feed.next_page_params
end
|
#previous_page ⇒ Object
142
143
144
|
# File 'lib/second_handler.rb', line 142
def previous_page
@feed = @feed.previous_page
end
|
#previous_page_params ⇒ Object
138
139
140
|
# File 'lib/second_handler.rb', line 138
def previous_page_params
@feed.previous_page_params
end
|
#specified_page(page_token, until_stamp = nil, since_stamp = nil) ⇒ Object
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/second_handler.rb', line 120
def specified_page (page_token,until_stamp=nil,since_stamp=nil)
@feed = @graph.get_connections(@group_id, "feed",
:__paging_token => page_token,
:until => until_stamp,
:since => since_stamp,
:fields => FB_POSTS_FIELDS
)
end
|