mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
29 lines
638 B
Ruby
29 lines
638 B
Ruby
![]() |
# typed: false
|
||
|
# frozen_string_literal: true
|
||
|
|
||
|
module Homebrew
|
||
|
module API
|
||
|
# Helper functions for using the analytics JSON API.
|
||
|
#
|
||
|
# @api private
|
||
|
module Analytics
|
||
|
extend T::Sig
|
||
|
|
||
|
module_function
|
||
|
|
||
|
sig { returns(String) }
|
||
|
def analytics_api_path
|
||
|
"analytics"
|
||
|
end
|
||
|
alias generic_analytics_api_path analytics_api_path
|
||
|
|
||
|
sig { params(category: String, days: T.any(Integer, String)).returns(Hash) }
|
||
|
def fetch(category, days)
|
||
|
Homebrew::API.fetch "#{analytics_api_path}/#{category}/#{days}d.json", json: true
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
require "extend/os/api/analytics"
|