Class: Railslove::Cli::Tweet

Inherits:
Thor
  • Object
show all
Defined in:
lib/railslove-cli/tweet.rb

Instance Method Summary collapse

Instance Method Details

#list(page = 1) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/railslove-cli/tweet.rb', line 9

def list(page = 1)
  tweets = HTTParty.get("http://api.railslove.com/tweets.json?page=#{page}")

  printf(" %-140s %-20s %-15s\n", "text", "published_at", "author_slug")
  puts "-"*180
  tweets["tweets"].each do |tweet|
    printf(" %-140s %-20s %-15s\n", tweet["tweet"]["text"].gsub("\n",""), tweet["tweet"]["published_at"], tweet["tweet"]["author"]["slug"])
  end
  puts "-"*180
end