RubyGems
- class
- RubyGemsRegistry
- purl type
- pkg:gem
- api
- rubygems.org
- version status
- yanked
Address it
await fetchPackageFromPURL("pkg:gem/rails");
await fetchDependenciesFromPURL("pkg:gem/rails@8.1.3.1");
Gems have no namespace. The PURL type is gem, and so is ecosystem().
What it reads
| Call | Endpoint |
|---|---|
fetchPackage | GET /api/v1/gems/{name}.json |
fetchVersions | GET /api/v1/versions/{name}.json |
fetchDependencies | GET /api/v2/rubygems/{name}/versions/{version}.json |
fetchMaintainers | GET /api/v1/gems/{name}/owners.json |
latestVersion is the gem's current version. repository is source_code_uri, then metadata.source_code_uri, then the homepage, normalized. documentation is documentation_uri. Licenses are the gem's licenses array joined with OR.
Versions
Each version has publishedAt from created_at, integrity as sha256- plus the gem's sha, and status: "yanked" when yanked. Licenses per version are not listed by this endpoint and stay empty.
Dependencies
The v2 version document lists runtime and development dependencies, each with a requirement string such as >= 1.0, < 3. Scopes map one to one; nothing is optional.
Maintainers
Owners, each with a login from the handle and an email when rubygems.org exposes it. No role.
URLs
urls.registry("rails"); // https://rubygems.org/gems/rails
urls.download("rails", "8.1.3.1"); // https://rubygems.org/downloads/rails-8.1.3.1.gem
urls.documentation("rails", "8.1.3.1"); // https://www.rubydoc.info/gems/rails/8.1.3.1
urls.readme("rails", "8.1.3.1"); // https://rubygems.org/gems/rails/versions/8.1.3.1
Gotchas
- The versions endpoint answers every version of a gem with a long history in one document; rails has hundreds. Cache it.
- Versions built for one platform (
-x86_64-linux) appear as separate entries with the same number prefix. - Owner emails are only present when the owner made them public.
Where it lives
src/registries/rubygems.ts.