class OxfordDictionary::Endpoints::Lemmas

Interface for the /lemmas endpoint

API documentation can be found here: developer.oxforddictionaries.com/documentation

Constants

ENDPOINT

Public Instance Methods

lemma(word:, language:, params: {}) click to toggle source

Returns all possible lemmas for a word

@param [String] word the inflected word to search for @param [String] language the language to search in @param [Hash] params the query parameters in the request

@example Search for the verb lemmas of 'running' in 'en'

lemma(
  word: 'running',
  language: 'en',
  params: { lexicalCategory: 'verb' }
)

@return [OpenStruct] the JSON response parsed into an OpenStruct

# File lib/oxford_dictionary/endpoints/lemmas.rb, line 26
def lemma(word:, language:, params: {})
  path = "#{ENDPOINT}/#{language}/#{word}"
  uri = request_uri(path: path, params: params)

  response = @request_client.get(uri: uri)
  deserialize.call(response.body)
end