Barcodes made easy
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.gitignore
CHANGELOG.md Version bump to 0.1.0 Jul 28, 2018
Gemfile
LICENSE.txt
README.md
Rakefile
barkick.gemspec

README.md

Barkick

Barcodes made easy

Works with:

For PLU codes, check out the plu gem

Installation

Add this line to your Gemfile:

gem 'barkick'

How To Use

gtin = Barkick::GTIN.new("016000275263")
gtin.valid?       # true
gtin.gtin14       # "00016000275263"
gtin.ean13        # "0016000275263"
gtin.upc          # "016000275263"
gtin.prefix       # "001"
gtin.prefix_name  # "GS1 US"
gtin.country_code # "US"

Variable items

gtin = Barkick::GTIN.new("299265108631")
gtin.variable?   # true
gtin.restricted? # true
gtin.price       # 8.63
gtin.base_gtin14 # "00299265000003"

UPC-E

gtin = Barkick::GTIN.new("03744806", type: :upc_e)
gtin.base_gtin14 # "00037000004486"

EAN-8

gtin = Barkick::GTIN.new("01234565", type: :ean8)
gtin.base_gtin14 # "00000001234565"

Calculate check digit

Barkick::GTIN.check_digit("01600027526") # "3"

For UPC-E, convert to UPC-A before passing to this method

Upgrading

0.1.0

There a few breaking changes to be aware of:

  • GTIN is now Barkick::GTIN
  • 8-digit codes now raise an ArgumentError if type is not specified

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help: