mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

This is the pattern we've been adopting for a while and it's a bit cleaner. Let's remove all of the existing usage of the existing pattern to avoid confusion when adopting the new one.
22 lines
533 B
Ruby
22 lines
533 B
Ruby
# typed: strict
|
|
# frozen_string_literal: true
|
|
|
|
module Homebrew
|
|
module API
|
|
# Helper functions for using the analytics JSON API.
|
|
module Analytics
|
|
class << self
|
|
sig { returns(String) }
|
|
def analytics_api_path
|
|
"analytics"
|
|
end
|
|
|
|
sig { params(category: String, days: T.any(Integer, String)).returns(T::Hash[String, T.untyped]) }
|
|
def fetch(category, days)
|
|
Homebrew::API.fetch "#{analytics_api_path}/#{category}/#{days}d.json"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|