Class: Jah::PostAgent

Inherits:
Object
  • Object
show all
Defined in:
lib/jah/agents/post.rb

Instance Method Summary collapse

Instance Method Details

#post(url, error, body, headers = Hash.new, &response_handler) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/jah/agents/post.rb', line 6

def post(url, error, body, headers = Hash.new, &response_handler)
  return unless url
  request(url, response_handler, error) do |connection|
    post = Net::HTTP::Post.new( url.path +
                                (url.query ? ('?' + url.query) : ''),
                                HTTP_HEADERS.merge(headers) )
    post.body = body
    connection.request(post)
  end
end