Class: Legion::CLI::Dashboard::DataFetcher
- Inherits:
-
Object
- Object
- Legion::CLI::Dashboard::DataFetcher
- Defined in:
- lib/legion/cli/dashboard/data_fetcher.rb
Instance Method Summary collapse
- #health ⇒ Object
-
#initialize(base_url: 'http://localhost:4567') ⇒ DataFetcher
constructor
A new instance of DataFetcher.
- #recent_events(limit: 10) ⇒ Object
- #summary ⇒ Object
- #workers ⇒ Object
Constructor Details
#initialize(base_url: 'http://localhost:4567') ⇒ DataFetcher
Returns a new instance of DataFetcher.
9 10 11 |
# File 'lib/legion/cli/dashboard/data_fetcher.rb', line 9 def initialize(base_url: 'http://localhost:4567') @base_url = base_url end |
Instance Method Details
#health ⇒ Object
17 18 19 |
# File 'lib/legion/cli/dashboard/data_fetcher.rb', line 17 def health fetch('/api/health') || {} end |
#recent_events(limit: 10) ⇒ Object
21 22 23 |
# File 'lib/legion/cli/dashboard/data_fetcher.rb', line 21 def recent_events(limit: 10) fetch("/api/events/recent?limit=#{limit}") || [] end |
#summary ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/legion/cli/dashboard/data_fetcher.rb', line 25 def summary { workers: workers, health: health, events: recent_events, fetched_at: Time.now } end |
#workers ⇒ Object
13 14 15 |
# File 'lib/legion/cli/dashboard/data_fetcher.rb', line 13 def workers fetch('/api/workers') || [] end |