Class: DesignQuotes

Inherits:
Object
  • Object
show all
Defined in:
lib/design-quotes.rb

Class Method Summary collapse

Class Method Details

.showObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/design-quotes.rb', line 7

def self.show
  gibberish = RestClient.get("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1")

  arrhash = JSON.parse(gibberish)
  hash = arrhash.first

  author = hash["title"]
  quote = HTMLEntities.new.decode(hash["content"]).gsub(/(<.{1,3}>)/, "").strip

  quote = "\"#{quote}\""

  puts quote
  puts "-#{author}"
end