Sha256: df04b5dc07bf671ca757e106578d7ddb7a900123a7fb2fd2692fb357f40bfca4

Contents?: true

Size: 1.14 KB

Versions: 41

Compression:

Stored size: 1.14 KB

Contents

module Auth0
  module Api
    module V2
      # Methods to use the stats endpoints
      module Stats
        attr_reader :stats_path

        # Gets the active users count (logged in during the last 30 days).
        # @see https://auth0.com/docs/api/v2#!/Stats/get_active_users
        #
        # @return [integer] Returns the active users count.
        def active_users
          path = "#{stats_path}/active-users"
          get(path)
        end

        # Gets the daily stats for a particular period.
        # @see https://auth0.com/docs/api/v2#!/Stats/get_daily
        # @param from [string] The first day of the period (inclusive) in YYYYMMDD format.
        # @param to [string] The last day of the period (inclusive) in YYYYMMDD format.
        #
        # @return [json] Returns the daily stats.
        def daily_stats(from, to)
          path = "#{stats_path}/daily"
          request_params = {
            from: from,
            to: to
          }
          get(path, request_params)
        end

        private

        # Stats API path
        def stats_path
          @stats_path ||= '/api/v2/stats'
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
auth0-5.18.0 lib/auth0/api/v2/stats.rb
auth0-5.16.0 lib/auth0/api/v2/stats.rb
auth0-5.15.0 lib/auth0/api/v2/stats.rb
auth0-5.14.2 lib/auth0/api/v2/stats.rb
auth0-5.14.1 lib/auth0/api/v2/stats.rb
auth0-5.14.0 lib/auth0/api/v2/stats.rb
auth0-5.13.0 lib/auth0/api/v2/stats.rb
auth0-5.12.0 lib/auth0/api/v2/stats.rb
auth0-5.11.0 lib/auth0/api/v2/stats.rb
auth0-5.10.0 lib/auth0/api/v2/stats.rb
auth0-5.9.0 lib/auth0/api/v2/stats.rb
auth0-5.8.1 lib/auth0/api/v2/stats.rb
auth0-5.8.0 lib/auth0/api/v2/stats.rb
auth0-5.7.0 lib/auth0/api/v2/stats.rb
auth0-5.6.1 lib/auth0/api/v2/stats.rb
auth0-5.6.0 lib/auth0/api/v2/stats.rb
auth0-5.5.0 lib/auth0/api/v2/stats.rb
auth0-5.4.0 lib/auth0/api/v2/stats.rb
auth0-5.3.0 lib/auth0/api/v2/stats.rb
auth0-5.2.0 lib/auth0/api/v2/stats.rb