Ruby: Get The Status Of Multiple Letters with GetLetterStatusRange()

The following code will retrieve status information regarding a range of letters in your queue:

  1. Replace MyUsername and MyPassword with your PostalMethods user details.
  2. Replace MinLetterID and MaxLetterID with the unique IDs returned when sending the first and last letters of the range.
  3. Execute this code. If the returned ResultCode equals -3000, this call will return an array of statuses (as defined here). The response is similar to the response received for a single letter status but structured as a SOAP response object.
    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.get_letter_status_range(MinLetterID, MaxLetterID)