fontfyi 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: dec8c8c9d2c68d1ad7cda040dbad4cd17557acd807e9850e8a7e38358d3a931a
4
- data.tar.gz: 67546e595568d02f5e48c8804007762ce565649b64435ab250958fc5978b6050
3
+ metadata.gz: 25883bfc9060da9bb020c2f811531b287c7373488b9d8bd263231d0244e860cf
4
+ data.tar.gz: 836769ed12c0e8bfe912a2ce33c43f3ae8c2ef7dedc0d1683c84c0bb73abd121
5
5
  SHA512:
6
- metadata.gz: 3eca888378e1dcf5fa3618603e50abab41ecb80ec390414c817478ec16a246c9dd5f18032e951150c7659ba5a5c2d8a75ed9d66ed06fe9ed88f5af86461e3cb6
7
- data.tar.gz: 795191cf5f6c0e9c8d053b96b70dfe14f0e9db68ade3d15caf527136380e9a2ff29d0fd9b0e55e4cffc2c11969e98f557fa17cce57360ee8f6fd4c2f0bbe1c72
6
+ metadata.gz: 8329638b9a0d87b0edd589a14203f8abd4f2b2ef190b711c3b9d7d2e461e0b2af17e5bab938e4f4d948671567459b0c9f811dde869335f7c22865bc9c7b4c4b9
7
+ data.tar.gz: c090e6f438a4c866727c6142ba2675190587c3873e8badf61ee833104a4b5ff1b08036bfe842b705ed7337777ba72bcbb16c84d378fb0d3ddf5e424c897490f6
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "uri"
6
+
7
+ module FontFYI
8
+ class Client
9
+ DEFAULT_BASE_URL = "https://fontfyi.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("/font/#{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 FontFYI
4
+ VERSION = "0.1.1"
5
+ end
data/lib/fontfyi.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 FontFYI REST API (fontfyi.com).
8
- #
9
- # client = FontFYI::Client.new
10
- # result = client.search("query")
11
- #
12
- module FontFYI
13
- class Client
14
- BASE_URL = "https://fontfyi.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 blog categories.
25
- def list_blog_categories
26
- get("/api/v1/blog-categories/")
27
- end
28
-
29
- # Get blog category by slug.
30
- def get_blog_category(slug)
31
- get("/api/v1/blog-categories/#{slug}/")
32
- end
33
- # List all blog posts.
34
- def list_blog_posts
35
- get("/api/v1/blog-posts/")
36
- end
37
-
38
- # Get blog post by slug.
39
- def get_blog_post(slug)
40
- get("/api/v1/blog-posts/#{slug}/")
41
- end
42
- # List all blog series.
43
- def list_blog_series
44
- get("/api/v1/blog-series/")
45
- end
46
-
47
- # Get blog sery by slug.
48
- def get_blog_sery(slug)
49
- get("/api/v1/blog-series/#{slug}/")
50
- end
51
- # List all faqs.
52
- def list_faqs
53
- get("/api/v1/faqs/")
54
- end
55
-
56
- # Get faq by slug.
57
- def get_faq(slug)
58
- get("/api/v1/faqs/#{slug}/")
59
- end
60
- # List all fonts.
61
- def list_fonts
62
- get("/api/v1/fonts/")
63
- end
64
-
65
- # Get font by slug.
66
- def get_font(slug)
67
- get("/api/v1/fonts/#{slug}/")
68
- end
69
- # List all glossary.
70
- def list_glossary
71
- get("/api/v1/glossary/")
72
- end
73
-
74
- # Get term by slug.
75
- def get_term(slug)
76
- get("/api/v1/glossary/#{slug}/")
77
- end
78
- # List all pairings.
79
- def list_pairings
80
- get("/api/v1/pairings/")
81
- end
82
-
83
- # Get pairing by slug.
84
- def get_pairing(slug)
85
- get("/api/v1/pairings/#{slug}/")
86
- end
87
- # List all tags.
88
- def list_tags
89
- get("/api/v1/tags/")
90
- end
91
-
92
- # Get tag by slug.
93
- def get_tag(slug)
94
- get("/api/v1/tags/#{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 "fontfyi/version"
4
+ require_relative "fontfyi/client"
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontfyi
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 FontFYI REST API at fontfyi.com. Zero external dependencies.
14
- email: dev@fyipedia.com
13
+ description: API client for fontfyi.com. Google Fonts metadata, CSS generation, and
14
+ font pairing. Zero dependencies.
15
+ email:
16
+ - hello@fyipedia.com
15
17
  executables: []
16
18
  extensions: []
17
19
  extra_rdoc_files: []
18
20
  files:
19
21
  - lib/fontfyi.rb
22
+ - lib/fontfyi/client.rb
23
+ - lib/fontfyi/version.rb
20
24
  homepage: https://fontfyi.com
21
25
  licenses:
22
26
  - MIT
23
27
  metadata:
24
- source_code_uri: https://github.com/fyipedia/fontfyi-rb
25
- documentation_uri: https://fontfyi.com/api/v1/schema/
26
28
  homepage_uri: https://fontfyi.com
29
+ source_code_uri: https://github.com/fyipedia/fontfyi-rb
30
+ changelog_uri: https://github.com/fyipedia/fontfyi-rb/blob/main/CHANGELOG.md
31
+ documentation_uri: https://fontfyi.com/developers/
32
+ bug_tracker_uri: https://github.com/fyipedia/fontfyi-rb/issues
27
33
  post_install_message:
28
34
  rdoc_options: []
29
35
  require_paths:
@@ -42,5 +48,5 @@ requirements: []
42
48
  rubygems_version: 3.0.3.1
43
49
  signing_key:
44
50
  specification_version: 4
45
- summary: Ruby client for FontFYI API
51
+ summary: Google Fonts metadata, CSS generation, and font pairing
46
52
  test_files: []