Class: Joker::Teller

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

Overview

Your code goes hereā€¦

Class Method Summary collapse

Class Method Details

.tellObject



14
15
16
17
18
19
20
21
22
# File 'lib/joker.rb', line 14

def self.tell
  conn = Faraday.new do |f|
    f.response :json # decode response bodies as JSON
  end
  
  response = conn.get('https://v2.jokeapi.dev/joke/Programming', {type: 'single', blacklistFlags: 'nsfw,racist,sexist,explicit'})

  response.body["joke"]
end