class Savon::GlobalOptions
Public Class Methods
Savon::Options::new
# File lib/savon/options.rb, line 43 def initialize(options = {}) @option_type = :global defaults = { :encoding => "UTF-8", :soap_version => 1, :namespaces => {}, :logger => Logger.new($stdout), :log => false, :filters => [], :pretty_print_xml => false, :raise_errors => true, :strip_namespaces => true, :convert_response_tags_to => lambda { |tag| tag.snakecase.to_sym}, :multipart => false, :adapter => nil, } options = defaults.merge(options) # this option is a shortcut on the logger which needs to be set # before it can be modified to set the option. delayed_level = options.delete(:log_level) super(options) log_level(delayed_level) unless delayed_level.nil? end
Public Instance Methods
Instruct Savon
what HTTPI adapter it should use instead of default
# File lib/savon/options.rb, line 263 def adapter(adapter) @options[:adapter] = adapter end
HTTP basic auth credentials.
# File lib/savon/options.rb, line 215 def basic_auth(*credentials) @options[:basic_auth] = credentials.flatten end
Tell Gyoku how to convert Hash key Symbols to XML tags. Accepts one of :lower_camelcase, :camelcase, :upcase, or :none.
# File lib/savon/options.rb, line 246 def convert_request_keys_to(converter) @options[:convert_request_keys_to] = converter end
HTTP digest auth credentials.
# File lib/savon/options.rb, line 220 def digest_auth(*credentials) @options[:digest_auth] = credentials.flatten end
Sets whether elements should be :qualified or unqualified. If you need to use this option, please open an issue and make sure to add your WSDL document for debugging.
# File lib/savon/options.rb, line 130 def element_form_default(element_form_default) @options[:element_form_default] = element_form_default end
The encoding to use. Defaults to “UTF-8”.
# File lib/savon/options.rb, line 118 def encoding(encoding) @options[:encoding] = encoding end
SOAP endpoint.
# File lib/savon/options.rb, line 78 def endpoint(endpoint) @options[:endpoint] = endpoint end
Can be used to change the SOAP envelope namespace identifier. If you need to use this option, please open an issue and make sure to add your WSDL document for debugging.
# File lib/savon/options.rb, line 137 def env_namespace(env_namespace) @options[:env_namespace] = env_namespace end
A list of XML tags to filter from logged SOAP messages.
# File lib/savon/options.rb, line 175 def filters(*filters) @options[:filters] = filters.flatten end
A Hash of HTTP headers.
# File lib/savon/options.rb, line 103 def headers(headers) @options[:headers] = headers end
Whether or not to log.
# File lib/savon/options.rb, line 152 def log(log) HTTPI.log = log @options[:log] = log end
Changes the Logger’s log level.
# File lib/savon/options.rb, line 163 def log_level(level) levels = { :debug => 0, :info => 1, :warn => 2, :error => 3, :fatal => 4 } unless levels.include? level raise ArgumentError, "Invalid log level: #{level.inspect}\n" \ "Expected one of: #{levels.keys.inspect}" end @options[:logger].level = levels[level] end
The logger to use. Defaults to a Savon::Logger instance.
# File lib/savon/options.rb, line 158 def logger(logger) @options[:logger] = logger end
Instruct Savon
to create a multipart response if available.
# File lib/savon/options.rb, line 258 def multipart(multipart) @options[:multipart] = multipart end
Target namespace.
# File lib/savon/options.rb, line 83 def namespace(namespace) @options[:namespace] = namespace end
The namespace identifer.
# File lib/savon/options.rb, line 88 def namespace_identifier(identifier) @options[:namespace_identifier] = identifier end
Namespaces for the SOAP envelope.
# File lib/savon/options.rb, line 93 def namespaces(namespaces) @options[:namespaces] = namespaces end
NTLM auth credentials.
# File lib/savon/options.rb, line 225 def ntlm(*credentials) @options[:ntlm] = credentials.flatten end
Open timeout in seconds.
# File lib/savon/options.rb, line 108 def open_timeout(open_timeout) @options[:open_timeout] = open_timeout end
Whether to pretty print request and response XML log messages.
# File lib/savon/options.rb, line 180 def pretty_print_xml(pretty_print_xml) @options[:pretty_print_xml] = pretty_print_xml end
Proxy server to use for all requests.
# File lib/savon/options.rb, line 98 def proxy(proxy) @options[:proxy] = proxy end
Whether or not to raise SOAP fault and HTTP errors.
# File lib/savon/options.rb, line 147 def raise_errors(raise_errors) @options[:raise_errors] = raise_errors end
Read timeout in seconds.
# File lib/savon/options.rb, line 113 def read_timeout(read_timeout) @options[:read_timeout] = read_timeout end
The global SOAP header. Expected to be a Hash or responding to to_s.
# File lib/savon/options.rb, line 123 def soap_header(header) @options[:soap_header] = header end
Changes the SOAP version to 1 or 2.
# File lib/savon/options.rb, line 142 def soap_version(soap_version) @options[:soap_version] = soap_version end
Sets the ca cert file to use.
# File lib/savon/options.rb, line 210 def ssl_ca_cert_file(file) @options[:ssl_ca_cert_file] = file end
Sets the cert file to use.
# File lib/savon/options.rb, line 205 def ssl_cert_file(file) @options[:ssl_cert_file] = file end
Sets the cert key file to use.
# File lib/savon/options.rb, line 195 def ssl_cert_key_file(file) @options[:ssl_cert_key_file] = file end
Sets the cert key password to use.
# File lib/savon/options.rb, line 200 def ssl_cert_key_password(password) @options[:ssl_cert_key_password] = password end
Whether and how to to verify the connection.
# File lib/savon/options.rb, line 190 def ssl_verify_mode(verify_mode) @options[:ssl_verify_mode] = verify_mode end
Specifies the SSL version to use.
# File lib/savon/options.rb, line 185 def ssl_version(version) @options[:ssl_version] = version end
Instruct Nori whether to strip namespaces from XML nodes.
# File lib/savon/options.rb, line 240 def strip_namespaces(strip_namespaces) @options[:strip_namespaces] = strip_namespaces end
Location of the local or remote WSDL document.
# File lib/savon/options.rb, line 73 def wsdl(wsdl_address) @options[:wsdl] = wsdl_address end
WSSE auth credentials for Akami.
# File lib/savon/options.rb, line 230 def wsse_auth(*credentials) @options[:wsse_auth] = credentials.flatten end
Instruct Akami to enable wsu:Timestamp headers.
# File lib/savon/options.rb, line 235 def wsse_timestamp(*timestamp) @options[:wsse_timestamp] = timestamp.flatten end