Browse files

always include dimension elements, even if they're blank

  • Loading branch information...
1 parent 163e3d1 commit 3901dddef3a642a2b36e6ac66376cb0d26d48f43 Nicholas Yianilos committed Sep 13, 2012
Showing with 8 additions and 9 deletions.
  1. +5 −6 lib/usps/request/international_shipping_rates_lookup.rb
  2. +3 −3 spec/request/international_spec.rb
View
11 lib/usps/request/international_shipping_rates_lookup.rb
@@ -17,6 +17,7 @@ def initialize(*packages)
def build
super do |xml|
+ xml.Revision 2
@packages.each do |package|
xml.Package :ID => package.id do
xml.Pounds package.pounds
@@ -27,12 +28,10 @@ def build
xml.Country package.country
xml.Container package.container
xml.Size package.size
- if package.size == 'LARGE'
- xml.Width package.width
- xml.Length package.length
- xml.Height package.height
- xml.Girth 0
- end
+ xml.Width package.width
+ xml.Length package.length
+ xml.Height package.height
+ xml.Girth nil
xml.CommercialFlag 'N'
end
end
View
6 spec/request/international_spec.rb
@@ -5,14 +5,14 @@ module USPS::Request
USPS.username = '414REENH3307'
it "uses the RateV4 API settings" do
package = Package::InternationalPackage.new(
- :country => "Canada", :id => 3, :mail_type => 'Package', :pounds => 20, :ounces => 5, :container => 'RECTANGULAR', :size => 'LARGE',
- :width => 10, :height => 12, :length => 13
+ :country => "Romania", :id => 3, :mail_type => 'ALL', :pounds => 7, :ounces => 0, :container => 'RECTANGULAR', :size => 'LARGE',
+ :width => 12, :height => 13, :length => 12
)
lookup = InternationalShippingRatesLookup.new(package)
response = lookup.send!
response.packages.each do |package|
package.services.each do |service|
- puts "#{service.rate} - #{service.description}"
+ puts "#{service.id} - #{service.rate} - #{service.description}"
end
end
end

0 comments on commit 3901ddd

Please sign in to comment.