Sha256: 1f5174e37e17507af3e14687e150b3c09870aab6b441d3ae9062bf5289a11322

Contents?: true

Size: 491 Bytes

Versions: 8

Compression:

Stored size: 491 Bytes

Contents

require 'httpclient'

module Barometer
  module Utils
    module Post
      def self.call(url, params={})
        http = HTTPClient.new
        http.receive_timeout = Barometer.timeout
        http.post(url, default_params.merge(params)).content
      rescue HTTPClient::TimeoutError
        raise Barometer::TimeoutError
      end

      private

      def self.default_params
        {
          documentType: 'text/html',
          outputType: 'xml'
        }
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
barometer-0.9.7 lib/barometer/utils/post.rb
barometer-0.9.6 lib/barometer/utils/post.rb
barometer-0.9.5 lib/barometer/utils/post.rb
barometer-0.9.4 lib/barometer/utils/post.rb
barometer-0.9.3 lib/barometer/utils/post.rb
barometer-0.9.2 lib/barometer/utils/post.rb
barometer-0.9.1 lib/barometer/utils/post.rb
barometer-0.9.0 lib/barometer/utils/post.rb