unicodefyi 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/unicodefyi.rb +62 -0
  3. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 78845b34afb9d5b49d1d40ea4581ef8124f0938e6bb68bece0af629a286f29d8
4
+ data.tar.gz: 8a5e8dae870882c944b6310033f75a0c2658cae98d1a4843ad627e25c560fecc
5
+ SHA512:
6
+ metadata.gz: cc8d9563b005f7bcf0e47882353e7b6e3e4bde45b63f41bad6c61ceb0794334ed319c52841f1f90cf43e0b3ae97f82f6eb543afd50f95b12e26906e48e227f0f
7
+ data.tar.gz: 8c7e587d905c313dcc19c1352064ea73446be1329b7db34e173c0584f8a1a1bf7e310be458dc84020fc40d4c76e48f40b8fdc3706cf3f7128df64969601048d3
data/lib/unicodefyi.rb ADDED
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "uri"
6
+
7
+ # Ruby client for UnicodeFYI REST API (unicodefyi.com).
8
+ #
9
+ # client = UnicodeFYI::Client.new
10
+ # result = client.search("query")
11
+ #
12
+ module UnicodeFYI
13
+ class Client
14
+ BASE_URL = "https://unicodefyi.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 characters.
25
+ def list_characters
26
+ get("/api/v1/characters/")
27
+ end
28
+
29
+ # Get character by slug.
30
+ def get_character(slug)
31
+ get("/api/v1/characters/#{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
+
52
+ private
53
+
54
+ def get(path, **params)
55
+ uri = URI.join(@base_url, path)
56
+ uri.query = URI.encode_www_form(params) unless params.empty?
57
+ response = Net::HTTP.get_response(uri)
58
+ raise "HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
59
+ JSON.parse(response.body)
60
+ end
61
+ end
62
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: unicodefyi
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 UnicodeFYI REST API at unicodefyi.com. Zero external
14
+ dependencies.
15
+ email: dev@fyipedia.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/unicodefyi.rb
21
+ homepage: https://unicodefyi.com
22
+ licenses:
23
+ - MIT
24
+ metadata:
25
+ source_code_uri: https://github.com/fyipedia/unicodefyi-rb
26
+ documentation_uri: https://unicodefyi.com/api/v1/schema/
27
+ homepage_uri: https://unicodefyi.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 UnicodeFYI API
47
+ test_files: []