Class: Webhookdb::API::SyncTargets::ConnectionUrlType

Inherits:
Grape::Validations::Validators::Base
  • Object
show all
Defined in:
lib/webhookdb/api/sync_targets.rb

Instance Method Summary collapse

Instance Method Details

#validate!(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/webhookdb/api/sync_targets.rb', line 11

def validate!(params)
  url = params[:connection_url]
  case @option
    when "db", "http"
      if (err = Webhookdb::SyncTarget.send(:"validate_#{@option}_url", url))
        raise Grape::Exceptions::Validation.new params: [url], message: err
      end
  else
      raise Grape::Exceptions::Validation.new params: [url], message: "#{@option} is not a valid connection url type"
  end
end