Barrage Of New Gems

Working for a company that sits in the middle of a supply chain, we deal with a significant volume of data.

Inbound we have things like customer orders, new product data, invoices and purchase order status reports from suppliers.

Outbound we have things like purchase orders going to our suppliers, order confirmations, invoices and new product data going to our customers.

Most of this is electronic and automatic, and is therefore highly dependent on industry standardised identifiers. In Australia, products are usually identified with an EAN-13, but some of our US based suppliers are still using UPC-12.

Australian businesses can be identified by their ABN, and in the book industry there is a unique global ID system for businesses called SAN.

To deal with all these IDs in my ruby code, I’ve put together some very simple little gems for recognising and validating the various numbers I encounter.

gem install ean13
gem install upc
gem install san
gem install abn

They’re all single file, single class libraries with similar looking APIs, and operate in a similar way to the ISTC gem I talk about here.


    require 'ean13'

    => true
    => "9781843549161"


    require 'upc'
    => true
    => "028947663058"


    require 'san'

    => true
    => "9013725"


    require 'abn'

    => true

Nothing groundbreaking or exciting, but useful little libraries when you need to decipher what sort of identifier a number is, and for validating fields in your models.