symbolfyi 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b31fe13bdd89ca8c18ebc274d50f12fc13e31c952db46739c9b8c1468c375b3
4
- data.tar.gz: 2d1e6e50946e19b08cf9f5f460bfca4bd3893c04dc4b408be5f1d98d8fe3b5b7
3
+ metadata.gz: 2658854a024f39bd25ceb59741f286680e6be081e3b938645a672ae40b21a5ae
4
+ data.tar.gz: 4700df62d8c365ee3ad6f1d44d7e55df8d14c9e8b955f4bb5d2f04798f2e8e5d
5
5
  SHA512:
6
- metadata.gz: bd64837ce34cecc9b031e130bc541bafb59336f461604136edbb411311c36dea6db486529036e1d5cad082cbb8157078ec2dd6b07a75eb2acaad97a02f3fe089
7
- data.tar.gz: 3c4eaec35a2e36775009d586280da55065c4883c88d902801c4bd8fd676cb98d4209b43bca4b298bc830857466af3a72cedc9a3fafe839a097325aac4ad02188
6
+ metadata.gz: d5775675e5852bfb1b9542a96e6335b5acf93c9bb8987ebd4b4a2427df6da6f9906e188e7dc325790a7abe66657b4c6297dbfec8c6cb48072088360204b35b26
7
+ data.tar.gz: 9cac6ef3095e5e286b7393ba9ec889fe7eb6171454dd86d991b5e0f35c4148f11db9c964cf2eaf1d0cbb62b105fcf738e4fc11558f62c96a82aa3435e3e99d19
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "uri"
6
+
7
+ module SymbolFYI
8
+ class Client
9
+ DEFAULT_BASE_URL = "https://symbolfyi.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 entity(slug)
20
+ get("/symbol/#{slug}/")
21
+ end
22
+
23
+ def glossary_term(slug)
24
+ get("/glossary/#{slug}/")
25
+ end
26
+
27
+ def random
28
+ get("/random/")
29
+ end
30
+
31
+ private
32
+
33
+ def get(path, params = {})
34
+ uri = URI("#{@base_url}#{path}")
35
+ uri.query = URI.encode_www_form(params) unless params.empty?
36
+
37
+ response = Net::HTTP.get_response(uri)
38
+
39
+ unless response.is_a?(Net::HTTPSuccess)
40
+ raise Error, "HTTP #{response.code}: #{response.body}"
41
+ end
42
+
43
+ JSON.parse(response.body, symbolize_names: true)
44
+ end
45
+ end
46
+
47
+ class Error < StandardError; end
48
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SymbolFYI
4
+ VERSION = "0.1.1"
5
+ end
data/lib/symbolfyi.rb CHANGED
@@ -1,107 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "net/http"
4
- require "json"
5
- require "uri"
6
-
7
- # Ruby client for SymbolFYI REST API (symbolfyi.com).
8
- #
9
- # client = SymbolFYI::Client.new
10
- # result = client.search("query")
11
- #
12
- module SymbolFYI
13
- class Client
14
- BASE_URL = "https://symbolfyi.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 categories.
25
- def list_categories
26
- get("/api/v1/categories/")
27
- end
28
-
29
- # Get category by slug.
30
- def get_category(slug)
31
- get("/api/v1/categories/#{slug}/")
32
- end
33
- # List all collections.
34
- def list_collections
35
- get("/api/v1/collections/")
36
- end
37
-
38
- # Get collection by slug.
39
- def get_collection(slug)
40
- get("/api/v1/collections/#{slug}/")
41
- end
42
- # List all faqs.
43
- def list_faqs
44
- get("/api/v1/faqs/")
45
- end
46
-
47
- # Get faq by slug.
48
- def get_faq(slug)
49
- get("/api/v1/faqs/#{slug}/")
50
- end
51
- # List all glossary.
52
- def list_glossary
53
- get("/api/v1/glossary/")
54
- end
55
-
56
- # Get term by slug.
57
- def get_term(slug)
58
- get("/api/v1/glossary/#{slug}/")
59
- end
60
- # List all guide categories.
61
- def list_guide_categories
62
- get("/api/v1/guide-categories/")
63
- end
64
-
65
- # Get guide category by slug.
66
- def get_guide_category(slug)
67
- get("/api/v1/guide-categories/#{slug}/")
68
- end
69
- # List all guide series.
70
- def list_guide_series
71
- get("/api/v1/guide-series/")
72
- end
73
-
74
- # Get guide sery by slug.
75
- def get_guide_sery(slug)
76
- get("/api/v1/guide-series/#{slug}/")
77
- end
78
- # List all guides.
79
- def list_guides
80
- get("/api/v1/guides/")
81
- end
82
-
83
- # Get guide by slug.
84
- def get_guide(slug)
85
- get("/api/v1/guides/#{slug}/")
86
- end
87
- # List all symbols.
88
- def list_symbols
89
- get("/api/v1/symbols/")
90
- end
91
-
92
- # Get symbol by slug.
93
- def get_symbol(slug)
94
- get("/api/v1/symbols/#{slug}/")
95
- end
96
-
97
- private
98
-
99
- def get(path, **params)
100
- uri = URI.join(@base_url, path)
101
- uri.query = URI.encode_www_form(params) unless params.empty?
102
- response = Net::HTTP.get_response(uri)
103
- raise "HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
104
- JSON.parse(response.body)
105
- end
106
- end
107
- end
3
+ require_relative "symbolfyi/version"
4
+ require_relative "symbolfyi/client"
metadata CHANGED
@@ -1,30 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: symbolfyi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - FYIPedia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-21 00:00:00.000000000 Z
11
+ date: 2026-03-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Ruby client for the SymbolFYI REST API at symbolfyi.com. Zero external
14
- dependencies.
15
- email: dev@fyipedia.com
13
+ description: API client for symbolfyi.com. Symbol encoding in 11 formats and Unicode
14
+ property lookup. Zero dependencies.
15
+ email:
16
+ - hello@fyipedia.com
16
17
  executables: []
17
18
  extensions: []
18
19
  extra_rdoc_files: []
19
20
  files:
20
21
  - lib/symbolfyi.rb
22
+ - lib/symbolfyi/client.rb
23
+ - lib/symbolfyi/version.rb
21
24
  homepage: https://symbolfyi.com
22
25
  licenses:
23
26
  - MIT
24
27
  metadata:
25
- source_code_uri: https://github.com/fyipedia/symbolfyi-rb
26
- documentation_uri: https://symbolfyi.com/api/v1/schema/
27
28
  homepage_uri: https://symbolfyi.com
29
+ source_code_uri: https://github.com/fyipedia/symbolfyi-rb
30
+ changelog_uri: https://github.com/fyipedia/symbolfyi-rb/blob/main/CHANGELOG.md
31
+ documentation_uri: https://symbolfyi.com/developers/
32
+ bug_tracker_uri: https://github.com/fyipedia/symbolfyi-rb/issues
28
33
  post_install_message:
29
34
  rdoc_options: []
30
35
  require_paths:
@@ -43,5 +48,5 @@ requirements: []
43
48
  rubygems_version: 3.0.3.1
44
49
  signing_key:
45
50
  specification_version: 4
46
- summary: Ruby client for SymbolFYI API
51
+ summary: Symbol encoding in 11 formats and Unicode property lookup
47
52
  test_files: []