Module: DiscourseApi::API::Dashboard

Included in:
Client
Defined in:
lib/discourse_api/api/dashboard.rb

Instance Method Summary collapse

Instance Method Details

#get_dashboard_statsObject



5
6
7
8
# File 'lib/discourse_api/api/dashboard.rb', line 5

def get_dashboard_stats
  response = get("admin/dashboard.json")
  response[:body]
end

#get_dashboard_stats_totalsObject



10
11
12
13
14
15
16
17
18
# File 'lib/discourse_api/api/dashboard.rb', line 10

def get_dashboard_stats_totals
  stats = get_dashboard_stats
  global_reports = stats["global_reports"]
  users = global_reports[1]
  topics = global_reports[3]
  posts = global_reports[4]

  { "users" => users["total"], "topics" => topics["total"], "posts" => posts["total"] }
end