cablefyi 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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/cablefyi.rb +134 -0
  3. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d5f8786b37ccff49c0aeb4c44f5a1081cae0e9a4c30f2bbb3d0489838d7f1ef0
4
+ data.tar.gz: 566a5f446b463e5a2a71c80b46a43e4f076ae3b7a9809e7da8593139937441dc
5
+ SHA512:
6
+ metadata.gz: 587854f94f8483cc77f0762aae98126eac9ecb6cefcd0a16a50e623c2cef0c74d2c6e7a8cb1dff0f90f5c3cc5af49d090106324ac596aa86c6c918217770f6fe
7
+ data.tar.gz: 1717ca136bf69b2d626d169e06f957303b562d996ccf769f4c07fd570d7a64579ee9cc3658930ce8e7d1c97884e9a250dc01ed45f8431dd5ffd522a2269c7377
data/lib/cablefyi.rb ADDED
@@ -0,0 +1,134 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "uri"
6
+
7
+ # Ruby client for CableFYI REST API (cablefyi.com).
8
+ #
9
+ # client = CableFYI::Client.new
10
+ # result = client.search("query")
11
+ #
12
+ module CableFYI
13
+ class Client
14
+ BASE_URL = "https://cablefyi.com"
15
+
16
+ def initialize(base_url: BASE_URL)
17
+ @base_url = base_url
18
+ end
19
+
20
+ def search(query)
21
+ get("/api/v1/search/", q: query)
22
+ end
23
+
24
+ # List all benchmarks.
25
+ def list_benchmarks
26
+ get("/api/v1/benchmarks/")
27
+ end
28
+
29
+ # Get benchmark by slug.
30
+ def get_benchmark(slug)
31
+ get("/api/v1/benchmarks/#{slug}/")
32
+ end
33
+ # List all cables.
34
+ def list_cables
35
+ get("/api/v1/cables/")
36
+ end
37
+
38
+ # Get cable by slug.
39
+ def get_cable(slug)
40
+ get("/api/v1/cables/#{slug}/")
41
+ end
42
+ # List all compatibility.
43
+ def list_compatibility
44
+ get("/api/v1/compatibility/")
45
+ end
46
+
47
+ # Get compatibility by slug.
48
+ def get_compatibility(slug)
49
+ get("/api/v1/compatibility/#{slug}/")
50
+ end
51
+ # List all connectors.
52
+ def list_connectors
53
+ get("/api/v1/connectors/")
54
+ end
55
+
56
+ # Get connector by slug.
57
+ def get_connector(slug)
58
+ get("/api/v1/connectors/#{slug}/")
59
+ end
60
+ # List all devices.
61
+ def list_devices
62
+ get("/api/v1/devices/")
63
+ end
64
+
65
+ # Get device by slug.
66
+ def get_device(slug)
67
+ get("/api/v1/devices/#{slug}/")
68
+ end
69
+ # List all faqs.
70
+ def list_faqs
71
+ get("/api/v1/faqs/")
72
+ end
73
+
74
+ # Get faq by slug.
75
+ def get_faq(slug)
76
+ get("/api/v1/faqs/#{slug}/")
77
+ end
78
+ # List all guide series.
79
+ def list_guide_series
80
+ get("/api/v1/guide-series/")
81
+ end
82
+
83
+ # Get guide sery by slug.
84
+ def get_guide_sery(slug)
85
+ get("/api/v1/guide-series/#{slug}/")
86
+ end
87
+ # List all guides.
88
+ def list_guides
89
+ get("/api/v1/guides/")
90
+ end
91
+
92
+ # Get guide by slug.
93
+ def get_guide(slug)
94
+ get("/api/v1/guides/#{slug}/")
95
+ end
96
+ # List all setup guides.
97
+ def list_setup_guides
98
+ get("/api/v1/setup-guides/")
99
+ end
100
+
101
+ # Get setup guide by slug.
102
+ def get_setup_guide(slug)
103
+ get("/api/v1/setup-guides/#{slug}/")
104
+ end
105
+ # List all standards.
106
+ def list_standards
107
+ get("/api/v1/standards/")
108
+ end
109
+
110
+ # Get standard by slug.
111
+ def get_standard(slug)
112
+ get("/api/v1/standards/#{slug}/")
113
+ end
114
+ # List all terms.
115
+ def list_terms
116
+ get("/api/v1/terms/")
117
+ end
118
+
119
+ # Get term by slug.
120
+ def get_term(slug)
121
+ get("/api/v1/terms/#{slug}/")
122
+ end
123
+
124
+ private
125
+
126
+ def get(path, **params)
127
+ uri = URI.join(@base_url, path)
128
+ uri.query = URI.encode_www_form(params) unless params.empty?
129
+ response = Net::HTTP.get_response(uri)
130
+ raise "HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
131
+ JSON.parse(response.body)
132
+ end
133
+ end
134
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cablefyi
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: Ruby client for the CableFYI REST API at cablefyi.com. Zero external
14
+ dependencies.
15
+ email: dev@fyipedia.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/cablefyi.rb
21
+ homepage: https://cablefyi.com
22
+ licenses:
23
+ - MIT
24
+ metadata:
25
+ source_code_uri: https://github.com/fyipedia/cablefyi-rb
26
+ documentation_uri: https://cablefyi.com/api/v1/schema/
27
+ homepage_uri: https://cablefyi.com
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '3.0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubygems_version: 3.0.3.1
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Ruby client for CableFYI API
47
+ test_files: []