# RubyGems.org API Scraper: Ruby Gems Packages (`plainkitbin/rubygems-packages`) Actor

Fetch Ruby gem package data (name, version, download counts, license, project links) from the public RubyGems.org API as structured JSON dataset rows. Not affiliated with RubyGems.org API.

- **URL**: https://apify.com/plainkitbin/rubygems-packages.md
- **Developed by:** [PlainKit bin](https://apify.com/plainkitbin) (community)
- **Categories:** Developer tools, Open source
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.39 / 1,000 rubygems package records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## RubyGems.org API Scraper: Search Ruby Gems and Package Data

Ruby developers, dependency-audit and open-source-intelligence teams, DevRel analysts, recruiters who track Ruby libraries, and tool builders who feed a package catalog need rubygems ruby packages as clean rows instead of hand-built API calls. One run searches RubyGems.org for a phrase and returns up to 1,000 gems: one row per gem with its name, latest version, total downloads, downloads of the latest version, license, short description, and the project, homepage, source code, documentation, bug tracker, changelog and gem file links.

Typical jobs: list the gems that match a topic such as `sidekiq` or `rails`, rank competing libraries by download count, collect source code and changelog links for a dependency review, check which licenses a group of gems uses, or load a package catalog into a dataset or database.

The price is **$0.002** per delivered package row under the `FREE` tier on Apify Pay-Per-Event (event name: `rubygems-package`).
This Actor is an independent tool and is not affiliated with RubyGems.org API.
It needs no API key and no account at the data provider.

### Output Row Fields

Each delivered row contains 15 fields copied from the RubyGems.org response:

- `name`: gem name (for example `rails`)
- `version`: latest released version
- `downloads`: total downloads of the gem across all versions
- `version_downloads`: downloads of the latest version
- `platform`: gem platform, usually `ruby`
- `licenses`: licenses declared by the gem, joined with a comma
- `info`: short description of the gem, cut at 500 characters
- `project_uri`: gem page on RubyGems.org
- `homepage_uri`: homepage declared by the gem, empty when none
- `source_code_uri`: source code link declared by the gem, empty when none
- `documentation_uri`: documentation link, empty when none
- `bug_tracker_uri`: bug tracker link, empty when none
- `changelog_uri`: changelog link, empty when none
- `gem_uri`: download link of the gem file
- `sha`: SHA-256 checksum of the gem file as listed by RubyGems.org

Author names are not part of the output.

#### Example Output

```json
{
  "bug_tracker_uri": "https://github.com/rails/rails/issues",
  "changelog_uri": "https://github.com/rails/rails/releases/tag/v8.1.4.1",
  "documentation_uri": "https://api.rubyonrails.org/v8.1.4.1/",
  "downloads": 821873889,
  "gem_uri": "https://rubygems.org/gems/rails-8.1.4.1.gem",
  "homepage_uri": "https://rubyonrails.org",
  "info": "Ruby on Rails is a full-stack web framework optimized for programmer happiness and sustainable productivity. It encourages beautiful code by favoring convention over configuration.",
  "licenses": "MIT",
  "name": "rails",
  "platform": "ruby",
  "project_uri": "https://rubygems.org/gems/rails",
  "sha": "365c3a0ad2713bd6e60628e5e826622d4ca8dee60b5a7e560e9b20844e9650bc",
  "source_code_uri": "https://github.com/rails/rails/tree/v8.1.4.1",
  "version": "8.1.4.1",
  "version_downloads": 4427227
}
```

If RubyGems.org refuses a call (HTTP 401, 403 or 429), the run ends with one extra row whose `platform` is `status` and whose `name` is the reason code `STATUS_RUBYGEMS_REFUSED`. That row is never charged. Rows delivered before the refusal stay delivered and charged.

### Pricing and Charging

- Event name: `rubygems-package`
- Pricing model: Apify Pay-Per-Event
- Tier prices:
  - FREE: $0.002 per event
  - BRONZE: $0.0018 per event
  - SILVER: $0.0016 per event
  - GOLD: $0.0013936 per event
  - PLATINUM: $0.0013936 per event
  - DIAMOND: $0.0013336 per event

Each package row is pushed first to the dataset and charged right after a successful push.
A refused charge or reached spending limit halts work immediately; that row remains delivered and uncharged.
Failed requests produce 0 charges and push no data.
Restart safety: if a run is restarted or resumed by the platform, already delivered gems are recognized by name and never pushed or charged twice.

### Input Parameters

| Field | Type | Description | Default |
| --- | --- | --- | --- |
| `search` | String | Search text for gems on RubyGems.org, at most 200 characters. | `rails` |
| `max_items` | Integer (1-1000) | Maximum number of package rows to output. | `10` |

#### Example Input

```json
{
  "search": "sidekiq",
  "max_items": 10
}
```

### RubyGems.org Data Notes & Limitations

Data is read from the public RubyGems.org search endpoint at `rubygems.org/api/v1/search.json` without a key.
The RubyGems.org Acceptable Use Policy rules out activity that places undue burden on its servers through automated means, so this Actor stays small and polite:

- The Actor spaces its requests 0.2 seconds apart, half of the published limit of 10 requests per second, and makes at most one request per 30 rows.
- Transient server errors are retried a bounded number of times; HTTP 401, 403 and 429 are never retried.
- Redirects are never followed.
- The search returns the latest version of each matching gem, ranked by the RubyGems.org search order.
- Download counts and links are the values RubyGems.org lists at the time of the run; gems may declare no homepage, documentation or changelog link, and those fields are then empty.

### Use as an MCP Tool (AI Agents)

AI agents and MCP clients (such as Claude Desktop or Cursor) can invoke `plainkitbin/rubygems-packages` directly via `@apify/actors-mcp-server` over `stdio`:

```bash
APIFY_TOKEN=<YOUR_APIFY_TOKEN> npx -y @apify/actors-mcp-server --actors plainkitbin/rubygems-packages
```

Hosted (Streamable HTTP): connect to `https://mcp.apify.com?tools=plainkitbin/rubygems-packages` using OAuth or the header `Authorization: Bearer <YOUR_APIFY_TOKEN>`.

Example MCP client configuration (`mcpServers`):

```json
{
  "mcpServers": {
    "rubygems-packages": {
      "command": "npx",
      "args": [
        "-y",
        "@apify/actors-mcp-server",
        "--actors",
        "plainkitbin/rubygems-packages"
      ],
      "env": {
        "APIFY_TOKEN": "<YOUR_APIFY_TOKEN>"
      }
    }
  }
}
```

Example JSON tool call matching `.actor/input_schema.json`:

```json
{
  "search": "rails",
  "max_items": 5
}
```

Catalog and registry: browse all Actors at [PlainKitBin](https://plainkitbin.com/) or discover the multi-Actor server `com.plainkitbin/public-data-actors` in the MCP Registry.

# Actor input Schema

## `search` (type: `string`):

Search text for Ruby gems on RubyGems.org, for example a gem name or a topic word such as rails or sidekiq.

## `max_items` (type: `integer`):

Maximum number of package rows to output (prefilled default 10, hard upper bound 1000).

## Actor input object example

```json
{
  "search": "rails",
  "max_items": 10
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items produced by this run.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "search": "rails",
    "max_items": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("plainkitbin/rubygems-packages").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "search": "rails",
    "max_items": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("plainkitbin/rubygems-packages").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "search": "rails",
  "max_items": 10
}' |
apify call plainkitbin/rubygems-packages --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,plainkitbin/rubygems-packages"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/7OgXGxzKt7LIT49rJ/builds/eJz0c9JPhlspSaVg1/openapi.json
