Class: Webhooks::Endpoint

Inherits:
ApplicationRecord show all
Defined in:
app/models/webhooks/endpoint.rb

Constant Summary collapse

URL_REGEX =
URI::DEFAULT_PARSER.make_regexp(Rails.application.config.webhooks.endpoints.valid_schemas)

Instance Method Summary collapse

Instance Method Details

#event_types=(new_event_types) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'app/models/webhooks/endpoint.rb', line 42

def event_types=(new_event_types)
  prepared_endpoint_types = Array.wrap(new_event_types).reject(&:blank?)

  if prepared_endpoint_types.any?
    super(prepared_endpoint_types)
  else
    super(nil)
  end
end

#to_sObject



52
53
54
# File 'app/models/webhooks/endpoint.rb', line 52

def to_s
  url
end