def build_world_rate_request(origin, packages, destination, options)
      country = COUNTRY_NAME_CONVERSIONS[destination.country.code(:alpha2).value] || destination.country.name
      xml_builder = Nokogiri::XML::Builder.new do |xml|
        xml.IntlRateV2Request('USERID' => @options[:login]) do
          xml.Revision(2)
          Array(packages).each_with_index do |package, id|
            xml.Package('ID' => id) do
              xml.Pounds(0)
              xml.Ounces([package.ounces, 1].max.ceil) # takes an integer for some reason, must be rounded UP
              xml.MailType(MAIL_TYPES[package.options[:mail_type]] || 'Package')
              xml.GXG do
                xml.POBoxFlag(destination.po_box? ? 'Y' : 'N')
                xml.GiftFlag(package.gift? ? 'Y' : 'N')
              end

              value = if package.value && package.value > 0 && package.currency && package.currency != 'USD'
                0.0
              else
                (package.value || 0) / 100.0
              end
              xml.ValueOfContents(value)

              xml.Country(country)
              xml.Container(package.cylinder? ? 'NONRECTANGULAR' : 'RECTANGULAR')
              xml.Size(USPS.size_code_for(package))
              xml.Width("%0.2f" % [package.inches(:width), 0.01].max)
              xml.Length("%0.2f" % [package.inches(:length), 0.01].max)
              xml.Height("%0.2f" % [package.inches(:height), 0.01].max)
              xml.Girth("%0.2f" % [package.inches(:girth), 0.01].max)
              xml.OriginZip(strip_zip(origin.zip))
              if commercial_type = commercial_type(options)
                xml.public_send(COMMERCIAL_FLAG_NAME.fetch(commercial_type), 'Y')
              end
              if destination.zip.present?
                xml.AcceptanceDateTime((options[:acceptance_time] || Time.now.utc).iso8601)
                xml.DestinationPostalCode(destination.zip)
              end
            end
          end
        end
      end
      save_request(xml_builder.to_xml)
    end
def build_world_rate_request(origin, packages, destination, options)
      country = COUNTRY_NAME_CONVERSIONS[destination.country.code(:alpha2).value] || destination.country.name
      xml_builder = Nokogiri::XML::Builder.new do |xml|
        xml.IntlRateV2Request('USERID' => @options[:login]) do
          xml.Revision(2)
          Array(packages).each_with_index do |package, id|
            xml.Package('ID' => id) do
              xml.Pounds(0)
              xml.Ounces([package.ounces, 1].max.ceil) # takes an integer for some reason, must be rounded UP
              xml.MailType(MAIL_TYPES[package.options[:mail_type]] || 'Package')
              xml.GXG do
                xml.POBoxFlag(destination.po_box? ? 'Y' : 'N')
                xml.GiftFlag(package.gift? ? 'Y' : 'N')
              end

              value = if package.value && package.value > 0 && package.currency && package.currency != 'USD'
                0.0
              else
                (package.value || 0) / 100.0
              end
              xml.ValueOfContents(value)

              xml.Country(country)
              xml.Container(package.cylinder? ? 'NONRECTANGULAR' : 'RECTANGULAR')
              xml.Size(USPS.size_code_for(package))
              xml.Width("%0.2f" % [package.inches(:width), 0.01].max)
              xml.Length("%0.2f" % [package.inches(:length), 0.01].max)
              xml.Height("%0.2f" % [package.inches(:height), 0.01].max)
              xml.Girth("%0.2f" % [package.inches(:girth), 0.01].max)
              xml.OriginZip(strip_zip(origin.zip))
              if commercial_type = commercial_type(options)
                xml.public_send(COMMERCIAL_FLAG_NAME.fetch(commercial_type), 'Y')
              end
              if destination.zip.present?
                xml.AcceptanceDateTime((options[:acceptance_time] || Time.now.utc).iso8601)
                xml.DestinationPostalCode(destination.zip)
              end
            end
          end
        end
      end
      save_request(xml_builder.to_xml)
    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.