Sha256: 7494eb63c21c6021c9a9039cc8de53de82643126da781916342c978d4d11d695
Contents?: true
Size: 682 Bytes
Versions: 11
Compression:
Stored size: 682 Bytes
Contents
require "net/http" 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 get(uri, body, headers) req = ::Net::HTTP::Get.new(uri.request_uri) request(uri, body, headers, req) end def request(uri, body, headers, req) http = ::Net::HTTP.new(uri.host, uri.port) http.use_ssl = true 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
11 entries across 11 versions & 1 rubygems