Module: Savon::Global
- Included in:
- Savon
- Defined in:
- lib/savon/global.rb
Instance Attribute Summary collapse
-
#log(message) ⇒ Object
Logs a given
message
. -
#log_level ⇒ Object
Returns the log level.
-
#logger ⇒ Object
Returns the logger.
-
#raise_errors ⇒ Object
writeonly
Sets whether to raise HTTP errors and SOAP faults.
-
#strip_namespaces ⇒ Object
writeonly
Sets whether to strip namespaces in a SOAP response Hash.
Instance Method Summary collapse
-
#log? ⇒ Boolean
Returns whether to log HTTP requests.
-
#raise_errors? ⇒ Boolean
Returns whether to raise errors.
-
#reset_config! ⇒ Object
Reset to default configuration.
-
#soap_version ⇒ Object
Returns SOAP version.
-
#soap_version=(version) ⇒ Object
Sets the global SOAP version.
-
#strip_namespaces? ⇒ Boolean
Returns whether to strip namespaces in a SOAP response Hash.
Instance Attribute Details
#log(message) ⇒ Object
Logs a given message
.
32 33 34 |
# File 'lib/savon/global.rb', line 32 def log() logger.send log_level, if log? end |
#log_level ⇒ Object
Returns the log level. Defaults to :debug.
27 28 29 |
# File 'lib/savon/global.rb', line 27 def log_level @log_level ||= :debug end |
#logger ⇒ Object
Returns the logger. Defaults to an instance of Logger
writing to STDOUT.
19 20 21 |
# File 'lib/savon/global.rb', line 19 def logger @logger ||= ::Logger.new STDOUT end |
#raise_errors=(value) ⇒ Object (writeonly)
Sets whether to raise HTTP errors and SOAP faults.
37 38 39 |
# File 'lib/savon/global.rb', line 37 def raise_errors=(value) @raise_errors = value end |
#strip_namespaces=(value) ⇒ Object (writeonly)
Sets whether to strip namespaces in a SOAP response Hash.
62 63 64 |
# File 'lib/savon/global.rb', line 62 def strip_namespaces=(value) @strip_namespaces = value end |
Instance Method Details
#log? ⇒ Boolean
Returns whether to log HTTP requests. Defaults to true
.
11 12 13 |
# File 'lib/savon/global.rb', line 11 def log? @log != false end |
#raise_errors? ⇒ Boolean
Returns whether to raise errors. Defaults to true
.
40 41 42 |
# File 'lib/savon/global.rb', line 40 def raise_errors? @raise_errors != false end |
#reset_config! ⇒ Object
Reset to default configuration.
65 66 67 68 69 70 71 72 |
# File 'lib/savon/global.rb', line 65 def reset_config! self.log = true self.logger = ::Logger.new STDOUT self.log_level = :debug self.raise_errors = true self.soap_version = SOAP::DefaultVersion self.strip_namespaces = true end |
#soap_version ⇒ Object
Returns SOAP version. Defaults to DefaultVersion
.
51 52 53 |
# File 'lib/savon/global.rb', line 51 def soap_version @version ||= SOAP::DefaultVersion end |
#soap_version=(version) ⇒ Object
Sets the global SOAP version.
45 46 47 48 |
# File 'lib/savon/global.rb', line 45 def soap_version=(version) raise ArgumentError, "Invalid SOAP version: #{version}" unless SOAP::Versions.include? version @version = version end |
#strip_namespaces? ⇒ Boolean
Returns whether to strip namespaces in a SOAP response Hash. Defaults to true
.
57 58 59 |
# File 'lib/savon/global.rb', line 57 def strip_namespaces? @strip_namespaces != false end |