Commit dc8289e66896359180e336febd13c4996eff0019
1 parent
9048c13c
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
ok face and twitter
Showing
3 changed files
with
10 additions
and
11 deletions
Show diff stats
plugins/community_hub/facebook_stream/lib_facebook_stream.rb
... | ... | @@ -8,8 +8,9 @@ require 'json' |
8 | 8 | # BACKUP TOKEN 'CAAEhsewl0ZAcBAHhipXszZCURSwWLmgvceDbs9mB5baJdLriFxYMEzywmF2fvZBuThuA2Mm7QF8wPd3E6R5pVqVEnC2VhcBb4VrfAnkZC73ZC5g1NRUnKZCB2e6CaRiUBDatR2nf505PeKp7Aj5XxvTdfSqdZCsXxQFYZApPNSUUgkUWm6HwL4rp21MRJXb612sZD' |
9 | 9 | |
10 | 10 | def facebook_comments(hub, author_id, page_id, pooling_time, token, proxy_url) |
11 | - | |
12 | - #raise hub.id.inspect | |
11 | + if pooling_time == nil | |
12 | + pooling_time = 5 | |
13 | + end | |
13 | 14 | @graph = Koala::Facebook::API.new(token) |
14 | 15 | initialComments = [] |
15 | 16 | extractedComments = [] |
... | ... | @@ -40,6 +41,7 @@ def facebook_comments(hub, author_id, page_id, pooling_time, token, proxy_url) |
40 | 41 | newComments.each{|comment| |
41 | 42 | puts comment |
42 | 43 | noosferoComment = Comment.new |
44 | + noosferoComment.title = 'hub-message-facebook' | |
43 | 45 | noosferoComment.source_id = hub.id |
44 | 46 | noosferoComment.body = comment |
45 | 47 | noosferoComment.author_id = author_id | ... | ... |
plugins/community_hub/lib/community_hub_plugin/hub.rb
... | ... | @@ -38,26 +38,22 @@ class CommunityHubPlugin::Hub < Folder |
38 | 38 | end |
39 | 39 | |
40 | 40 | def self.twitter_service(hub, action) |
41 | - #raise hub.inspect | |
42 | - #if self.twitter_enabled == false | |
43 | 41 | author_id = 54 |
44 | 42 | if action==:start |
45 | 43 | thread = Thread.new { |
46 | - Twurl::Stream.run(hub, author_id, self.hashtags_twitter, File.dirname(__FILE__) + '/../../tweeter_stream/config/twurlrc', self.proxy_url) | |
47 | - } unless@@twitter_thread_started | |
44 | + Twurl::Stream.run(hub, author_id, hub.setting[:hashtags_twitter], File.dirname(__FILE__) + '/../../tweeter_stream/config/twurlrc', hub.setting[:proxy_url]) | |
45 | + } unless@@twitter_thread_started | |
48 | 46 | @@twitter_thread_started = true |
49 | 47 | end |
50 | 48 | end |
51 | 49 | |
52 | 50 | def self.facebook_service(hub, action) |
53 | 51 | author_id = 54 |
54 | - page_id="mundoreagindo" | |
55 | 52 | if action==:start |
56 | - #facebook_comments(page, author_id, page_id, pooling_time=5, token='CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH') | |
57 | - thread = Thread.new { | |
58 | - facebook_comments(hub, author_id, self.facebook_page_id, self.pooling_time, self.facebook_access_token, self.proxy_url) | |
53 | + thread = Thread.new { | |
54 | + facebook_comments(hub, author_id, hub.setting[:facebook_page_id], hub.setting[:facebook_pooling_time], hub.setting[:facebook_access_token], hub.setting[:proxy_url]) | |
59 | 55 | } unless@@facebook_thread_started |
60 | - @@facebook_thread_started = true | |
56 | + @@facebook_thread_started = true | |
61 | 57 | end |
62 | 58 | end |
63 | 59 | ... | ... |
plugins/community_hub/tweeter_stream/lib/twurl/request_controller.rb
... | ... | @@ -23,6 +23,7 @@ module Twurl |
23 | 23 | comment_text = ic.iconv("@#{parsed["user"]["name"]} " + _('said') + ": #{parsed["text"]}" + ' ')[0..-2] |
24 | 24 | print "#{comment_text}\n" |
25 | 25 | comment = Comment.new |
26 | + comment.title = 'hub-message-twitter' | |
26 | 27 | comment.source_id = Stream.page.id |
27 | 28 | comment.body = comment_text |
28 | 29 | comment.author_id = Stream.author_id | ... | ... |