|
@ -14,12 +14,16 @@ client = Twitter::Streaming::Client.new do |config| |
|
|
config.access_token_secret = $config['global']['TWITTER_ACCESS_TOKEN_SECRET'] |
|
|
config.access_token_secret = $config['global']['TWITTER_ACCESS_TOKEN_SECRET'] |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
client.user do |obj| |
|
|
|
|
|
|
|
|
filters = { |
|
|
|
|
|
track: $config['global']['GAME_HASHTAG'] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
client.filter(filters) do |obj| |
|
|
case obj |
|
|
case obj |
|
|
when Twitter::Tweet |
|
|
when Twitter::Tweet |
|
|
puts "Got a tweet" |
|
|
puts "Got a tweet" |
|
|
puts obj.to_h.to_json |
|
|
puts obj.to_h.to_json |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
response = HTTParty.post "#{$config['global']['APP_URL']}/twitter/stream", { |
|
|
response = HTTParty.post "#{$config['global']['APP_URL']}/twitter/stream", { |
|
|
body: obj.to_h.to_json, |
|
|
body: obj.to_h.to_json, |
|
|
headers: {'Content-Type' => 'application/json'} |
|
|
headers: {'Content-Type' => 'application/json'} |
|
@ -32,4 +36,3 @@ client.user do |obj| |
|
|
puts "Falling behind!" |
|
|
puts "Falling behind!" |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|