def build_world_rate_request(packages, destination)
      country = COUNTRY_NAME_CONVERSIONS[destination.country.code(:alpha2).value] || destination.country.name
      request = XmlNode.new('IntlRateV2Request', :USERID => @options[:login]) do |rate_request|
        packages.each_index do |id|
          p = packages[id]
          rate_request << XmlNode.new('Package', :ID => id.to_s) do |package|
            package << XmlNode.new('Pounds', 0)
            package << XmlNode.new('Ounces', [p.ounces,1].max.ceil) #takes an integer for some reason, must be rounded UP
            package << XmlNode.new('MailType', MAIL_TYPES[p.options[:mail_type]] || 'Package')
            package << XmlNode.new('GXG') do |gxg|
              gxg << XmlNode.new('POBoxFlag', destination.po_box? ? 'Y' : 'N')
              gxg << XmlNode.new('GiftFlag', p.gift? ? 'Y' : 'N')
            end
            value = if p.value && p.value > 0 && p.currency && p.currency != 'USD'
              0.0
            else
              (p.value || 0) / 100.0
            end
            package << XmlNode.new('ValueOfContents', value)
            package << XmlNode.new('Country') do |node|
              node.cdata = country
            end
            package << XmlNode.new('Container', p.cylinder? ? 'NONRECTANGULAR' : 'RECTANGULAR')
            package << XmlNode.new('Size', USPS.size_code_for(p))
            package << XmlNode.new('Width', "%0.2f" % [p.inches(:width), 0.01].max)
            package << XmlNode.new('Length', "%0.2f" % [p.inches(:length), 0.01].max)
            package << XmlNode.new('Height', "%0.2f" % [p.inches(:height), 0.01].max)
            package << XmlNode.new('Girth', "%0.2f" % [p.inches(:girth), 0.01].max)
          end
        end
      end
      URI.encode(save_request(request.to_s))
    end
def build_world_rate_request(packages, destination)
      country = COUNTRY_NAME_CONVERSIONS[destination.country.code(:alpha2).value] || destination.country.name
      request = XmlNode.new('IntlRateV2Request', :USERID => @options[:login]) do |rate_request|
        packages.each_index do |id|
          p = packages[id]
          rate_request << XmlNode.new('Package', :ID => id.to_s) do |package|
            package << XmlNode.new('Pounds', 0)
            package << XmlNode.new('Ounces', [p.ounces,1].max.ceil) #takes an integer for some reason, must be rounded UP
            package << XmlNode.new('MailType', MAIL_TYPES[p.options[:mail_type]] || 'Package')
            package << XmlNode.new('GXG') do |gxg|
              gxg << XmlNode.new('POBoxFlag', destination.po_box? ? 'Y' : 'N')
              gxg << XmlNode.new('GiftFlag', p.gift? ? 'Y' : 'N')
            end
            value = if p.value && p.value > 0 && p.currency && p.currency != 'USD'
              0.0
            else
              (p.value || 0) / 100.0
            end
            package << XmlNode.new('ValueOfContents', value)
            package << XmlNode.new('Country') do |node|
              node.cdata = country
            end
            package << XmlNode.new('Container', p.cylinder? ? 'NONRECTANGULAR' : 'RECTANGULAR')
            package << XmlNode.new('Size', USPS.size_code_for(p))
            package << XmlNode.new('Width', "%0.2f" % [p.inches(:width), 0.01].max)
            package << XmlNode.new('Length', "%0.2f" % [p.inches(:length), 0.01].max)
            package << XmlNode.new('Height', "%0.2f" % [p.inches(:height), 0.01].max)
            package << XmlNode.new('Girth', "%0.2f" % [p.inches(:girth), 0.01].max)
          end
        end
      end
      URI.encode(save_request(request.to_s))
    end
important difference with international rate requests:
 * services are not given in the request
 * package sizes are not given in the request
 * services are returned in the response along with restrictions of size
 * the size restrictions are returned AS AN ENGLISH SENTENCE (!?)


 package.options[:mail_type] -- one of [:package, :postcard, :matter_for_the_blind, :envelope].
                                 Defaults to :package.