Sha256: 72a0cdd37e9a7e8f3d46f58c6b5e70049158425f98227b356a36193b94bb3d43
Contents?: true
Size: 910 Bytes
Versions: 3
Compression:
Stored size: 910 Bytes
Contents
require 'net/https' module PackageCloud module Helper def get(uri, params) uri.query = URI.encode_www_form(params) req = Net::HTTP::Get.new(uri.request_uri) req.basic_auth uri.user, uri.password if uri.user http = Net::HTTP.new(uri.hostname, uri.port) http.use_ssl = true resp = http.start { |h| h.request(req) } case resp when Net::HTTPSuccess resp else raise resp.inspect end end def post(uri, params) req = Net::HTTP::Post.new(uri.request_uri) req.form_data = params req.basic_auth uri.user, uri.password if uri.user http = Net::HTTP.new(uri.hostname, uri.port) http.use_ssl = true resp = http.start { |h| h.request(req) } case resp when Net::HTTPSuccess resp else raise resp.inspect end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
from-scratch-0.7.0 | cookbooks/packagecloud/libraries/helper.rb |
from-scratch-0.6.0 | cookbooks/packagecloud/libraries/helper.rb |
from-scratch-0.5.0 | cookbooks/packagecloud/libraries/helper.rb |