Module: HttpUtilities::Http::Post

Included in:
Client
Defined in:
lib/http_utilities/http/post.rb

Instance Method Summary collapse

Instance Method Details

#post_and_retrieve_content(url, data, options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/http_utilities/http/post.rb', line 15

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

#post_and_retrieve_parsed_html(url, data, options = {}) ⇒ Object



5
6
7
8
# File 'lib/http_utilities/http/post.rb', line 5

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

#post_and_retrieve_parsed_xml(url, data, options = {}) ⇒ Object



10
11
12
13
# File 'lib/http_utilities/http/post.rb', line 10

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