Module: Auth0::Api::V2::Logs

Included in:
Auth0::Api::V2
Defined in:
lib/auth0/api/v2/logs.rb

Overview

Methods to use the logs endpoints

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#logs_pathObject (readonly)

Logs API path


59
60
61
# File 'lib/auth0/api/v2/logs.rb', line 59

def logs_path
  @logs_path
end

Instance Method Details

#log(log_id) ⇒ json Also known as: get_logs_by_id

Retrieves log entries that match the specified search criteria.


51
52
53
54
55
# File 'lib/auth0/api/v2/logs.rb', line 51

def log(log_id)
  raise Auth0::MissingParameter, 'Must supply a valid log_id' if log_id.to_s.empty?
  path = "#{logs_path}/#{log_id}"
  get(path)
end

#logs(options = {}) ⇒ json Also known as: get_logs

Retrieves log entries that match the specified search criteria. Default: 50. Max value: 100.


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/auth0/api/v2/logs.rb', line 24

def logs(options = {})
  request_params = {
    q: options.fetch(:q, nil),
    page: options.fetch(:page, nil),
    per_page: options.fetch(:per_page, nil),
    sort: options.fetch(:sort, nil),
    fields: options.fetch(:fields, nil),
    include_fields: options.fetch(:include_fields, nil),
    include_totals: options.fetch(:include_totals, nil),
    from: options.fetch(:from, nil),
    take: options.fetch(:take, nil)
  }
  if request_params[:take].to_i > 100
    raise Auth0::InvalidParameter, 'The total amount of entries to retrieve should be less than 100'
  end
  if request_params[:per_page].to_i > 100
    raise Auth0::InvalidParameter, 'The total amount of entries per page should be less than 100'
  end
  get(logs_path, request_params)
end