"""Rippling: `rippling:` for ats.rippling.com/, the whole board in one JSON array, the description on each role's own record. Written from Prisma's board (`prisma-careers`, two roles) and Rippling's own (`rippling`, 326 roles) on 2026-09-29. The careers site's script reads the public board API, `api.rippling.com/platform/api/ats/v1/board//jobs`, which needs no key. The slug is case-sensitive (`Prisma-Careers` is "Job Board not found"). """ from __future__ import annotations import html import json import logging import re from collections.abc import Callable from typing import Any from desk.sources import strip_html from ._contract import Ask, Fields, Place, Reads from ._shared import Get, Row, add_place, parse_dt, yearly_amount log = logging.getLogger(__name__) NAME = "rippling" LABEL = "Rippling" KEEP_CASE = True PATTERNS = ( r"ats\.rippling\.com/([A-Za-z0-9][A-Za-z0-9_-]*)", r"api\.rippling\.com/platform/api/ats/v1/board/([A-Za-z0-9][A-Za-z0-9_-]*)", ) READS = Reads( scope="board", listing="whole", text="detail", complete="whole", places="many", fields=Fields(pay="figures", posted="trusted", employment="stated"), robots=("read: robots.txt allows //jobs on ats.rippling.com, the API host has none " "(checked 2026-09-29)"), ) _API = "api.rippling.com" _SITE = "ats.rippling.com" #: A slug is one path segment that starts with a letter or a digit, matched #: whole; it is also what discovery's patterns take. _SLUG = re.compile(r"[A-Za-z0-9][A-Za-z0-9_-]*") #: The words of `employmentType.label` (`SALARIED_FT`), split at "_". _EMPLOYMENT = {"FT": "full_time", "PT": "part_time", "INTERN": "internship", "INTERNSHIP": "internship", "CONTRACT": "contract", "CONTRACTOR": "contract", "TEMP": "temporary", "TEMPORARY": "temporary", "SEASONAL": "temporary"} #: A role's id in the board's own links. _UUID = re.compile(r"[0-9A-Za-z-]{8,64}") def slug_ok(slug: str) -> bool: return bool(_SLUG.fullmatch(slug)) def allowed(slug: str) -> Callable[[str], bool]: return lambda host: host.lower() in (_API, _SITE) def careers_url(slug: str) -> str: return f"https://{_SITE}/{slug}/jobs" def _board(slug: str) -> str: return f"https://{_API}/platform/api/ats/v1/board/{slug}" def _place(text: str) -> Place: """A place as the board labels it; "Remote (United States)" is remote, any other label says nothing.""" return {"text": text, "remote": True if text.lower().startswith("remote") else None} def feed_url(slug: str, ask: Ask = Ask()) -> str: return f"{_board(slug)}/jobs" def parse(body: bytes, slug: str) -> list[Row]: """The board's array -> one row per role. The array has one entry per role and place, so a role in three cities is three entries with one `uuid` (Rippling's own board: 638 entries, 326 roles); the rows merge them, the places kept as a list and joined with "; " for `location`. The entry has no description, date or pay: `detail` reads them. `remote` is True only when every place is a "Remote (...)" one, since a label says nothing else about the work.""" data = json.loads(body) if not isinstance(data, list): raise ValueError("not a Rippling board: the answer is not a list") roles: dict[str, Row] = {} places: dict[str, list[Place]] = {} for entry in data: job_id = str(entry.get("uuid") or "").strip() title = (entry.get("name") or "").strip() if not title or not _UUID.fullmatch(job_id): continue place = str(((entry.get("workLocation") or {}).get("label")) or "").strip() places.setdefault(job_id, []) if place: add_place(places[job_id], _place(place)) roles.setdefault(job_id, { "source_id": job_id, "title": title, "url": f"https://{_SITE}/{slug}/jobs/{job_id}", "posted": None, "department": str(((entry.get("department") or {}).get("label")) or "").strip(), "description": "", "salary_text": "", # the board's list states no pay }) for job_id, row in roles.items(): row["places"] = places[job_id] row["location"] = "; ".join(p["text"] for p in places[job_id]) row["remote"] = True if places[job_id] and all( p["remote"] for p in places[job_id]) else None return list(roles.values()) def _employment(kind: Any) -> str | None: label = str((kind or {}).get("label") or "").strip().upper() if isinstance(kind, dict) else "" for word in label.split("_"): if word in _EMPLOYMENT: return _EMPLOYMENT[word] if label: log.debug("rippling: unknown employmentType %r", label) return None def detail(get: Get, slug: str, row: Row) -> dict[str, Any]: """`/jobs/`: the description as HTML (`description.role`, or the company's text when a role has none), every place in `workLocations`, `createdOn` for `posted`, and `payRangeDetails`, a range per pay zone. The columns are only filled for exactly one yearly range, as Greenhouse's are: with several zones there is no telling which one the role has.""" data = json.loads(get(f"{_board(slug)}/jobs/{row['source_id']}")) text = data.get("description") or {} found: dict[str, Any] = { "description": html.unescape(strip_html(text.get("role") or text.get("company") or "")), "posted": parse_dt(data.get("createdOn")), } if names := [p for p in (str(p).strip() for p in data.get("workLocations") or []) if p]: found["places"] = [_place(name) for name in dict.fromkeys(names)] found["location"] = "; ".join(dict.fromkeys(names)) if employment := _employment(data.get("employmentType")): found["employment"] = employment ranges = data.get("payRangeDetails") or [] if len(ranges) == 1: pay = ranges[0] lo, hi, currency = yearly_amount(pay.get("rangeStart"), pay.get("rangeEnd"), pay.get("currency"), pay.get("frequency"), {"YEAR": 1, "MONTH": 12}) if currency: found |= {"salary_min": lo, "salary_max": hi, "currency": currency} return found