lib/embulk/input/marketo/base.rb in embulk-input-marketo-0.5.3 vs lib/embulk/input/marketo/base.rb in embulk-input-marketo-0.5.4

- old
+ new

@@ -18,10 +18,12 @@ endpoint_url: endpoint_url, wsdl_url: config.param(:wsdl, :string, default: "#{endpoint_url}?WSDL"), user_id: config.param(:user_id, :string), encryption_key: config.param(:encryption_key, :string), } + validate_url(soap_config[:endpoint_url], "endpoint") + validate_url(soap_config[:wsdl_url], "wsdl") MarketoApi.soap_client(soap_config, target) end def self.embulk_columns(config) @@ -96,9 +98,15 @@ end result end private + + def self.validate_url(url, key) + URI.parse(url) + rescue URI::InvalidURIError + raise ConfigError.new("#{key}: '#{url}' is not a valid URL.") + end def preview? begin org.embulk.spi.Exec.isPreview() rescue java.lang.NullPointerException => e