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.34.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.33.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.32.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.31.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.30.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.29.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.28.1 lib/discourse_api/api/dashboard.rb
discourse_api-0.28.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.27.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.26.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.25.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.24.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.23.1 lib/discourse_api/api/dashboard.rb
discourse_api-0.23.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.22.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.20.1 lib/discourse_api/api/dashboard.rb
discourse_api-0.20.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.19.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.18.0 lib/discourse_api/api/dashboard.rb
discourse_api-0.17.0 lib/discourse_api/api/dashboard.rb