brew/Library/Homebrew/api/analytics.rb

27 lines
618 B
Ruby
Raw Normal View History

2021-08-06 02:30:44 -04:00
# typed: false
# frozen_string_literal: true
module Homebrew
module API
# Helper functions for using the analytics JSON API.
#
# @api private
module Analytics
2021-08-09 16:48:13 -04:00
class << self
extend T::Sig
2021-08-06 02:30:44 -04:00
2021-08-09 16:48:13 -04:00
sig { returns(String) }
def analytics_api_path
"analytics"
end
alias generic_analytics_api_path analytics_api_path
2021-08-06 02:30:44 -04:00
2021-08-09 16:48:13 -04:00
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"
end
2021-08-06 02:30:44 -04:00
end
end
end
end