class Bugsnag::EndpointValidator

@api private

Public Class Methods

validate(endpoints) click to toggle source
# File lib/bugsnag/endpoint_validator.rb, line 4
def self.validate(endpoints)
  # ensure we have an EndpointConfiguration object
  return Result.missing_urls unless endpoints.is_a?(EndpointConfiguration)

  # check for missing URLs
  return Result.missing_urls if endpoints.notify.nil? && endpoints.sessions.nil?
  return Result.missing_notify if endpoints.notify.nil?
  return Result.missing_session if endpoints.sessions.nil?

  # check for empty URLs
  return Result.invalid_urls if endpoints.notify.empty? && endpoints.sessions.empty?
  return Result.invalid_notify if endpoints.notify.empty?
  return Result.invalid_session if endpoints.sessions.empty?

  Result.valid
end