Class: PlausibleApi::Stats::Aggregate
- Inherits:
-
Object
- Object
- PlausibleApi::Stats::Aggregate
- Defined in:
- lib/plausible_api/api/stats/aggregate.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Aggregate
constructor
A new instance of Aggregate.
- #request_url ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Aggregate
Returns a new instance of Aggregate.
6 7 8 9 10 11 |
# File 'lib/plausible_api/api/stats/aggregate.rb', line 6 def initialize( = {}) @period = [:period] || '3mo' @metrics = [:metrics] || 'visitors,pageviews,bounce_rate,visit_duration' @filter = [:filter] @date = [:date] end |
Instance Method Details
#request_url ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/plausible_api/api/stats/aggregate.rb', line 13 def request_url url = "/api/v1/stats/aggregate?site_id=$SITE_ID&period=#{@period}&metrics=#{@metrics}" if @filter url += "&filter=#{CGI.escape(@filter)}" end if @date url += "&date=#{@date}" end url end |