Sha256: 71bebc2a00f7873af6350f4ea8a636393486bc93e39e7ee895a40acdce3bc2a8

Contents?: true

Size: 718 Bytes

Versions: 3

Compression:

Stored size: 718 Bytes

Contents

require 'oxford_dictionary/endpoints/endpoint'

module OxfordDictionary
  module Endpoints
    class Search < Endpoint
      ENDPOINT = 'search'.freeze

      def search(language:, params: {})
        path = "#{ENDPOINT}/#{language}"
        uri = request_uri(path: path, params: params)

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

      def search_translation(source_language:, target_language:, params: {})
        path = "#{ENDPOINT}/translations/#{source_language}/#{target_language}"
        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/search.rb
oxford_dictionary-2.0.0 lib/oxford_dictionary/endpoints/search.rb
oxford_dictionary-1.3.1 lib/oxford_dictionary/endpoints/search.rb