rubiii-apricoteatsgorilla 0.5.5 → 0.5.6
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/Rakefile +2 -2
- data/VERSION +1 -1
- data/apricoteatsgorilla.gemspec +8 -7
- data/lib/apricoteatsgorilla/apricoteatsgorilla.rb +11 -3
- data/spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb +21 -5
- metadata +7 -7
data/Rakefile
CHANGED
@@ -23,9 +23,9 @@ begin
|
|
23
23
|
Jeweler::Tasks.new do |spec|
|
24
24
|
spec.name = "apricoteatsgorilla"
|
25
25
|
spec.author = "Daniel Harrington"
|
26
|
-
spec.email = "me@
|
26
|
+
spec.email = "me@rubiii.com"
|
27
27
|
spec.homepage = "http://github.com/rubiii/apricoteatsgorilla"
|
28
|
-
spec.summary = "SOAP communication helper
|
28
|
+
spec.summary = "SOAP communication helper"
|
29
29
|
spec.description = spec.summary
|
30
30
|
|
31
31
|
spec.rdoc_options += [
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.6
|
data/apricoteatsgorilla.gemspec
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{apricoteatsgorilla}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Daniel Harrington"]
|
12
12
|
s.date = %q{2009-09-02}
|
13
13
|
s.description = %q{SOAP communication helper.}
|
14
|
-
s.email = %q{me@
|
14
|
+
s.email = %q{me@rubiii.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.rdoc"
|
17
17
|
]
|
@@ -30,22 +30,23 @@ Gem::Specification.new do |s|
|
|
30
30
|
"spec/apricoteatsgorilla/xml_node_spec.rb",
|
31
31
|
"spec/spec_helper.rb"
|
32
32
|
]
|
33
|
+
s.has_rdoc = true
|
33
34
|
s.homepage = %q{http://github.com/rubiii/apricoteatsgorilla}
|
34
35
|
s.rdoc_options = ["--charset=UTF-8", "--title", "Apricot eats Gorilla", "--main", "README.rdoc", "--line-numbers", "--inline-source"]
|
35
36
|
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.3.
|
37
|
+
s.rubygems_version = %q{1.3.1}
|
37
38
|
s.summary = %q{SOAP communication helper.}
|
38
39
|
s.test_files = [
|
39
|
-
"spec/
|
40
|
+
"spec/apricoteatsgorilla/apricoteatsgorilla_hash_to_xml_spec.rb",
|
41
|
+
"spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb",
|
40
42
|
"spec/apricoteatsgorilla/apricoteatsgorilla_xml_to_hash_spec.rb",
|
41
43
|
"spec/apricoteatsgorilla/xml_node_spec.rb",
|
42
|
-
"spec/
|
43
|
-
"spec/apricoteatsgorilla/apricoteatsgorilla_hash_to_xml_spec.rb"
|
44
|
+
"spec/spec_helper.rb"
|
44
45
|
]
|
45
46
|
|
46
47
|
if s.respond_to? :specification_version then
|
47
48
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
48
|
-
s.specification_version =
|
49
|
+
s.specification_version = 2
|
49
50
|
|
50
51
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
51
52
|
s.add_runtime_dependency(%q<hpricot>, ["= 0.8.241"])
|
@@ -10,6 +10,12 @@ end
|
|
10
10
|
class ApricotEatsGorilla
|
11
11
|
class << self
|
12
12
|
|
13
|
+
# SOAP namespaces by SOAP version.
|
14
|
+
SOAPNamespace = {
|
15
|
+
1 => "http://schemas.xmlsoap.org/soap/envelope/",
|
16
|
+
2 => "http://www.w3.org/2003/05/soap-envelope"
|
17
|
+
}
|
18
|
+
|
13
19
|
# Flag to enable sorting of Hash keys.
|
14
20
|
attr_accessor :sort_keys
|
15
21
|
|
@@ -107,7 +113,8 @@ class ApricotEatsGorilla
|
|
107
113
|
|
108
114
|
# Builds a SOAP request envelope and includes the content of a given
|
109
115
|
# +block+ into the envelope body. Accepts a Hash of additional +namespaces+
|
110
|
-
# to set.
|
116
|
+
# to set. Also accepts an optional +version+ to specify the SOAP envelope
|
117
|
+
# namespace to use by SOAP version.
|
111
118
|
#
|
112
119
|
# ==== Examples
|
113
120
|
#
|
@@ -128,8 +135,9 @@ class ApricotEatsGorilla
|
|
128
135
|
# # => pureText
|
129
136
|
# # => </env:Body>
|
130
137
|
# # => </env:Envelope>'
|
131
|
-
def soap_envelope(namespaces = {})
|
132
|
-
namespaces[:env] =
|
138
|
+
def soap_envelope(namespaces = {}, version = 1)
|
139
|
+
namespaces[:env] = SOAPNamespace[version] unless
|
140
|
+
namespaces[:env] || SOAPNamespace[version].nil?
|
133
141
|
|
134
142
|
xml_node("env:Envelope", namespaces) do
|
135
143
|
xml_node("env:Body") { yield if block_given? }
|
@@ -16,21 +16,37 @@ describe ApricotEatsGorilla do
|
|
16
16
|
describe "soap_envelope" do
|
17
17
|
before { ApricotEatsGorilla.sort_keys = true }
|
18
18
|
|
19
|
-
it "returns
|
19
|
+
it "returns an empty SOAP envelope with a SOAP 1.1 envelope namespace" do
|
20
20
|
ApricotEatsGorilla.soap_envelope.should ==
|
21
21
|
'<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">' <<
|
22
22
|
'<env:Body /></env:Envelope>'
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it "returns a SOAP envelope with a custom namespace and body content" do
|
26
|
-
|
26
|
+
ApricotEatsGorilla.soap_envelope(:wsdl => "http://example.com") do
|
27
27
|
"<id>123</id>"
|
28
|
-
end
|
29
|
-
result.should == '<env:Envelope' <<
|
28
|
+
end.should == '<env:Envelope' <<
|
30
29
|
' xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"' <<
|
31
30
|
' xmlns:wsdl="http://example.com">' <<
|
32
31
|
'<env:Body><id>123</id></env:Body></env:Envelope>'
|
33
32
|
end
|
33
|
+
|
34
|
+
it "does not change an already defined SOAP envelope namespace" do
|
35
|
+
ApricotEatsGorilla.soap_envelope(:env => "http://example.com").should ==
|
36
|
+
'<env:Envelope xmlns:env="http://example.com">' <<
|
37
|
+
'<env:Body /></env:Envelope>'
|
38
|
+
end
|
39
|
+
|
40
|
+
it "sets the SOAP envelope namespace for SOAP version 1.2 if requested" do
|
41
|
+
ApricotEatsGorilla.soap_envelope({}, 2).should ==
|
42
|
+
'<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">' <<
|
43
|
+
'<env:Body /></env:Envelope>'
|
44
|
+
end
|
45
|
+
|
46
|
+
it "does not set a SOAP envelope namespace in case of an invalid SOAP version" do
|
47
|
+
ApricotEatsGorilla.soap_envelope({}, 123).should ==
|
48
|
+
'<env:Envelope><env:Body /></env:Envelope>'
|
49
|
+
end
|
34
50
|
end
|
35
51
|
|
36
52
|
# []
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubiii-apricoteatsgorilla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Harrington
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: 1.2.8
|
34
34
|
version:
|
35
35
|
description: SOAP communication helper.
|
36
|
-
email: me@
|
36
|
+
email: me@rubiii.com
|
37
37
|
executables: []
|
38
38
|
|
39
39
|
extensions: []
|
@@ -54,7 +54,7 @@ files:
|
|
54
54
|
- spec/apricoteatsgorilla/apricoteatsgorilla_xml_to_hash_spec.rb
|
55
55
|
- spec/apricoteatsgorilla/xml_node_spec.rb
|
56
56
|
- spec/spec_helper.rb
|
57
|
-
has_rdoc:
|
57
|
+
has_rdoc: true
|
58
58
|
homepage: http://github.com/rubiii/apricoteatsgorilla
|
59
59
|
post_install_message:
|
60
60
|
rdoc_options:
|
@@ -84,11 +84,11 @@ requirements: []
|
|
84
84
|
rubyforge_project:
|
85
85
|
rubygems_version: 1.2.0
|
86
86
|
signing_key:
|
87
|
-
specification_version:
|
87
|
+
specification_version: 2
|
88
88
|
summary: SOAP communication helper.
|
89
89
|
test_files:
|
90
|
-
- spec/
|
90
|
+
- spec/apricoteatsgorilla/apricoteatsgorilla_hash_to_xml_spec.rb
|
91
|
+
- spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb
|
91
92
|
- spec/apricoteatsgorilla/apricoteatsgorilla_xml_to_hash_spec.rb
|
92
93
|
- spec/apricoteatsgorilla/xml_node_spec.rb
|
93
|
-
- spec/
|
94
|
-
- spec/apricoteatsgorilla/apricoteatsgorilla_hash_to_xml_spec.rb
|
94
|
+
- spec/spec_helper.rb
|