Module: Homebrew::API::Analytics Private
- Extended by:
- Cachable, T::Generic
- Defined in:
- api/analytics.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Helper functions for using the analytics JSON API.
Analytics files are unsigned, so only analytics data is retained from
them: per-package responses are reduced to their analytics key before
anything else can observe or cache them.
Constant Summary collapse
- Cache =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
type_template { { fixed: T::Hash[String, T.untyped] } }
Class Method Summary collapse
- .analytics_api_path ⇒ String private
- .cask_analytics(token) ⇒ Hash{String => T.untyped}? private
- .fetch(category, days) ⇒ Hash{String => T.untyped} private
- .formula_analytics(name) ⇒ Hash{String => T.untyped}? private
Methods included from Cachable
Class Method Details
.analytics_api_path ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
23 24 25 |
# File 'api/analytics.rb', line 23 def analytics_api_path "analytics" end |
.cask_analytics(token) ⇒ Hash{String => T.untyped}?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
39 40 41 |
# File 'api/analytics.rb', line 39 def cask_analytics(token) package_analytics "cask/#{token}.json" end |
.fetch(category, days) ⇒ Hash{String => T.untyped}
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
28 29 30 31 |
# File 'api/analytics.rb', line 28 def fetch(category, days) endpoint = "#{analytics_api_path}/#{category}/#{days}d.json" cache[endpoint] ||= fetch_json(endpoint) end |
.formula_analytics(name) ⇒ Hash{String => T.untyped}?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
34 35 36 |
# File 'api/analytics.rb', line 34 def formula_analytics(name) package_analytics "formula/#{name}.json" end |