WeTweet é um projeto simples que permite por uma simples requisição HTTP enviar um tweet com o clima atual de uma cidade e a média da temperatura para os próximos 5 dias.
First of all, clone this repository and run bundle install inside of the project directory.
bundle install
Now, you need to configure the credentials of Twitter, for this, you need to create a developer account on Twitter.
With the Twitter keys, run:
bundle exec rails credentials:edit --environment development
This command will be open your main text editor, the encrypted credentials file, replace text for:
twitter:
consumer_key: xxxx
consumer_secret: xxxx
access_token: xxxx
access_secret: xxx
open_weather_map:
appid: xxxx
And close editor.
Start the Rails server with the command:
bundle exec rails s
If all occurs good, you can access the project on URL http://localhost:3000/
To use this project with Docker, just run the following commands
docker-compose build
docker-compose up
To make a tweet using WeTweet, you need to request URL /twitter/send_weather
with coordinates params. Like this:
curl -X POST -H "Content-Type: application/json" -d '{"lat": "-23.561355", "lon": "-46.6578882"}' "http://localhost:3000/twitter/send_weather"
And receive the response message 'Tweet was successfully sent!'
and the weather will be displayed in the Twitter account.
Thanks for using WeTweet!