moon 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/moon/response/xml.rb +5 -3
- data/spec/lib/moon/response/xml_spec.rb +2 -2
- metadata +3 -3
data/lib/moon/response/xml.rb
CHANGED
@@ -6,8 +6,8 @@ class Moon::Response::XML < Moon::Response::Base
|
|
6
6
|
attr_accessor :status
|
7
7
|
attr_accessor :hash
|
8
8
|
|
9
|
-
def initialize(status,
|
10
|
-
@status, @
|
9
|
+
def initialize(status, hash = { })
|
10
|
+
@status, @hash = status, hash
|
11
11
|
end
|
12
12
|
|
13
13
|
def headers
|
@@ -15,7 +15,9 @@ class Moon::Response::XML < Moon::Response::Base
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def body
|
18
|
-
XmlSimple.xml_out @hash,
|
18
|
+
XmlSimple.xml_out @hash,
|
19
|
+
"XmlDeclaration" => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
|
20
|
+
"KeepRoot" => true
|
19
21
|
end
|
20
22
|
|
21
23
|
end
|
@@ -3,7 +3,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "sp
|
|
3
3
|
describe Moon::Response::XML do
|
4
4
|
|
5
5
|
before :each do
|
6
|
-
@response = described_class.new 201,
|
6
|
+
@response = described_class.new 201, { "message" => { "content" => "OK", "priority" => "normal" } }
|
7
7
|
end
|
8
8
|
|
9
9
|
describe "status" do
|
@@ -25,7 +25,7 @@ describe Moon::Response::XML do
|
|
25
25
|
describe "body" do
|
26
26
|
|
27
27
|
it "should return the given hash encoded in json" do
|
28
|
-
@response.body.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<
|
28
|
+
@response.body.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<message priority=\"normal\">OK</message>\n"
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: moon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- "Philipp Br\xC3\xBCll"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-24 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -166,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
166
|
requirements:
|
167
167
|
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
hash: -
|
169
|
+
hash: -3709709264728262568
|
170
170
|
segments:
|
171
171
|
- 0
|
172
172
|
version: "0"
|