Sha256: 0be24e77656675370cccf30522d896505f10b547da0ced92a68610bde2a49006

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

# Barkick

Barcodes made easy

Works with:

- [UPC](http://en.wikipedia.org/wiki/Universal_Product_Code)
- [EAN](http://en.wikipedia.org/wiki/International_Article_Number_%28EAN%29)
- [GTIN](http://en.wikipedia.org/wiki/Global_Trade_Item_Number)
- [ISBN](http://en.wikipedia.org/wiki/International_Standard_Book_Number)

For PLU codes, check out the [plu gem](https://github.com/ankane/plu)

## How To Use

```ruby
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

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

UPC-E

```ruby
gtin = GTIN.new("03744806")
gtin.base_gtin14 # "00037000004486"
```

Calculate check digit

```ruby
GTIN.check_digit("01600027526") # "3"
```

## Installation

Add this line to your Gemfile:

```ruby
gem "barkick"
```

And run:

```sh
bundle
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
barkick-0.0.4 README.md
barkick-0.0.3 README.md