Sha256: bfec55e90c96d72156e11cf9310c5bf6bfdc137793b5a5c9aa3ba43b2a157c42

Contents?: true

Size: 583 Bytes

Versions: 4

Compression:

Stored size: 583 Bytes

Contents

# frozen_string_literal: true
module DiscourseApi
  module API
    module Dashboard
      def get_dashboard_stats
        response = get("admin/dashboard.json")
        response[:body]
      end

      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
discourse_api-1.1.0 lib/discourse_api/api/dashboard.rb
discourse_api-1.0.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.48.1 lib/discourse_api/api/dashboard.rb
discourse_api-0.48.0 lib/discourse_api/api/dashboard.rb