Sha256: 98ac57dd35b9722fa95874056470fcf83b277a0f26f9f67a6fd4fa90347d0ae7
Contents?: true
Size: 873 Bytes
Versions: 2
Compression:
Stored size: 873 Bytes
Contents
require 'rest-client' module CapistranoPayload module Request TIMEOUT = 4 OPEN_TIMEOUT = 4 CONTENT_TYPES = { :form => 'application/x-www-form-urlencoded', :json => 'application/json', :yaml => 'application/x-yaml', :xml => 'application/xml' }.freeze # Performs a HTTP request # # method - Request method (:get, :post, :put, :delete) # url - Target URL # payload - Delivery content # format - Delivery format # def request(method, url, payload, format) opts = { :method => method, :url => url, :payload => payload, :headers => {:content_type => CONTENT_TYPES[format]}, :timeout => TIMEOUT, :open_timeout => OPEN_TIMEOUT } RestClient::Request.execute(opts) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
capistrano-payload-0.4.0 | lib/capistrano-payload/request.rb |
capistrano-payload-0.3.0 | lib/capistrano-payload/request.rb |