Permalink
Browse files

Update delivery/sginature confirmation for new API

  • Loading branch information...
1 parent 10d424f commit 39dc8352d21e6c5199b9b03ce71fef17196221c9 @rdeshpande rdeshpande committed Jun 22, 2010
Showing with 7 additions and 6 deletions.
  1. +2 −1 init.rb
  2. +5 −5 lib/foto_verite/usps/delivery_and_signature_confirmation.rb
View
@@ -1,4 +1,5 @@
require 'nokogiri'
+require 'hpricot'
require 'net/https'
-require File.join(File.dirname(__FILE__), 'lib', 'awesome_usps')
+require File.join(File.dirname(__FILE__), 'lib', 'awesome_usps')
@@ -17,8 +17,8 @@ def signature_confirmation_label(origin, destination, service_type, image_type,
def canned_delivery_confirmation_label_test
- origin = Location.new( :name=> "John Smith", :address2 => "6406 Ivy Lane", :state => 'MD', :city => 'Greenbelt', :zip5 => '20770')
- destination =Location.new( :name=> "Joe Customer", :address2 =>"136 Linwood Plz", :state => 'NJ', :city => 'Fort Lee', :zip5 => "07024")
+ origin = Location.new(:first_name=> 'John', :last_name => "Smith", :address2 => "6406 Ivy Lane", :state => 'MD', :city => 'Greenbelt', :zip5 => '20770')
+ destination =Location.new(:first_name => "John", :last_name => "Customer", :address2 =>"136 Linwood Plz", :state => 'NJ', :city => 'Fort Lee', :zip5 => "07024")
service_type = "Priority"
image_type ="PDF"
label_type = 1
@@ -46,15 +46,15 @@ def confirmation_xml(api_request, origin, destination, service_type, image_type,
xm.tag!(api_request, "USERID"=>"#{@username}") do
xm.Option(label_type)
xm.ImageParameters #Will be used in the future. Is a required tag.
- xm.FromName(origin.name)
+ xm.FromName(origin.full_name)
xm.FromFirm(origin.firm_name)
xm.FromAddress1(origin.address1) #Used for an apartment or suite number. Yes the API is a bit fucked.
xm.FromAddress2(origin.address2)
xm.FromCity(origin.city)
xm.FromState(origin.state)
xm.FromZip5(origin.zip5)
xm.FromZip4(origin.zip4)
- xm.ToName(destination.name)
+ xm.ToName(destination.full_name)
xm.ToFirm(destination.firm_name)
xm.ToAddress1(destination.address1)
xm.ToAddress2(destination.address2)
@@ -100,4 +100,4 @@ def parse_confirmation_label(action, xml, image_type)
end # DeliveryAndSignatureConfirmation
end # USPS
-end # FotoVerite
+end # FotoVerite

0 comments on commit 39dc835

Please sign in to comment.