Sha256: 5f5cbb49fb6258f4f051cc5690b09208266cff11b36b35ca446e49f36c45f901

Contents?: true

Size: 1.38 KB

Versions: 9

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

9 entries across 9 versions & 2 rubygems

Version Path
auth0-3.3.0 lib/auth0/api/v1/logs.rb
auth0-3.2.0 lib/auth0/api/v1/logs.rb
auth0-3.1.2 lib/auth0/api/v1/logs.rb
auth0-3.1.1 lib/auth0/api/v1/logs.rb
auth0-3.1.0 lib/auth0/api/v1/logs.rb
auth0-3.0.0 lib/auth0/api/v1/logs.rb
auth0-ruby-0.10 lib/auth0/api/v1/logs.rb
auth0-ruby-0.9.1 lib/auth0/api/v1/logs.rb
auth0-ruby-0.9 lib/auth0/api/v1/logs.rb