Method: Auth0::Api::V2::Users#user_logs
- Defined in:
- lib/auth0/api/v2/users.rb
#user_logs(user_id, options = {}) ⇒ json Also known as: get_user_log_events
Retrieve every log event for a specific user id rubocop:disable Metrics/MethodLength, Metrics/AbcSize
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/auth0/api/v2/users.rb', line 181 def user_logs(user_id, = {}) raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty? path = "#{users_path}/#{user_id}/logs" request_params = { per_page: .fetch(:per_page, nil), page: .fetch(:page, nil), include_totals: .fetch(:include_totals, nil), sort: .fetch(:sort, nil) } if request_params[:per_page].to_i > 100 raise Auth0::InvalidParameter, 'The total amount of entries per page should be less than 100' end sort_pattern = /^(([a-zA-Z0-9_\.]+))\:(1|-1)$/ if !request_params[:sort].nil? && !sort_pattern.match(request_params[:sort]) raise Auth0::InvalidParameter, 'Sort does not match pattern ^(([a-zA-Z0-9_\\.]+))\\:(1|-1)$' end get(path, request_params) end |