Ruby: Cancel Delivery Of A Letter with CancelDelivery()
The following code will cancel the delivery of a letter - when possible:
- Replace MyUsername and MyPassword with your PostalMethods user details.
- Replace LetterID with the unique ID returned when sending this letter.
- Execute this code. If the returned ResultCode equals -3000, the letter delivery has be canceled.
If the returned ResultCode is different than -3000, the request was unsuccessful. Check the Web Service Status Codes section.
#!/usr/bin/env ruby require 'rubygems' require 'postalmethods' options = {:username => 'MyUsername', :password => 'MyPassword'} client = PostalMethods::Client.new(options) client.prepare! statuses = client.cancel_delivery(LetterID)
