Class: PlausibleApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/plausible_api/api/client.rb

Constant Summary collapse

BASE_URL =
'https://plausible.io'

Instance Method Summary collapse

Constructor Details

#initialize(site_id:, token:) ⇒ Client

Returns a new instance of Client.



15
16
17
18
# File 'lib/plausible_api/api/client.rb', line 15

def initialize(site_id:, token:)
  @site_id = site_id.to_s
  @token   = token.to_s
end

Instance Method Details

#aggregate(options = {}) ⇒ Object



20
21
22
# File 'lib/plausible_api/api/client.rb', line 20

def aggregate(options = {})
  call PlausibleApi::Stats::Aggregate.new(options)
end

#realtime_visitorsObject



28
29
30
# File 'lib/plausible_api/api/client.rb', line 28

def realtime_visitors
  call PlausibleApi::Realtime::Visitors.new
end

#timeseries(options = {}) ⇒ Object



24
25
26
# File 'lib/plausible_api/api/client.rb', line 24

def timeseries(options = {})
  call PlausibleApi::Stats::Timeseries.new(options)
end