Barkick
Barcodes made easy
Works with:
For PLU codes, check out the plu gem
How To Use
gtin = 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 = GTIN.new("299265108631")
gtin.variable? # true
gtin.restricted? # true
gtin.price # 8.63
gtin.base_gtin14 # "00299265000003"
UPC-E
gtin = GTIN.new("03744806")
gtin.base_gtin14 # "00037000004486"
Calculate check digit
GTIN.check_digit("01600027526") # "3"
Installation
Add this line to your Gemfile:
gem "barkick"
And run:
bundle
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request