substancelab/rconomic

cashbooks.all.last not loading properties correctly

Closed this issue · 6 comments

Failing test case:

economic = Economic::Session.new(<account>, <login>, <password>)
economic.connect

cb1 = economic.cash_books.all.last
cb2 = economic.cash_books.find({:number => cb1.number})

assert cb1.handle[:number] == cb2.handle[:number]    # FAILS, cb1.handle[:number] is nil

I'm not sure how to run the gem's tests againsts a live economic account, but if you could guide me (just call me on skype) i would be happy to supply test + solution as a pull request.

You cannot - and do not want to - run the tests against a live e-conomic account. You should however be able to reproduce the bug using Savon fixtures. See cash_book_proxy_spec.rb:31-33 for examples of how to set up expectations/stubs with data.

Nice work :-)

Could you try out the newest master (9c1fe93) and see if that fixes things for you. It does remove items from proxies in favor of Array-like methods directly on the proxies.

Just tried, but I get an error earlier in the process.

economic = Economic::Session.new(<account>, <login>, <password>)
economic.connect

brings up the following error:

SOAP request: https://www.e-conomic.com/secure/api1/EconomicWebService.asmx
Cookie: , SOAPAction: "http://e-conomic.com/Connect", Content-Type: text/xml;charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:economic="http://e-conomic.com" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><economic:Connect><economic:agreementNumber>xxxx</economic:agreementNumber><economic:userName>xxx</economic:userName><economic:password>xxxx</economic:password></economic:Connect></env:Body></env:Envelope>
HTTPI executes HTTP POST using the net_http adapter
/home/carsten/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/net/http.rb:1435:in `block in initialize_http_header': undefined method `strip' for nil:NilClass (NoMethodError)

I have not had any problem using ruby 1.9.3 before, so the error cannot be related to that.

Seems like a different issue, so please open a new issue if that problem persists. I should've fixed it in master, though.

Yup the http error is gone - and master branch also works with my testcase in the top of this thread.

So alles in ordnung :-)