Repository navigation
v7.0.0
sec_id 7.0.0 adds UPI (ISO 4914) support and renames the check-digit concept to checksum across the entire public API. The rename ships with a v7 deprecation bridge that keeps every old name working through v7 (removed in v8) — only the :invalid_check_digit → :invalid_checksum validation error code flips immediately, with no bridge. Upgrading from 6.x? See the migration guide.
Added
- UPI (ISO 4914, Unique Product Identifier) support via
SecID::UPI— the gem's 16th identifier type, and the first offline UPI validator in any language. Validates the 12-character code (fixedQZprefix, 9-character body, 1 check character) issued by the ANNA Derivatives Service Bureau for OTC-derivatives reporting (CFTC, EMIR, and other global mandates). The check character is computed fully offline via ISO 7064 hybrid MOD 31,30 over the same 30-symbol alphabet as DTI (digits plus consonants; vowels andYnever appear), pinned empirically against DSB-issued vectors — no DSB registry lookup or paywalled ISO 4914 spec required. Like DTI,checksum/calculate_checksumreturn aStringrather than anInteger, since UPI check characters can be letters. A UPI shares the 12-character length bucket with ISIN and can double-detect (ISIN ranked first) when its digit check character also satisfies ISIN's Luhn checksum.
Changed
- BREAKING: Renamed the check-digit concept to checksum across the entire public API, because the old name was wrong on two axes — DTI's and UPI's check value is a
String(it can be a letter, not a digit), and LEI and IBAN carry a two-character check value. The instance and class methodscheck_digit→checksum,calculate_check_digit→calculate_checksum, andhas_check_digit?→has_checksum?; the error classSecID::InvalidCheckDigitError→SecID::InvalidChecksumError; the error code:invalid_check_digit→:invalid_checksum(a hard flip with no dual emission — dual would duplicateerrors.detailsentries, so update anyerrors.details/explain/ActiveModeldetails: truematcher immediately); and the:check_digitcomponents key →:checksuminto_h/deconstruct_keysacross all nine checkable types.restore/restore!and theCheckableconcern name are unchanged. No validation or checksum-arithmetic behavior changed: every identifier that was valid stays valid and every computed value is byte-identical. The old method names, theInvalidCheckDigitErrorconstant, and the:check_digitcomponents key remain as deprecated bridges through v7 (removed in v8); the error code is the only surface with no bridge. See MIGRATION.md for the full upgrade guide
Deprecated
- The pre-rename check-digit names, kept as v7 bridges and removed in v8: the
check_digit/calculate_check_digit/has_check_digit?methods (instance and class level) — each warns viaKernel#warnon every call, visible at Ruby's default verbosity and silenceable with-W0/$VERBOSE = nilor an app-levelWarningoverride; theSecID::InvalidCheckDigitErrorconstant, a same-object alias ofInvalidChecksumErrorsorescueunder either name keeps working; and the:check_digitkey, still present alongside:checksumincomponents/to_h/deconstruct_keys
Full changelog: https://github.com/svyatov/sec_id/blob/v7.0.0/CHANGELOG.md