# Ruby and Market Monolith

Availability: Instructions published.
Connection status: Connection not available.

Last reviewed: 2026-08-28.

Use Ruby's standard HTTP client to inspect the authentication contract. There is no published Market Monolith Ruby gem or connected integration in this release.

## Server-side example

Ruby's [Net::HTTP documentation](https://docs.ruby-lang.org/en/master/Net/HTTP.html) describes HTTPS requests and timeouts. Run only after the authentication release is confirmed. Inject the key from an approved secret store rather than placing it in source or a Rails frontend response.

```ruby
require "net/http"
require "json"

key = ENV.fetch("MARKET_MONOLITH_API_KEY")
uri = URI("https://api.marketmonolith.com/v1/me")
request = Net::HTTP::Get.new(uri)
request["X-Market-Monolith-Key"] = key
request["Accept"] = "application/json"

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.open_timeout = 5
http.read_timeout = 10
http.max_retries = 0
response = http.request(request)

unless response.is_a?(Net::HTTPSuccess)
  raise "Authentication check returned HTTP #{response.code}"
end
identity = JSON.parse(response.body)
puts identity.slice("accountRef", "applicationRef", "businessAccess", "billable")
```

## Interpret the response

This example does not follow redirects or retry failures. It prints selected identity metadata, never the secret.

A successful check establishes the key's account and application identity only. It does not establish resource permissions, connect a Rails app to business operations or activate payments.

## Rails applications

Keep the key in server-side credentials or your deployment's secret manager. Do not render it into an ERB page, JavaScript configuration, exception report or job log. Key replacement immediately invalidates the previous secret.

For planned business workflows, read [Operations and results](/docs/operations-results) before designing retries or background jobs.
