Class: Savon::GlobalOptions
Instance Attribute Summary
Attributes inherited from Options
Instance Method Summary collapse
-
#adapter(adapter) ⇒ Object
Instruct Savon what HTTPI adapter it should use instead of default.
-
#basic_auth(*credentials) ⇒ Object
HTTP basic auth credentials.
-
#convert_attributes_to(converter = nil, &block) ⇒ Object
Tell Nori how to convert XML attributes on tags from the SOAP response into Hash keys.
-
#convert_request_keys_to(converter) ⇒ Object
Tell Gyoku how to convert Hash key Symbols to XML tags.
-
#convert_response_tags_to(converter = nil, &block) ⇒ Object
Tell Nori how to convert XML tags from the SOAP response into Hash keys.
-
#digest_auth(*credentials) ⇒ Object
HTTP digest auth credentials.
-
#element_form_default(element_form_default) ⇒ Object
Sets whether elements should be :qualified or unqualified.
-
#encoding(encoding) ⇒ Object
The encoding to use.
-
#endpoint(endpoint) ⇒ Object
SOAP endpoint.
-
#env_namespace(env_namespace) ⇒ Object
Can be used to change the SOAP envelope namespace identifier.
-
#filters(*filters) ⇒ Object
A list of XML tags to filter from logged SOAP messages.
-
#headers(headers) ⇒ Object
A Hash of HTTP headers.
-
#initialize(options = {}) ⇒ GlobalOptions
constructor
A new instance of GlobalOptions.
-
#log(log) ⇒ Object
Whether or not to log.
-
#log_level(level) ⇒ Object
Changes the Logger's log level.
-
#logger(logger) ⇒ Object
The logger to use.
-
#multipart(multipart) ⇒ Object
Instruct Savon to create a multipart response if available.
-
#namespace(namespace) ⇒ Object
Target namespace.
-
#namespace_identifier(identifier) ⇒ Object
The namespace identifer.
-
#namespaces(namespaces) ⇒ Object
Namespaces for the SOAP envelope.
-
#ntlm(*credentials) ⇒ Object
NTLM auth credentials.
-
#open_timeout(open_timeout) ⇒ Object
Open timeout in seconds.
-
#pretty_print_xml(pretty_print_xml) ⇒ Object
Whether to pretty print request and response XML log messages.
-
#proxy(proxy) ⇒ Object
Proxy server to use for all requests.
-
#raise_errors(raise_errors) ⇒ Object
Whether or not to raise SOAP fault and HTTP errors.
-
#read_timeout(read_timeout) ⇒ Object
Read timeout in seconds.
-
#soap_header(header) ⇒ Object
The global SOAP header.
-
#soap_version(soap_version) ⇒ Object
Changes the SOAP version to 1 or 2.
-
#ssl_ca_cert_file(file) ⇒ Object
Sets the ca cert file to use.
-
#ssl_cert_file(file) ⇒ Object
Sets the cert file to use.
-
#ssl_cert_key_file(file) ⇒ Object
Sets the cert key file to use.
-
#ssl_cert_key_password(password) ⇒ Object
Sets the cert key password to use.
-
#ssl_verify_mode(verify_mode) ⇒ Object
Whether and how to to verify the connection.
-
#ssl_version(version) ⇒ Object
Specifies the SSL version to use.
-
#strip_namespaces(strip_namespaces) ⇒ Object
Instruct Nori whether to strip namespaces from XML nodes.
-
#use_wsa_headers(use) ⇒ Object
Enable inclusion of WS-Addressing headers.
-
#wsdl(wsdl_address) ⇒ Object
Location of the local or remote WSDL document.
-
#wsse_auth(*credentials) ⇒ Object
WSSE auth credentials for Akami.
-
#wsse_timestamp(*timestamp) ⇒ Object
Instruct Akami to enable wsu:Timestamp headers.
Methods inherited from Options
Constructor Details
#initialize(options = {}) ⇒ GlobalOptions
Returns a new instance of GlobalOptions.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/savon/options.rb', line 43 def initialize( = {}) @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}, :convert_attributes_to => lambda { |k,v| [k,v] }, :multipart => false, :adapter => nil, :use_wsa_headers => false, } = defaults.merge() # this option is a shortcut on the logger which needs to be set # before it can be modified to set the option. delayed_level = .delete(:log_level) super() log_level(delayed_level) unless delayed_level.nil? end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Savon::Options
Instance Method Details
#adapter(adapter) ⇒ Object
Instruct Savon what HTTPI adapter it should use instead of default
272 273 274 |
# File 'lib/savon/options.rb', line 272 def adapter(adapter) @options[:adapter] = adapter end |
#basic_auth(*credentials) ⇒ Object
HTTP basic auth credentials.
217 218 219 |
# File 'lib/savon/options.rb', line 217 def basic_auth(*credentials) @options[:basic_auth] = credentials.flatten end |
#convert_attributes_to(converter = nil, &block) ⇒ Object
Tell Nori how to convert XML attributes on tags from the SOAP response into Hash keys. Accepts a lambda or a block which receives an XML tag and returns a Hash key. Defaults to doing nothing
262 263 264 |
# File 'lib/savon/options.rb', line 262 def convert_attributes_to(converter = nil, &block) @options[:convert_attributes_to] = block || converter end |
#convert_request_keys_to(converter) ⇒ Object
Tell Gyoku how to convert Hash key Symbols to XML tags. Accepts one of :lower_camelcase, :camelcase, :upcase, or :none.
248 249 250 |
# File 'lib/savon/options.rb', line 248 def convert_request_keys_to(converter) @options[:convert_request_keys_to] = converter end |
#convert_response_tags_to(converter = nil, &block) ⇒ Object
Tell Nori how to convert XML tags from the SOAP response into Hash keys. Accepts a lambda or a block which receives an XML tag and returns a Hash key. Defaults to convert tags to snakecase Symbols.
255 256 257 |
# File 'lib/savon/options.rb', line 255 def (converter = nil, &block) @options[:convert_response_tags_to] = block || converter end |
#digest_auth(*credentials) ⇒ Object
HTTP digest auth credentials.
222 223 224 |
# File 'lib/savon/options.rb', line 222 def digest_auth(*credentials) @options[:digest_auth] = credentials.flatten end |
#element_form_default(element_form_default) ⇒ Object
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.
132 133 134 |
# File 'lib/savon/options.rb', line 132 def element_form_default(element_form_default) @options[:element_form_default] = element_form_default end |
#encoding(encoding) ⇒ Object
The encoding to use. Defaults to "UTF-8".
120 121 122 |
# File 'lib/savon/options.rb', line 120 def encoding(encoding) @options[:encoding] = encoding end |
#endpoint(endpoint) ⇒ Object
SOAP endpoint.
80 81 82 |
# File 'lib/savon/options.rb', line 80 def endpoint(endpoint) @options[:endpoint] = endpoint end |
#env_namespace(env_namespace) ⇒ Object
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.
139 140 141 |
# File 'lib/savon/options.rb', line 139 def env_namespace(env_namespace) @options[:env_namespace] = env_namespace end |
#filters(*filters) ⇒ Object
A list of XML tags to filter from logged SOAP messages.
177 178 179 |
# File 'lib/savon/options.rb', line 177 def filters(*filters) @options[:filters] = filters.flatten end |
#headers(headers) ⇒ Object
A Hash of HTTP headers.
105 106 107 |
# File 'lib/savon/options.rb', line 105 def headers(headers) @options[:headers] = headers end |
#log(log) ⇒ Object
Whether or not to log.
154 155 156 157 |
# File 'lib/savon/options.rb', line 154 def log(log) HTTPI.log = log @options[:log] = log end |
#log_level(level) ⇒ Object
Changes the Logger's log level.
165 166 167 168 169 170 171 172 173 174 |
# File 'lib/savon/options.rb', line 165 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 |
#logger(logger) ⇒ Object
The logger to use. Defaults to a Savon::Logger instance.
160 161 162 |
# File 'lib/savon/options.rb', line 160 def logger(logger) @options[:logger] = logger end |
#multipart(multipart) ⇒ Object
Instruct Savon to create a multipart response if available.
267 268 269 |
# File 'lib/savon/options.rb', line 267 def multipart(multipart) @options[:multipart] = multipart end |
#namespace(namespace) ⇒ Object
Target namespace.
85 86 87 |
# File 'lib/savon/options.rb', line 85 def namespace(namespace) @options[:namespace] = namespace end |
#namespace_identifier(identifier) ⇒ Object
The namespace identifer.
90 91 92 |
# File 'lib/savon/options.rb', line 90 def namespace_identifier(identifier) @options[:namespace_identifier] = identifier end |
#namespaces(namespaces) ⇒ Object
Namespaces for the SOAP envelope.
95 96 97 |
# File 'lib/savon/options.rb', line 95 def namespaces(namespaces) @options[:namespaces] = namespaces end |
#ntlm(*credentials) ⇒ Object
NTLM auth credentials.
227 228 229 |
# File 'lib/savon/options.rb', line 227 def ntlm(*credentials) @options[:ntlm] = credentials.flatten end |
#open_timeout(open_timeout) ⇒ Object
Open timeout in seconds.
110 111 112 |
# File 'lib/savon/options.rb', line 110 def open_timeout(open_timeout) @options[:open_timeout] = open_timeout end |
#pretty_print_xml(pretty_print_xml) ⇒ Object
Whether to pretty print request and response XML log messages.
182 183 184 |
# File 'lib/savon/options.rb', line 182 def pretty_print_xml(pretty_print_xml) @options[:pretty_print_xml] = pretty_print_xml end |
#proxy(proxy) ⇒ Object
Proxy server to use for all requests.
100 101 102 |
# File 'lib/savon/options.rb', line 100 def proxy(proxy) @options[:proxy] = proxy end |
#raise_errors(raise_errors) ⇒ Object
Whether or not to raise SOAP fault and HTTP errors.
149 150 151 |
# File 'lib/savon/options.rb', line 149 def raise_errors(raise_errors) @options[:raise_errors] = raise_errors end |
#read_timeout(read_timeout) ⇒ Object
Read timeout in seconds.
115 116 117 |
# File 'lib/savon/options.rb', line 115 def read_timeout(read_timeout) @options[:read_timeout] = read_timeout end |
#soap_header(header) ⇒ Object
The global SOAP header. Expected to be a Hash or responding to #to_s.
125 126 127 |
# File 'lib/savon/options.rb', line 125 def soap_header(header) @options[:soap_header] = header end |
#soap_version(soap_version) ⇒ Object
Changes the SOAP version to 1 or 2.
144 145 146 |
# File 'lib/savon/options.rb', line 144 def soap_version(soap_version) @options[:soap_version] = soap_version end |
#ssl_ca_cert_file(file) ⇒ Object
Sets the ca cert file to use.
212 213 214 |
# File 'lib/savon/options.rb', line 212 def ssl_ca_cert_file(file) @options[:ssl_ca_cert_file] = file end |
#ssl_cert_file(file) ⇒ Object
Sets the cert file to use.
207 208 209 |
# File 'lib/savon/options.rb', line 207 def ssl_cert_file(file) @options[:ssl_cert_file] = file end |
#ssl_cert_key_file(file) ⇒ Object
Sets the cert key file to use.
197 198 199 |
# File 'lib/savon/options.rb', line 197 def ssl_cert_key_file(file) @options[:ssl_cert_key_file] = file end |
#ssl_cert_key_password(password) ⇒ Object
Sets the cert key password to use.
202 203 204 |
# File 'lib/savon/options.rb', line 202 def ssl_cert_key_password(password) @options[:ssl_cert_key_password] = password end |
#ssl_verify_mode(verify_mode) ⇒ Object
Whether and how to to verify the connection.
192 193 194 |
# File 'lib/savon/options.rb', line 192 def ssl_verify_mode(verify_mode) @options[:ssl_verify_mode] = verify_mode end |
#ssl_version(version) ⇒ Object
Specifies the SSL version to use.
187 188 189 |
# File 'lib/savon/options.rb', line 187 def ssl_version(version) @options[:ssl_version] = version end |
#strip_namespaces(strip_namespaces) ⇒ Object
Instruct Nori whether to strip namespaces from XML nodes.
242 243 244 |
# File 'lib/savon/options.rb', line 242 def strip_namespaces(strip_namespaces) @options[:strip_namespaces] = strip_namespaces end |
#use_wsa_headers(use) ⇒ Object
Enable inclusion of WS-Addressing headers.
277 278 279 |
# File 'lib/savon/options.rb', line 277 def use_wsa_headers(use) @options[:use_wsa_headers] = use end |
#wsdl(wsdl_address) ⇒ Object
Location of the local or remote WSDL document.
75 76 77 |
# File 'lib/savon/options.rb', line 75 def wsdl(wsdl_address) @options[:wsdl] = wsdl_address end |
#wsse_auth(*credentials) ⇒ Object
WSSE auth credentials for Akami.
232 233 234 |
# File 'lib/savon/options.rb', line 232 def wsse_auth(*credentials) @options[:wsse_auth] = credentials.flatten end |
#wsse_timestamp(*timestamp) ⇒ Object
Instruct Akami to enable wsu:Timestamp headers.
237 238 239 |
# File 'lib/savon/options.rb', line 237 def (*) @options[:wsse_timestamp] = .flatten end |