Commit ecbb4963dfb075d21613655d19bb974063eaee54
1 parent
01ceca9c
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
facebook hashtag working
Showing
2 changed files
with
11 additions
and
18 deletions
Show diff stats
plugins/community_hub/facebook_stream/lib_facebook_stream.rb
| ... | ... | @@ -3,16 +3,17 @@ require 'open-uri' |
| 3 | 3 | require 'json' |
| 4 | 4 | |
| 5 | 5 | |
| 6 | - def not_blank(v) | |
| 7 | - if v == nil || v == "" | |
| 8 | - false | |
| 9 | - else | |
| 10 | - true | |
| 11 | - end | |
| 6 | +def not_blank(v) | |
| 7 | + if v == nil || v == "" | |
| 8 | + false | |
| 9 | + else | |
| 10 | + true | |
| 12 | 11 | end |
| 12 | +end | |
| 13 | 13 | |
| 14 | 14 | |
| 15 | -def facebook_comments(hub, author_id, hashtag, pooling_time, token, proxy_url) | |
| 15 | +def facebook_comments(hub, author_id, hashtag, pooling_time, token) | |
| 16 | + | |
| 16 | 17 | |
| 17 | 18 | puts "entrou" |
| 18 | 19 | |
| ... | ... | @@ -82,8 +83,7 @@ def facebook_comments(hub, author_id, hashtag, pooling_time, token, proxy_url) |
| 82 | 83 | puts "#{comment['from']['name']} " + _("said") + ": #{comment['message']}" |
| 83 | 84 | noosferoComment = Comment.new |
| 84 | 85 | noosferoComment.title = 'hub-message-facebook' |
| 85 | - noosferoComment.source = Article.last | |
| 86 | - #noosferoComment.source = hub | |
| 86 | + noosferoComment.source = hub | |
| 87 | 87 | noosferoComment.body = comment['message'] |
| 88 | 88 | noosferoComment.author_id = author_id |
| 89 | 89 | noosferoComment.name = comment['from']['name'] |
| ... | ... | @@ -96,10 +96,3 @@ def facebook_comments(hub, author_id, hashtag, pooling_time, token, proxy_url) |
| 96 | 96 | sleep(pooling_time) |
| 97 | 97 | end |
| 98 | 98 | end |
| 99 | - | |
| 100 | - | |
| 101 | - | |
| 102 | -facebook_comments(nil, 54, "nba", 5, nil, nil) | |
| 103 | - | |
| 104 | - | |
| 105 | -puts "ola" | |
| 106 | 99 | \ No newline at end of file | ... | ... |
plugins/community_hub/lib/community_hub_plugin/listener.rb
| ... | ... | @@ -9,7 +9,7 @@ class CommunityHubPlugin::Listener |
| 9 | 9 | end |
| 10 | 10 | |
| 11 | 11 | def facebook_service(hub) |
| 12 | - facebook_comments(hub, nil, hub.facebook_hashtag, hub.facebook_pooling_time, hub.facebook_access_token, hub.proxy_url) | |
| 12 | + facebook_comments(hub, nil, hub.facebook_hashtag, hub.facebook_pooling_time, hub.facebook_access_token) | |
| 13 | 13 | end |
| 14 | 14 | |
| 15 | 15 | def run |
| ... | ... | @@ -39,7 +39,7 @@ class CommunityHubPlugin::Listener |
| 39 | 39 | end |
| 40 | 40 | |
| 41 | 41 | def log(message) |
| 42 | - #puts message | |
| 42 | + puts message | |
| 43 | 43 | initialize_logger unless @initiated |
| 44 | 44 | @initiated ||= true |
| 45 | 45 | @logger << "[#{Time.now.strftime('%F %T %z')}] #{message}\n" | ... | ... |