Module: DbAgile::Restful::Client::Post

Included in:
DbAgile::Restful::Client
Defined in:
lib/dbagile/restful/client/post.rb

Instance Method Summary collapse

Instance Method Details

#post(path, tuple) ⇒ Object

Makes a post request



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/dbagile/restful/client/post.rb', line 7

def post(path, tuple)
  with_uri(path) do |uri|
    Net::HTTP.start(uri.host, uri.port) {|http|
      req = Net::HTTP::Post.new(uri.path)
      req.set_form_data(tuple)
      res = http.request(req)
      yield(res, http)
      res.body
    }
  end
end