Skip to content

Commit

Permalink
fix default value setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Arcath committed Sep 16, 2013
1 parent cf4508a commit 1e6331c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion lib/kashflow_api/api_call.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ def initialize(method, argument)
set_method(method)
build_xml(argument)
raise xml if @raise
#@result = make_call
return self
end

Expand Down
2 changes: 1 addition & 1 deletion lib/kashflow_api/soap_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def new_object_hash
hash = {}
self.class::Keys.each do |key|
key = [*key]
hash[key.first] = (key.last || "")
hash[key.first] = (key.last == key.first ? "" : key.last )
end
return hash
end
Expand Down
8 changes: 7 additions & 1 deletion spec/objects/inherited_methods_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe "Inherited Methods" do
class SampleClass < KashflowApi::SoapObject
Key = [ "Foo", "Bar" ]
Keys = [ "Foo", "Bar", ["Widget", "hello"] ]

Finds = [ "foo", "bar" ]

Expand All @@ -25,4 +25,10 @@ class SampleClass < KashflowApi::SoapObject
it "should find by bar" do
SampleClass.find_by_bar("search")
end

it "should set defaults in hash" do
instance = SampleClass.new
instance.foo.should eq ""
instance.widget.should eq "hello"
end
end

0 comments on commit 1e6331c

Please sign in to comment.