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
65 66 67 |
# File 'lib/fontist/import/google/api.rb', line 65 def by_category(category) database.by_category(category) end |
.clear_cache ⇒ void
This method returns an undefined value.
Clear all caches (clients + database)
114 115 116 117 118 119 |
# File 'lib/fontist/import/google/api.rb', line 114 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
35 36 37 |
# File 'lib/fontist/import/google/api.rb', line 35 def database @database ||= build_database end |
.font_by_name(name) ⇒ Models::FontFamily?
Find a specific font family by name
57 58 59 |
# File 'lib/fontist/import/google/api.rb', line 57 def font_by_name(name) database.font_by_name(name) end |
.font_families ⇒ Array<Models::FontFamily>
Alias for items
49 50 51 |
# File 'lib/fontist/import/google/api.rb', line 49 def font_families items end |
.fonts_count ⇒ Hash
Get count of fonts by type
86 87 88 |
# File 'lib/fontist/import/google/api.rb', line 86 def fonts_count database.fonts_count end |
.items ⇒ Array<Models::FontFamily>
Get all font families (main entry point)
42 43 44 |
# File 'lib/fontist/import/google/api.rb', line 42 def items database.all_fonts end |
.static_fonts_only ⇒ Array<Models::FontFamily>
Get only static fonts (fonts without axes)
79 80 81 |
# File 'lib/fontist/import/google/api.rb', line 79 def static_fonts_only database.static_fonts_only end |
.ttf_data ⇒ Array<Models::FontFamily>
Get raw TTF endpoint data (for debugging)
93 94 95 |
# File 'lib/fontist/import/google/api.rb', line 93 def ttf_data ttf_client.fetch end |
.variable_fonts_only ⇒ Array<Models::FontFamily>
Get only variable fonts (fonts with axes)
72 73 74 |
# File 'lib/fontist/import/google/api.rb', line 72 def variable_fonts_only database.variable_fonts_only end |
.vf_data ⇒ Array<Models::FontFamily>
Get raw VF endpoint data (for debugging)
100 101 102 |
# File 'lib/fontist/import/google/api.rb', line 100 def vf_data vf_client.fetch end |
.woff2_data ⇒ Array<Models::FontFamily>
Get raw WOFF2 endpoint data (for debugging)
107 108 109 |
# File 'lib/fontist/import/google/api.rb', line 107 def woff2_data woff2_client.fetch end |