Module: Savon::Global
- Included in:
- Savon
- Defined in:
- lib/savon/global.rb
Instance Attribute Summary collapse
-
#env_namespace ⇒ Object
Returns the global env_namespace.
-
#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.
-
#soap_header ⇒ Object
Returns the global soap_header.
Instance Method Summary collapse
-
#deprecate(message) ⇒ Object
Expects a
message
and raises a warning if configured. -
#deprecate=(deprecate) ⇒ Object
Sets whether to warn about deprecations.
-
#deprecate? ⇒ Boolean
Returns whether to warn about deprecation.
-
#hooks ⇒ Object
Returns the hooks.
-
#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=(strip) ⇒ Object
Sets whether to strip namespaces in a SOAP response Hash.
-
#strip_namespaces? ⇒ Boolean
Returns whether to strip namespaces in a SOAP response Hash.
Instance Attribute Details
#env_namespace ⇒ Object
Returns the global env_namespace.
70 71 72 |
# File 'lib/savon/global.rb', line 70 def env_namespace @env_namespace end |
#log(message) ⇒ Object
Logs a given message
.
33 34 35 |
# File 'lib/savon/global.rb', line 33 def log() logger.send log_level, if log? end |
#log_level ⇒ Object
Returns the log level. Defaults to :debug.
28 29 30 |
# File 'lib/savon/global.rb', line 28 def log_level @log_level ||= :debug end |
#logger ⇒ Object
Returns the logger. Defaults to an instance of Logger
writing to STDOUT.
20 21 22 |
# File 'lib/savon/global.rb', line 20 def logger @logger ||= ::Logger.new STDOUT end |
#raise_errors=(value) ⇒ Object (writeonly)
Sets whether to raise HTTP errors and SOAP faults.
38 39 40 |
# File 'lib/savon/global.rb', line 38 def raise_errors=(value) @raise_errors = value end |
#soap_header ⇒ Object
Returns the global soap_header.
76 77 78 |
# File 'lib/savon/global.rb', line 76 def soap_header @soap_header end |
Instance Method Details
#deprecate(message) ⇒ Object
Expects a message
and raises a warning if configured.
82 83 84 |
# File 'lib/savon/global.rb', line 82 def deprecate() warn("Deprecation: #{}") if deprecate? end |
#deprecate=(deprecate) ⇒ Object
Sets whether to warn about deprecations.
87 88 89 |
# File 'lib/savon/global.rb', line 87 def deprecate=(deprecate) @deprecate = deprecate end |
#deprecate? ⇒ Boolean
Returns whether to warn about deprecation.
92 93 94 |
# File 'lib/savon/global.rb', line 92 def deprecate? @deprecate != false end |
#hooks ⇒ Object
Returns the hooks.
97 98 99 |
# File 'lib/savon/global.rb', line 97 def hooks @hooks ||= Hooks::Group.new end |
#log? ⇒ Boolean
Returns whether to log HTTP requests. Defaults to true
.
12 13 14 |
# File 'lib/savon/global.rb', line 12 def log? @log != false end |
#raise_errors? ⇒ Boolean
Returns whether to raise errors. Defaults to true
.
41 42 43 |
# File 'lib/savon/global.rb', line 41 def raise_errors? @raise_errors != false end |
#reset_config! ⇒ Object
Reset to default configuration.
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/savon/global.rb', line 102 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 self.env_namespace = nil self.soap_header = {} end |
#soap_version ⇒ Object
Returns SOAP version. Defaults to DefaultVersion
.
52 53 54 |
# File 'lib/savon/global.rb', line 52 def soap_version @version ||= SOAP::DefaultVersion end |
#soap_version=(version) ⇒ Object
Sets the global SOAP version.
46 47 48 49 |
# File 'lib/savon/global.rb', line 46 def soap_version=(version) raise ArgumentError, "Invalid SOAP version: #{version}" unless SOAP::Versions.include? version @version = version end |