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

- old
+ new

@@ -1,17 +1,20 @@ module PostalMethods module SendLetter - def send_letter(doc, description) + def send_letter(doc, description, work_mode = "") raise PostalMethods::NoPreparationException unless self.prepared ## push a letter over the api + + + self.document = doc - rv = @rpc_driver.sendLetter(:Username => self.username, :Password => self.password, :FileExtension => self.document[:extension], - :FileBinaryData => self.document[:bytes], :MyDescription => description) + rv = @rpc_driver.sendLetterV2(:Username => self.username, :Password => self.password, :FileExtension => self.document[:extension], + :FileBinaryData => self.document[:bytes], :MyDescription => description, :WorkMode => self.work_mode) - status_code = rv.sendLetterResult.to_i + status_code = rv.sendLetterV2Result.to_i if status_code > 0 return status_code elsif API_STATUS_CODES.has_key?(status_code) instance_eval("raise APIStatusCode#{status_code.to_s.gsub(/( |\-)/,'')}Exception") @@ -24,16 +27,16 @@ ## setup the document self.document = doc opts = {:Username => self.username, :Password => self.password, :FileExtension => self.document[:extension], - :FileBinaryData => self.document[:bytes], :MyDescription => description} + :FileBinaryData => self.document[:bytes], :MyDescription => description, :WorkMode => self.work_mode} opts.merge!(address) ## push a letter over the api - rv = @rpc_driver.sendLetterAndAddress(opts) - status_code = rv.sendLetterAndAddressResult.to_i + rv = @rpc_driver.sendLetterAndAddressV2(opts) + status_code = rv.sendLetterAndAddressV2Result.to_i if status_code > 0 return status_code elsif API_STATUS_CODES.has_key?(status_code) instance_eval("raise APIStatusCode#{status_code.to_s.gsub(/( |\-)/,'')}Exception") \ No newline at end of file