Sha256: e27fbde973f1a0b5db037c4d49c55b6bacf4121406f06930c2140b020f7888e2
Contents?: true
Size: 964 Bytes
Versions: 1
Compression:
Stored size: 964 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 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) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shopify-cli-2.0.0 | lib/shopify-cli/http_request.rb |