From ecbb4963dfb075d21613655d19bb974063eaee54 Mon Sep 17 00:00:00 2001 From: Evandro Junior Date: Thu, 22 May 2014 22:11:59 +0000 Subject: [PATCH] facebook hashtag working --- plugins/community_hub/facebook_stream/lib_facebook_stream.rb | 25 +++++++++---------------- plugins/community_hub/lib/community_hub_plugin/listener.rb | 4 ++-- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/plugins/community_hub/facebook_stream/lib_facebook_stream.rb b/plugins/community_hub/facebook_stream/lib_facebook_stream.rb index b85f459..307967c 100644 --- a/plugins/community_hub/facebook_stream/lib_facebook_stream.rb +++ b/plugins/community_hub/facebook_stream/lib_facebook_stream.rb @@ -3,16 +3,17 @@ require 'open-uri' require 'json' - def not_blank(v) - if v == nil || v == "" - false - else - true - end +def not_blank(v) + if v == nil || v == "" + false + else + true end +end -def facebook_comments(hub, author_id, hashtag, pooling_time, token, proxy_url) +def facebook_comments(hub, author_id, hashtag, pooling_time, token) + puts "entrou" @@ -82,8 +83,7 @@ def facebook_comments(hub, author_id, hashtag, pooling_time, token, proxy_url) puts "#{comment['from']['name']} " + _("said") + ": #{comment['message']}" noosferoComment = Comment.new noosferoComment.title = 'hub-message-facebook' - noosferoComment.source = Article.last - #noosferoComment.source = hub + noosferoComment.source = hub noosferoComment.body = comment['message'] noosferoComment.author_id = author_id noosferoComment.name = comment['from']['name'] @@ -96,10 +96,3 @@ def facebook_comments(hub, author_id, hashtag, pooling_time, token, proxy_url) sleep(pooling_time) end end - - - -facebook_comments(nil, 54, "nba", 5, nil, nil) - - -puts "ola" \ No newline at end of file diff --git a/plugins/community_hub/lib/community_hub_plugin/listener.rb b/plugins/community_hub/lib/community_hub_plugin/listener.rb index a99555d..06d234e 100644 --- a/plugins/community_hub/lib/community_hub_plugin/listener.rb +++ b/plugins/community_hub/lib/community_hub_plugin/listener.rb @@ -9,7 +9,7 @@ class CommunityHubPlugin::Listener end def facebook_service(hub) - facebook_comments(hub, nil, hub.facebook_hashtag, hub.facebook_pooling_time, hub.facebook_access_token, hub.proxy_url) + facebook_comments(hub, nil, hub.facebook_hashtag, hub.facebook_pooling_time, hub.facebook_access_token) end def run @@ -39,7 +39,7 @@ class CommunityHubPlugin::Listener end def log(message) - #puts message + puts message initialize_logger unless @initiated @initiated ||= true @logger << "[#{Time.now.strftime('%F %T %z')}] #{message}\n" -- libgit2 0.21.2