Sha256: 67320a4e5eebba8cd00f857f77e54d1ba7f090aa77379830a1fd21ef4915cb1f

Contents?: true

Size: 489 Bytes

Versions: 3

Compression:

Stored size: 489 Bytes

Contents

require 'oxford_dictionary/endpoints/endpoint'

module OxfordDictionary
  module Endpoints
    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

3 entries across 3 versions & 1 rubygems

Version Path
oxford_dictionary-2.0.1 lib/oxford_dictionary/endpoints/translations.rb
oxford_dictionary-2.0.0 lib/oxford_dictionary/endpoints/translations.rb
oxford_dictionary-1.3.1 lib/oxford_dictionary/endpoints/translations.rb