nfcfyi 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 +7 -0
- data/lib/nfcfyi/client.rb +76 -0
- data/lib/nfcfyi/version.rb +5 -0
- data/lib/nfcfyi.rb +4 -0
- metadata +52 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 161c177d54b609198357c5e36826118c0c1ddef49df940f33657898541600569
|
|
4
|
+
data.tar.gz: 93a6507e8209cb2031394468f45017f49a53b208539a49f8c5d2fd80ee354fc9
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 942950dbbcb672f45c80b91bc94fca3ed873dfd8e5f50afe60b44355e2c16ddfba8a4ae5a01bc2a780854ea0785de7bad8a8673ab0950d3352ed663b08bea26c
|
|
7
|
+
data.tar.gz: 5521f4ea5eeb2e9cd09d9ecfdb4cb5a30eec2441aa8ee41491b4cbf2579ccdb8c0abb2ecf6e277a07f98fff328a9e65eddbd1449beed360364e5e7e17e87f090
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "net/http"
|
|
4
|
+
require "json"
|
|
5
|
+
require "uri"
|
|
6
|
+
|
|
7
|
+
module NFCFYI
|
|
8
|
+
class Client
|
|
9
|
+
DEFAULT_BASE_URL = "https://nfcfyi.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 chip(slug)
|
|
20
|
+
get("/chip/#{slug}/")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def chip_family(slug)
|
|
24
|
+
get("/chip-family/#{slug}/")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def standard(slug)
|
|
28
|
+
get("/standard/#{slug}/")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def operating_mode(slug)
|
|
32
|
+
get("/operating-mode/#{slug}/")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def ndef_type(slug)
|
|
36
|
+
get("/ndef-type/#{slug}/")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def use_case(slug)
|
|
40
|
+
get("/use-case/#{slug}/")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def glossary_term(slug)
|
|
44
|
+
get("/glossary/#{slug}/")
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def compare(slug_a, slug_b)
|
|
48
|
+
get("/compare/", a: slug_a, b: slug_b)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def random
|
|
52
|
+
get("/random/")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def openapi
|
|
56
|
+
get("/openapi.json")
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
private
|
|
60
|
+
|
|
61
|
+
def get(path, params = {})
|
|
62
|
+
uri = URI("#{@base_url}#{path}")
|
|
63
|
+
uri.query = URI.encode_www_form(params) unless params.empty?
|
|
64
|
+
|
|
65
|
+
response = Net::HTTP.get_response(uri)
|
|
66
|
+
|
|
67
|
+
unless response.is_a?(Net::HTTPSuccess)
|
|
68
|
+
raise Error, "HTTP #{response.code}: #{response.body}"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
JSON.parse(response.body, symbolize_names: true)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
class Error < StandardError; end
|
|
76
|
+
end
|
data/lib/nfcfyi.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: nfcfyi
|
|
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 nfcfyi.com. Look up NFC chips, chip families, NDEF types,
|
|
14
|
+
operating modes, and standards. Zero dependencies.
|
|
15
|
+
email:
|
|
16
|
+
- hello@fyipedia.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- lib/nfcfyi.rb
|
|
22
|
+
- lib/nfcfyi/client.rb
|
|
23
|
+
- lib/nfcfyi/version.rb
|
|
24
|
+
homepage: https://nfcfyi.com
|
|
25
|
+
licenses:
|
|
26
|
+
- MIT
|
|
27
|
+
metadata:
|
|
28
|
+
homepage_uri: https://nfcfyi.com
|
|
29
|
+
source_code_uri: https://github.com/fyipedia/nfcfyi-rb
|
|
30
|
+
changelog_uri: https://github.com/fyipedia/nfcfyi-rb/blob/main/CHANGELOG.md
|
|
31
|
+
documentation_uri: https://nfcfyi.com/developers/
|
|
32
|
+
bug_tracker_uri: https://github.com/fyipedia/nfcfyi-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: NFC chip and standard reference
|
|
52
|
+
test_files: []
|