This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Documentation and How to generate the API Key: https://developers.google.com/url-shortener/v1/getting_started | |
# | |
module Utils | |
class Googl | |
END_POINT = "https://www.googleapis.com/urlshortener/v1/url?key=YOUT_KEY_HERE" | |
# | |
# Cria uma Short URL utilizando o servido do Google: goo.gl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cria a data de publicacao no formato 'há XX YY atrás | |
# | |
def created_at_tempos_atras | |
agora = Time.now | |
dif = (agora - self.created_at).to_i | |
if dif < 60 | |
dif = "#{dif} segundos" | |
elsif dif > 59 && dif < 120 |