Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eansearch/ruby-barcode-lookup
A Ruby Gem for GTIN, UPC, EAN and ISBN barcode lookup and validation
https://github.com/eansearch/ruby-barcode-lookup
barcode ean gtin isbn lookup ruby ruby-gem upc
Last synced: 5 days ago
JSON representation
A Ruby Gem for GTIN, UPC, EAN and ISBN barcode lookup and validation
- Host: GitHub
- URL: https://github.com/eansearch/ruby-barcode-lookup
- Owner: eansearch
- License: mit
- Created: 2025-01-13T15:28:28.000Z (13 days ago)
- Default Branch: main
- Last Pushed: 2025-01-13T16:52:10.000Z (13 days ago)
- Last Synced: 2025-01-13T17:22:43.445Z (13 days ago)
- Topics: barcode, ean, gtin, isbn, lookup, ruby, ruby-gem, upc
- Language: Ruby
- Homepage: https://www.ean-search.org/upc-barcode-lookup.html
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BarcodeLookup
A Ruby Gem for GTIN, UPC, EAN and ISBN barcode lookup and validation using the API on https://www.ean-search.org
## Example
```ruby
#!/usr/bin/env ruby
require 'BarcodeLookup'token = ENV["EAN_SEARCH_API_TOKEN"]
ean = '5099750442227'
isbn = '1119578884'lookup = BarcodeLookup.new(token)
puts "Lookup single GTIN/UPC/EAN #{ean}:"
product = lookup.barcode_lookup(ean)
if product.nil?
puts "EAN #{ean} not found"
else
puts "EAN #{product['ean']} is #{product['name']}"
endputs "Lookup single ISBN #{isbn}:"
book = lookup.isbn_lookup(isbn)
if book.nil?
puts "EAN #{isbn} not found"
else
puts "ISBN #{isbn} is #{book['name']}"
endputs "Search for product name"
products = lookup.product_search("Michael Jackson Thriller")
for product in products
puts "EAN #{product['ean']} is #{product['name']}"
endputs "Search for similar product name"
products = lookup.similar_product_search("Michael Jackson Thriller but something else")
for product in products
puts "EAN #{product['ean']} is #{product['name']}"
endputs "Category search (category 15 is books)"
products = lookup.category_search(15, "Thriller")
for product in products
puts "EAN #{product['ean']} is #{product['name']}"
endputs "Barcode prefix search 4312*"
products = lookup.barcode_prefix_search('4312', 3, 0, 1)
for product in products
puts "EAN #{product['ean']} is #{product['name']}"
endputs "Lookup issuing country for EAN #{ean}:"
country = lookup.issuing_country(ean)
if country.nil?
puts "Issuing country for EAN #{ean} unknown"
else
puts "Issuing country for EAN #{product['ean']} is #{country}"
endputs "Get a PNG barcode image for EAN #{ean}:"
png = lookup.barcode_image(ean, 300, 200)
if png.nil?
puts "Error generating barcode image for EAN #{ean}"
else
puts "Barcode image for EAN #{ean}: data:image/png;base64,#{png}"
endputs "Credits remaining: " + lookup.credits_remaining.to_s