savon 0.9.7 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +2 -1
- data/.yardopts +4 -1
- data/CHANGELOG.md +34 -0
- data/Gemfile +0 -5
- data/README.md +14 -12
- data/Rakefile +2 -6
- data/lib/savon.rb +4 -3
- data/lib/savon/config.rb +103 -0
- data/lib/savon/hooks/group.rb +46 -0
- data/lib/savon/hooks/hook.rb +36 -0
- data/lib/savon/model.rb +103 -0
- data/lib/savon/soap/invalid_response_error.rb +11 -0
- data/lib/savon/soap/request.rb +19 -20
- data/lib/savon/soap/response.rb +7 -0
- data/lib/savon/soap/xml.rb +9 -1
- data/lib/savon/version.rb +1 -1
- data/savon.gemspec +3 -0
- data/spec/savon/model_spec.rb +194 -0
- data/spec/savon/savon_spec.rb +33 -11
- data/spec/savon/soap/request_spec.rb +24 -10
- data/spec/savon/soap/response_spec.rb +15 -0
- data/spec/savon/soap/xml_spec.rb +20 -3
- data/spec/spec_helper.rb +2 -5
- metadata +124 -161
- data/lib/savon/global.rb +0 -109
data/lib/savon/global.rb
DELETED
@@ -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
|
-
|