Skip to content

Commit

Permalink
base64Binary simple type added (fixes #123)
Browse files Browse the repository at this point in the history
  • Loading branch information
inossidabile committed Oct 28, 2013
1 parent 0083369 commit 45e2da2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/wash_out/param.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ def load(data, key)
end
else
operation = case type
when 'string'; :to_s
when 'integer'; :to_i
when 'double'; :to_f
when 'boolean'; lambda{|dat| dat === "0" ? false : !!dat}
when 'date'; :to_date
when 'datetime'; :to_datetime
when 'time'; :to_time
when 'string'; :to_s
when 'integer'; :to_i
when 'double'; :to_f
when 'boolean'; lambda{|dat| dat === "0" ? false : !!dat}
when 'date'; :to_date
when 'datetime'; :to_datetime
when 'time'; :to_time
when 'base64Binary'; lambda{|dat| Base64.decode64(dat)}
else raise RuntimeError, "Invalid WashOut simple type: #{type}"
end

Expand Down
13 changes: 13 additions & 0 deletions spec/lib/wash_out_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,19 @@ def date
savon(:date, :value => '2000-12-30')
lambda { savon(:date) }.should_not raise_exception
end

it "recognize base64Binary" do
mock_controller do
soap_action "base64", :args => :base64Binary, :return => :nil
def base64
params[:value].should == 'test' unless params[:value].blank?
render :soap => nil
end
end

savon(:base64, :value => Base64.encode64('test'))
lambda { savon(:base64) }.should_not raise_exception
end
end

context "errors" do
Expand Down

0 comments on commit 45e2da2

Please sign in to comment.