Sha256: d0f2421bd503ad7eff3332d64a04b2d1f5d1bb8407bdd195a467819030e4b533

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

require 'oxford_dictionary/endpoints/endpoint'

module OxfordDictionary
  module Endpoints
    class Sentences < Endpoint
      ENDPOINT = 'sentences'.freeze

      def sentence(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/sentences.rb