What Is
What the hell is this gem for? To put simply, this library enables us (developers) to define a given word. Think "dictionary". It uses the Merriam-Webster's API as the reference for giving the definitions.
Setup
Register an account on http://www.dictionaryapi.com/ and make sure you request an api key for Collegiate Dictionary and Collegiate Thesaurus. These are the two references that this library supports for now.
After registration, you should already have two api keys; one for the dictionary and other is for the thesaurus version.
Installation
Add this line to your application's Gemfile:
gem 'what_is'
And then execute:
$ bundle
Or install it yourself as:
$ gem install what_is
Usage
Configure your api keys first.
WhatIs.configure do |config|
config.thesaurus_api_key = "<api key here>"
config.dictionary_api_key = "<api key here>"
end
Implementation.
x = WhatIs::Define.new("<insert word to define>", <reference>) # where reference can be :thesaurus or :dictionary
x.define! # returns the meaning of the word
Contributing
- Fork it ( http://github.com/
what_is/fork ) - Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request