Using Unirest to build a terminal dictionary app

Dan Ingenthron
Mar 4, 2018 · 2 min read
gem install unirest
print “Enter a word:”
word = gets.chomp
response = Unirest.get(“http://api.wordnik.com/v4/word.json/#{word}/definitions?limit=200&includeRelated=true&useCanonical=false&includeTags=false&api_key=a2a73e7b926c924fad7001ca3111acd55af2ffabf50eb4ae5").body
response.length.times do |i|
definition = response[i][“text”]
puts “#{i + 1}. #{response[i][“text”]}”
puts
end

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade