Sha256: 56e640254dcb7a7f52ce16f3701164bd3ab1f5fc578f25ad5b61771e6fdd7fbd

Contents?: true

Size: 508 Bytes

Versions: 1

Compression:

Stored size: 508 Bytes

Contents

require 'oxford_dictionary/endpoints/endpoint'

module OxfordDictionary
  module Endpoints
    class Thesaurus < Endpoint
      ENDPOINT = 'thesaurus'.freeze

      def thesaurus(word:, language:, params: {})
        query_string = "#{ENDPOINT}/#{language}/#{word}"
        uri = URI(query_string)

        unless params.empty?
          uri.query = URI.encode_www_form(params)
        end

        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-1.3.0 lib/oxford_dictionary/endpoints/thesaurus.rb