Class: Portage::Ucp::Manifest
- Inherits:
-
Object
- Object
- Portage::Ucp::Manifest
- Defined in:
- lib/portage/ucp/manifest.rb
Overview
Builds the /.well-known/ucp discovery document: protocol version, the business's advertised capabilities (only those the Adapter overrides — see Capability#advertised_for?), payment handlers, signing keys, and the services array (transport + endpoint, e.g. "mcp", endpoint: "https://...") a client needs to find where to actually connect. Signing keys are never generated here — see §9, consumer-provided only.
Constant Summary collapse
- UCP_VERSION =
"2026-04-08".freeze
Instance Method Summary collapse
-
#initialize(adapter:, business: Portage::Ucp.configuration.business, registry: Portage::Ucp.configuration.registry, payment_handlers: Portage::Ucp.configuration.payment_handlers, signing_keys: Portage::Ucp.configuration.signing_keys, signer: Portage::Ucp.configuration.signer, services: Portage::Ucp.configuration.services) ⇒ Manifest
constructor
A new instance of Manifest.
-
#to_h ⇒ Object
Nests everything under a "ucp" envelope, and keys
capabilitiesby capability name.
Constructor Details
#initialize(adapter:, business: Portage::Ucp.configuration.business, registry: Portage::Ucp.configuration.registry, payment_handlers: Portage::Ucp.configuration.payment_handlers, signing_keys: Portage::Ucp.configuration.signing_keys, signer: Portage::Ucp.configuration.signer, services: Portage::Ucp.configuration.services) ⇒ Manifest
Returns a new instance of Manifest.
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/portage/ucp/manifest.rb', line 21 def initialize(adapter:, business: Portage::Ucp.configuration.business, registry: Portage::Ucp.configuration.registry, payment_handlers: Portage::Ucp.configuration.payment_handlers, signing_keys: Portage::Ucp.configuration.signing_keys, signer: Portage::Ucp.configuration.signer, services: Portage::Ucp.configuration.services) @adapter = adapter @business = business @registry = registry @payment_handlers = payment_handlers @signing_keys = signing_keys @signer = signer @services = services end |
Instance Method Details
#to_h ⇒ Object
Nests everything under a "ucp" envelope, and keys capabilities by
capability name. That is the shape live Shopify UCP rollouts (Casper,
Allbirds, Glossier, and 34+ others) serve under their own manifest
"version": "2026-08-25", and the shape portage-ucp-client's
Client.discover reads. Only the shape is borrowed: version here is
still UCP_VERSION ("2026-04-08"), the spec revision this gem targets.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/portage/ucp/manifest.rb', line 40 def to_h ucp = { version: UCP_VERSION, business: @business, services: @services, capabilities: capability_hash, payment_handlers: @payment_handlers, signing_keys: @signing_keys } ucp = ucp.merge(signature: sign(ucp)) if @signer { ucp: ucp } end |