.parse(response) ⇒ string

Clockwork:HTTPError - if a connection to the Clockwork API cannot be made

Clockwork::Error::Generic - if the API returns an error code other than 2

Clockwork::Error::Authentication - if API login details are incorrect

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

# File 'lib/clockwork/xml/balance.rb', line 31defself.parseresponseifresponse.code.to_i==200doc=Nokogiri.parse(response.body)ifdoc.css('ErrDesc').empty?hsh={}hsh[:account_type]=doc.css('Balance_Resp').css('AccountType').inner_htmlhsh[:balance]=doc.css('Balance_Resp').css('Balance').inner_html.to_fhsh[:currency]={:code=>doc.css('Balance_Resp').css('Currency').css('Code').inner_html,:symbol=>doc.css('Balance_Resp').css('Currency').css('Symbol').inner_html}hshelsifdoc.css('ErrNo').inner_html.to_i==2raiseClockwork::Error::Authentication,doc.css('ErrDesc').inner_htmlelseraiseClockwork::Error::Generic,doc.css('ErrDesc').inner_htmlendelseraiseClockwork::Error::HTTP,"Could not connect to the Clockwork API to check balance."endend