barcodefyi 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a6610850825dfd3cf995d3ad1101560ed695171e368f3bf9fcb8e18b9d40f4ed
4
+ data.tar.gz: 1e757ac421c5879edec2e3175b844c80e5c470dd8c216a3e647500ec53b04cac
5
+ SHA512:
6
+ metadata.gz: 6dfb8439fe016d4e845cfb216d19a27f414cc3f77ad27643c54a0982ccbc7862c15f93a0fb745510ba47d61ca17462c1c4f30a969784eaaae89f5d5134ee2c8c
7
+ data.tar.gz: 0dff067c63ac0cb6b02b5c8ad1fdb40a4e3d5c64076cba8ad3adbd4bac974207ad3b7d99e53bd20390ee68a98972c79d7c813e250996fd368cebd49c44157e43
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "uri"
6
+
7
+ module BarcodeFYI
8
+ class Client
9
+ DEFAULT_BASE_URL = "https://barcodefyi.com/api"
10
+
11
+ def initialize(base_url: DEFAULT_BASE_URL)
12
+ @base_url = base_url
13
+ end
14
+
15
+ def search(query)
16
+ get("/search/", q: query)
17
+ end
18
+
19
+ def symbology(slug)
20
+ get("/symbology/#{slug}/")
21
+ end
22
+
23
+ def family(slug)
24
+ get("/family/#{slug}/")
25
+ end
26
+
27
+ def standard(slug)
28
+ get("/standard/#{slug}/")
29
+ end
30
+
31
+ def component(slug)
32
+ get("/component/#{slug}/")
33
+ end
34
+
35
+ def glossary_term(slug)
36
+ get("/glossary/#{slug}/")
37
+ end
38
+
39
+ def compare(slug_a, slug_b)
40
+ get("/compare/", a: slug_a, b: slug_b)
41
+ end
42
+
43
+ def random
44
+ get("/random/")
45
+ end
46
+
47
+ def industry(slug)
48
+ get("/industry/#{slug}/")
49
+ end
50
+
51
+ def openapi
52
+ get("/openapi.json")
53
+ end
54
+
55
+ private
56
+
57
+ def get(path, params = {})
58
+ uri = URI("#{@base_url}#{path}")
59
+ uri.query = URI.encode_www_form(params) unless params.empty?
60
+
61
+ response = Net::HTTP.get_response(uri)
62
+
63
+ unless response.is_a?(Net::HTTPSuccess)
64
+ raise Error, "HTTP #{response.code}: #{response.body}"
65
+ end
66
+
67
+ JSON.parse(response.body, symbolize_names: true)
68
+ end
69
+ end
70
+
71
+ class Error < StandardError; end
72
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BarcodeFYI
4
+ VERSION = "0.1.0"
5
+ end
data/lib/barcodefyi.rb ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "barcodefyi/version"
4
+ require_relative "barcodefyi/client"
metadata ADDED
@@ -0,0 +1,52 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: barcodefyi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - FYIPedia
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-03-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: API client for barcodefyi.com. Look up barcode symbologies (UPC, EAN,
14
+ Code 128, ISBN), standards, and encoding specifications. Zero dependencies.
15
+ email:
16
+ - hello@fyipedia.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/barcodefyi.rb
22
+ - lib/barcodefyi/client.rb
23
+ - lib/barcodefyi/version.rb
24
+ homepage: https://barcodefyi.com
25
+ licenses:
26
+ - MIT
27
+ metadata:
28
+ homepage_uri: https://barcodefyi.com
29
+ source_code_uri: https://github.com/fyipedia/barcodefyi-rb
30
+ changelog_uri: https://github.com/fyipedia/barcodefyi-rb/blob/main/CHANGELOG.md
31
+ documentation_uri: https://barcodefyi.com/developers/
32
+ bug_tracker_uri: https://github.com/fyipedia/barcodefyi-rb/issues
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '3.0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubygems_version: 3.0.3.1
49
+ signing_key:
50
+ specification_version: 4
51
+ summary: Barcode symbology lookup and standard reference
52
+ test_files: []