Sha256: c3ddb68b82a37463f9c045614290fd521fbe8947383188a1bcccbbd549a2bdae
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
require 'oxford_dictionary/endpoints/endpoint' module OxfordDictionary module Endpoints # Interface for the /lemmas endpoint # # API documentation can be found here: # https://developer.oxforddictionaries.com/documentation class Lemmas < Endpoint ENDPOINT = 'lemmas'.freeze # 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 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oxford_dictionary-3.0.0 | lib/oxford_dictionary/endpoints/lemmas.rb |