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