Sha256: 549f3a77acbefd3bebe31e5ca1c5dccb6e39f60b488aa2dbecfa8280c4da0c7f

Contents?: true

Size: 646 Bytes

Versions: 1

Compression:

Stored size: 646 Bytes

Contents

require 'oxford_dictionary/endpoints/endpoint'

module OxfordDictionary
  module Endpoints
    # Interface for the /translations endpoint
    #
    # API documentation can be found here:
    # https://developer.oxforddictionaries.com/documentation
    class Translations < Endpoint
      ENDPOINT = 'translations'.freeze

      def translation(word:, source_language:, target_language:, params: {})
        path = "#{ENDPOINT}/#{source_language}/#{target_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/translations.rb