Class BSV::Overlay::HTTPSBroadcastFacilitator ¶
Inherits: BSV::Overlay::BroadcastFacilitator
Default HTTPS-based broadcast facilitator using Net::HTTP.
POSTs to +{url}/submit+ with a binary BEEF body, +Content-Type: application/octet-stream+, and an X-Topics header containing the JSON-encoded list of topics for the tagged BEEF.
HTTPS is enforced by default; pass +allow_http: true+ to permit plain HTTP (useful for local development and testing).
An injectable http_client may be supplied for testing. It must respond to +#request(uri, net_http_request)+ and return an object with #code and #body.
Constants¶
DEFAULT_TIMEOUT ¶
Not documented.
Public Instance Methods¶
initialize(allow_http: = false, http_client: = nil, timeout: = DEFAULT_TIMEOUT) ¶
- @param
allow_http[Boolean] permit non-HTTPS URLs (default: false) - @param
http_client[#request, nil] injectable HTTP client for testing - @param
timeout[Integer] request timeout in seconds (default: 30) - @return [HTTPSBroadcastFacilitator] a new instance of HTTPSBroadcastFacilitator
send_beef(url, tagged_beef) ¶
Send a tagged BEEF to +{url}/submit+ and return the parsed STEAK hash. - @param url [String] base URL of the Overlay Services host - @param tagged_beef [TaggedBEEF] the tagged BEEF to broadcast - @raise [ArgumentError] if the URL is not HTTPS and +allow_http+ is false - @return [Hash{String => AdmittanceInstructions}, nil] parsed STEAK response, or nil if the host returned an error or the response could not be parsed