Sha256: 2a73a3bd81a77363e59bffefe1ac3d9afc1ee4b3b99fcf0821b93576243a90c1

Contents?: true

Size: 982 Bytes

Versions: 11

Compression:

Stored size: 982 Bytes

Contents

module HttpUtilities
  module Http
    module Post

      def post_and_retrieve_parsed_html(url, data, options = {})
        options.merge!({:force_encoding => true, :format => :html})
        return post_and_retrieve_content(url, data, options)
      end

      def post_and_retrieve_parsed_xml(url, data, options = {})
        options.merge!({:force_encoding => true, :format => :xml})
        return post_and_retrieve_content(url, data, options)
      end

      def post_and_retrieve_content(url, data, options = {})
        response        =   nil
        method          =   options[:method] || :net_http
        response_only   =   options.delete(:response_only) { |e| true }

        if (method.eql?(:net_http))
          response = post_and_retrieve_content_using_net_http(url, data, options)
        elsif (method.eql?(:curl))
          response = post_and_retrieve_content_using_curl(url, data, options)
        end

        return response
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
http_utilities-1.1.2 lib/http_utilities/http/post.rb
http_utilities-1.1.1 lib/http_utilities/http/post.rb
http_utilities-1.1.0 lib/http_utilities/http/post.rb
http_utilities-1.0.9 lib/http_utilities/http/post.rb
http_utilities-1.0.8 lib/http_utilities/http/post.rb
http_utilities-1.0.7.1 lib/http_utilities/http/post.rb
http_utilities-1.0.7 lib/http_utilities/http/post.rb
http_utilities-1.0.6 lib/http_utilities/http/post.rb
http_utilities-1.0.5 lib/http_utilities/http/post.rb
http_utilities-1.0.2 lib/http_utilities/http/post.rb
http_utilities-1.0.1 lib/http_utilities/http/post.rb