Sha256: 7d31fd3b85a303f5e0896771c8ea493d2f7e32c7007827ac2f298b4427788244
Contents?: true
Size: 786 Bytes
Versions: 14
Compression:
Stored size: 786 Bytes
Contents
# frozen_string_literal: true require "net/http" module Buildkite::TestCollector class HTTPClient attr :authorization_header def initialize(url) @url = url @authorization_header = "Token token=\"#{Buildkite::TestCollector.api_token}\"" end def post contact_uri = URI.parse(url) http = Net::HTTP.new(contact_uri.host, contact_uri.port) http.use_ssl = contact_uri.scheme == "https" contact = Net::HTTP::Post.new(contact_uri.path, { "Authorization" => authorization_header, "Content-Type" => "application/json", }) contact.body = { run_env: Buildkite::TestCollector::CI.env, format: "websocket" }.to_json http.request(contact) end private attr :url end end
Version data entries
14 entries across 14 versions & 1 rubygems