Sha256: f858a2104a27dfb5ebc295bccece9ec9eb61b4528172294bf295a13a30fa6e08

Contents?: true

Size: 587 Bytes

Versions: 33

Compression:

Stored size: 587 Bytes

Contents

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]
        
        totals = {
          'users'  => users['total'],
          'topics' => topics['total'],
          'posts'  => posts['total']
        }
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
discourse_api-0.16.1 lib/discourse_api/api/dashboard.rb
discourse_api-0.16.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.15.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.14.1 lib/discourse_api/api/dashboard.rb
discourse_api-0.14.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.13.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.12.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.10.1 lib/discourse_api/api/dashboard.rb
discourse_api-0.10.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.9.1 lib/discourse_api/api/dashboard.rb
discourse_api-0.9.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.8.1 lib/discourse_api/api/dashboard.rb
discourse_api-0.8.0 lib/discourse_api/api/dashboard.rb