Sha256: 2b07826b01a693180294ec3464f929c4bf30ed4aa830ccbaa32e13d03f0d2618

Contents?: true

Size: 582 Bytes

Versions: 2

Compression:

Stored size: 582 Bytes

Contents

# frozen_string_literal: true

module PlausibleApi
  module Stats
    class Timeseries
      def initialize(options = {})
        @period = options[:period] || '30d'
        @filters = options[:filters]
        @date   = options[:date]
      end

      def request_url
        url = "/api/v1/stats/timeseries?site_id=$SITE_ID"
        if @period
          url += "&period=#{@period}"
        end
        if @filters
          url += "&filters=#{CGI.escape(@filters)}"
        end
        if @date
          url += "&date=#{@date}"
        end
        url
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plausible_api-0.1.0 lib/plausible_api/stats/timeseries.rb
plausible_api-0.0.3 lib/plausible_api/api/stats/timeseries.rb