0

At the moment my Rails app can tweet via twitter gem, and I would like to add a geotag to my tweets. The geolocation is constant. How can I do this?

Twitter::Client.new.update('Hello, there!')
Andrei
  • 10,918
  • 12
  • 76
  • 110

1 Answers1

2
Twitter.configure do |config|
  config.consumer_key = YOUR_CONSUMER_KEY
  config.consumer_secret = YOUR_CONSUMER_SECRET
  config.oauth_token = YOUR_OAUTH_TOKEN
  config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end

# Initialize your Twitter client
client = Twitter::Client.new

# Post a status update
client.update("I just posted a status update via the Twitter Ruby Gem!", {:lat => 38.89859, :long => -77.035971})

The user has to have checked the "Add a location to your tweets" option in their settings (aka geo_enabled)

Source: Twitter Gem API

Ben Moss
  • 143
  • 1
  • 9