savon 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,109 +0,0 @@
1
- require "logger"
2
- require "savon/soap"
3
-
4
- module Savon
5
- module Global
6
-
7
- # Sets whether to log HTTP requests.
8
- attr_writer :log
9
-
10
- # Returns whether to log HTTP requests. Defaults to +true+.
11
- def log?
12
- @log != false
13
- end
14
-
15
- # Sets the logger to use.
16
- attr_writer :logger
17
-
18
- # Returns the logger. Defaults to an instance of +Logger+ writing to STDOUT.
19
- def logger
20
- @logger ||= ::Logger.new STDOUT
21
- end
22
-
23
- # Sets the log level.
24
- attr_writer :log_level
25
-
26
- # Returns the log level. Defaults to :debug.
27
- def log_level
28
- @log_level ||= :debug
29
- end
30
-
31
- # Logs a given +message+.
32
- def log(message)
33
- logger.send log_level, message if log?
34
- end
35
-
36
- # Sets whether to raise HTTP errors and SOAP faults.
37
- attr_writer :raise_errors
38
-
39
- # Returns whether to raise errors. Defaults to +true+.
40
- def raise_errors?
41
- @raise_errors != false
42
- end
43
-
44
- # Sets the global SOAP version.
45
- def soap_version=(version)
46
- raise ArgumentError, "Invalid SOAP version: #{version}" unless SOAP::Versions.include? version
47
- @version = version
48
- end
49
-
50
- # Returns SOAP version. Defaults to +DefaultVersion+.
51
- def soap_version
52
- @version ||= SOAP::DefaultVersion
53
- end
54
-
55
- # Returns whether to strip namespaces in a SOAP response Hash.
56
- # Defaults to +true+.
57
- def strip_namespaces?
58
- Savon.deprecate("use Nori.strip_namespaces? instead of Savon.strip_namespaces?")
59
- Nori.strip_namespaces?
60
- end
61
-
62
- # Sets whether to strip namespaces in a SOAP response Hash.
63
- def strip_namespaces=(strip)
64
- Savon.deprecate("use Nori.strip_namespaces= instead of Savon.strip_namespaces=")
65
- Nori.strip_namespaces = strip
66
- end
67
-
68
- # Returns the global env_namespace.
69
- attr_reader :env_namespace
70
-
71
- # Sets the global env_namespace.
72
- attr_writer :env_namespace
73
-
74
- # Returns the global soap_header.
75
- attr_reader :soap_header
76
-
77
- # Sets the global soap_header.
78
- attr_writer :soap_header
79
-
80
- # Expects a +message+ and raises a warning if configured.
81
- def deprecate(message)
82
- warn("Deprecation: #{message}") if deprecate?
83
- end
84
-
85
- # Sets whether to warn about deprecations.
86
- def deprecate=(deprecate)
87
- @deprecate = deprecate
88
- end
89
-
90
- # Returns whether to warn about deprecation.
91
- def deprecate?
92
- @deprecate != false
93
- end
94
-
95
- # Reset to default configuration.
96
- def reset_config!
97
- self.log = true
98
- self.logger = ::Logger.new STDOUT
99
- self.log_level = :debug
100
- self.raise_errors = true
101
- self.soap_version = SOAP::DefaultVersion
102
- self.strip_namespaces = true
103
- self.env_namespace = nil
104
- self.soap_header = {}
105
- end
106
-
107
- end
108
- end
109
-