class DictionaryAPI::DictionaryAPI
Attributes
api_key[RW]
Public Class Methods
new(key)
click to toggle source
# File lib/dictionary_api.rb, line 11 def initialize(key) @api_key = key end
Public Instance Methods
get_langs()
click to toggle source
# File lib/dictionary_api.rb, line 15 def get_langs JSON.parse client.execute('getLangs', {key: @api_key}).body end
lookup(lang, text)
click to toggle source
# File lib/dictionary_api.rb, line 19 def lookup(lang, text) response = JSON.parse client.execute('lookup', {key: @api_key, lang: lang, text: text}).body parser.parse(response) end
Protected Instance Methods
client()
click to toggle source
# File lib/dictionary_api.rb, line 26 def client @client ||= Client.new end
parser()
click to toggle source
# File lib/dictionary_api.rb, line 30 def parser @parser ||= Parser.new end