Class: FunnyTerminal::Quote

Inherits:
Object
  • Object
show all
Defined in:
lib/funny_terminal/quote.rb

Class Method Summary collapse

Class Method Details



16
17
18
19
20
21
# File 'lib/funny_terminal/quote.rb', line 16

def self.print(json)
  quote = json["quote"]
  puts quote["message"]
  puts quote["author"]
  Catpix::print_image_url quote["image"]
end

.requestObject



7
8
9
10
11
12
13
14
# File 'lib/funny_terminal/quote.rb', line 7

def self.request
  url = API_SERVER + "quotes/random"
  uri = URI(url)
  response = Net::HTTP.get(uri)
  json = JSON.parse(response)

  print(json)
end