Sha256: e2ff0e04c38d0d0fdbf7b1631c2b929c48778f91ad49a222398d0be238940634
Contents?: true
Size: 1.15 KB
Versions: 57
Compression:
Stored size: 1.15 KB
Contents
require "net/http" require "openssl" module ShopifyCLI class HttpRequest class << self def post(uri, body, headers) req = ::Net::HTTP::Post.new(uri.request_uri) request(uri, body, headers, req) end def put(uri, body, headers) req = ::Net::HTTP::Put.new(uri.request_uri) request(uri, body, headers, req) end def get(uri, body, headers) req = ::Net::HTTP::Get.new(uri.request_uri) request(uri, body, headers, req) end def delete(uri, body, headers) req = ::Net::HTTP::Delete.new(uri.request_uri) request(uri, body, headers, req) end def request(uri, body, headers, req) cert_store = OpenSSL::X509::Store.new cert_store.set_default_paths http = ::Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.cert_store = cert_store http.verify_mode = OpenSSL::SSL::VERIFY_NONE if ENV["SSL_VERIFY_NONE"] req.body = body unless body.nil? req["Content-Type"] = "application/json" headers.each { |header, value| req[header] = value } http.request(req) end end end end
Version data entries
57 entries across 57 versions & 1 rubygems