class MnoEnterprise::AuditEventsListener

Public Instance Methods

info(key, current_user_id, description, subject_type, subject_id, metadata) click to toggle source
# File lib/mno_enterprise/audit_events_listener.rb, line 10
def info(key, current_user_id, description, subject_type, subject_id, metadata)
  organization_id = if (subject_type == 'MnoEnterprise::Organization') then
                      subject_id
                    elsif metadata.is_a?(Hash)
                      metadata[:organization_id].presence
                    end
  body = {
    data: {
      key: key,
      user_id: current_user_id,
      description: description,
      metadata: metadata,
      subject_type: subject_type,
      subject_id: subject_id,
    }
  }
  body[:data][:organization_id] = organization_id if organization_id
  self.class.post('', body: body)
rescue Net::ReadTimeout
  # Meant to fail
end