Sha256: b15a66c3c914dcfd2ca5604ce4c985ffd99a5d36a9140d231eba6798604f1601

Contents?: true

Size: 1.38 KB

Versions: 4

Compression:

Stored size: 1.38 KB

Contents

module Auth0
  module Api
    module V1
      # {https://auth0.com/docs/api#logs}
      module Logs
        # {https://auth0.com/docs/api#!#get--api-logs-page--number--per_page--items--sort--field----1-1--fields--fields--exclude_fields-true-false-}
        #
        # {https://auth0.com/docs/api#!#get--api-logs-search--criteria-}
        #
        # {https://auth0.com/docs/api#!#get--api-logs-from--checkpointId--take--count-}
        def logs(options={})
          acceptable_params = %i(take from search_criteria page per_page sort fields exclude_fields)
          options.reject! do |key,value|
            if key.nil? ||\
                value.nil? ||\
                !acceptable_params.include?(key.to_sym)
              warn "#{key} is not in acceptable params list: #{acceptable_params}"
              true
            end
          end
          path= "/api/logs?"+URI.encode_www_form(options)
          get(path)
        end

        alias :search_logs :logs

        # {https://auth0.com/docs/api#!#get--api-logs--_id-}
        def log(id)
          path = "/api/logs/#{id}"
          get(path)
        end

        # {https://auth0.com/docs/api#!#get--api-users--user_id--logs-page--number--per_page--items-}
        def user_logs(user_id, page=0, per_page=50)
          path = "/api/users/#{user_id}/logs?page=#{page}&per_page=#{per_page}"
          get(path)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
auth0-3.6.1 lib/auth0/api/v1/logs.rb
auth0-3.6.0 lib/auth0/api/v1/logs.rb
auth0-3.5.0 lib/auth0/api/v1/logs.rb
auth0-3.4.0 lib/auth0/api/v1/logs.rb