Ruby: Cancel Delivery Of A Letter with CancelDelivery()

The following code will cancel the delivery of a letter - when possible:

  1. Replace MyUsername and MyPassword with your PostalMethods user details.
  2. Replace LetterID with the unique ID returned when sending this letter.
  3. 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)