lib/postalmethods/send_letter.rb in postalmethods-1.0.0 vs lib/postalmethods/send_letter.rb in postalmethods-1.0.1

- old
+ new

@@ -10,17 +10,17 @@ :FileBinaryData => self.document[:bytes], :MyDescription => description) status_code = rv.sendLetterResult.to_i if status_code > 0 - return rv + return status_code elsif API_STATUS_CODES.has_key?(status_code) instance_eval("raise APIStatusCode#{status_code.to_s.gsub(/( |\-)/,'')}Exception") end end - def send_letter_and_address(doc, description, address) + def send_letter_with_address(doc, description, address) raise PostalMethods::NoPreparationException unless self.prepared raise PostalMethods::AddressNotHashException unless (address.class == Hash) ## setup the document self.document = doc @@ -33,10 +33,10 @@ ## push a letter over the api rv = @rpc_driver.sendLetterAndAddress(opts) status_code = rv.sendLetterAndAddressResult.to_i if status_code > 0 - return rv + return status_code elsif API_STATUS_CODES.has_key?(status_code) instance_eval("raise APIStatusCode#{status_code.to_s.gsub(/( |\-)/,'')}Exception") end end \ No newline at end of file