Skip to content

Commit 45e2da2

Browse files
committed
base64Binary simple type added (fixes #123)
1 parent 0083369 commit 45e2da2

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

lib/wash_out/param.rb

+8-7
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,14 @@ def load(data, key)
6161
end
6262
else
6363
operation = case type
64-
when 'string'; :to_s
65-
when 'integer'; :to_i
66-
when 'double'; :to_f
67-
when 'boolean'; lambda{|dat| dat === "0" ? false : !!dat}
68-
when 'date'; :to_date
69-
when 'datetime'; :to_datetime
70-
when 'time'; :to_time
64+
when 'string'; :to_s
65+
when 'integer'; :to_i
66+
when 'double'; :to_f
67+
when 'boolean'; lambda{|dat| dat === "0" ? false : !!dat}
68+
when 'date'; :to_date
69+
when 'datetime'; :to_datetime
70+
when 'time'; :to_time
71+
when 'base64Binary'; lambda{|dat| Base64.decode64(dat)}
7172
else raise RuntimeError, "Invalid WashOut simple type: #{type}"
7273
end
7374

spec/lib/wash_out_spec.rb

+13
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,19 @@ def date
451451
savon(:date, :value => '2000-12-30')
452452
lambda { savon(:date) }.should_not raise_exception
453453
end
454+
455+
it "recognize base64Binary" do
456+
mock_controller do
457+
soap_action "base64", :args => :base64Binary, :return => :nil
458+
def base64
459+
params[:value].should == 'test' unless params[:value].blank?
460+
render :soap => nil
461+
end
462+
end
463+
464+
savon(:base64, :value => Base64.encode64('test'))
465+
lambda { savon(:base64) }.should_not raise_exception
466+
end
454467
end
455468

456469
context "errors" do

0 commit comments

Comments
 (0)