Class: Fontist::Import::Google::Api
- Inherits:
-
Object
- Object
- Fontist::Import::Google::Api
- Defined in:
- lib/fontist/import/google/api.rb
Overview
Facade for accessing the unified Google Fonts database
This class provides a clean interface for accessing Google Fonts data by integrating data from three API endpoints (TTF, VF, WOFF2) into a unified database.
Class Method Summary collapse
-
.by_category(category) ⇒ Array<Models::FontFamily>
Filter fonts by category.
-
.clear_cache ⇒ void
Clear all caches (clients + database).
-
.database ⇒ FontDatabase
Get unified font database instance.
-
.font_by_name(name) ⇒ Models::FontFamily?
Find a specific font family by name.
-
.font_families ⇒ Array<Models::FontFamily>
Alias for items.
-
.fonts_count ⇒ Hash
Get count of fonts by type.
-
.items ⇒ Array<Models::FontFamily>
Get all font families (main entry point).
-
.static_fonts_only ⇒ Array<Models::FontFamily>
Get only static fonts (fonts without axes).
-
.ttf_data ⇒ Array<Models::FontFamily>
Get raw TTF endpoint data (for debugging).
-
.variable_fonts_only ⇒ Array<Models::FontFamily>
Get only variable fonts (fonts with axes).
-
.vf_data ⇒ Array<Models::FontFamily>
Get raw VF endpoint data (for debugging).
-
.woff2_data ⇒ Array<Models::FontFamily>
Get raw WOFF2 endpoint data (for debugging).
Class Method Details
.by_category(category) ⇒ Array<Models::FontFamily>
Filter fonts by category
56 57 58 |
# File 'lib/fontist/import/google/api.rb', line 56 def by_category(category) database.by_category(category) end |
.clear_cache ⇒ void
This method returns an undefined value.
Clear all caches (clients + database)
105 106 107 108 109 110 |
# File 'lib/fontist/import/google/api.rb', line 105 def clear_cache ttf_client.clear_cache vf_client.clear_cache woff2_client.clear_cache @database = nil end |
.database ⇒ FontDatabase
Get unified font database instance
26 27 28 |
# File 'lib/fontist/import/google/api.rb', line 26 def database @database ||= build_database end |
.font_by_name(name) ⇒ Models::FontFamily?
Find a specific font family by name
48 49 50 |
# File 'lib/fontist/import/google/api.rb', line 48 def font_by_name(name) database.font_by_name(name) end |
.font_families ⇒ Array<Models::FontFamily>
Alias for items
40 41 42 |
# File 'lib/fontist/import/google/api.rb', line 40 def font_families items end |
.fonts_count ⇒ Hash
Get count of fonts by type
77 78 79 |
# File 'lib/fontist/import/google/api.rb', line 77 def fonts_count database.fonts_count end |
.items ⇒ Array<Models::FontFamily>
Get all font families (main entry point)
33 34 35 |
# File 'lib/fontist/import/google/api.rb', line 33 def items database.all_fonts end |
.static_fonts_only ⇒ Array<Models::FontFamily>
Get only static fonts (fonts without axes)
70 71 72 |
# File 'lib/fontist/import/google/api.rb', line 70 def static_fonts_only database.static_fonts_only end |
.ttf_data ⇒ Array<Models::FontFamily>
Get raw TTF endpoint data (for debugging)
84 85 86 |
# File 'lib/fontist/import/google/api.rb', line 84 def ttf_data ttf_client.fetch end |
.variable_fonts_only ⇒ Array<Models::FontFamily>
Get only variable fonts (fonts with axes)
63 64 65 |
# File 'lib/fontist/import/google/api.rb', line 63 def variable_fonts_only database.variable_fonts_only end |
.vf_data ⇒ Array<Models::FontFamily>
Get raw VF endpoint data (for debugging)
91 92 93 |
# File 'lib/fontist/import/google/api.rb', line 91 def vf_data vf_client.fetch end |
.woff2_data ⇒ Array<Models::FontFamily>
Get raw WOFF2 endpoint data (for debugging)
98 99 100 |
# File 'lib/fontist/import/google/api.rb', line 98 def woff2_data woff2_client.fetch end |