Permalink
Browse files

updated the Fedex::WebServices::Service::Rate.get_rates interface to …

…take an Address rather than a Prty for the from / to details
  • Loading branch information...
1 parent bb9bc7a commit c80e7e4af1353e687a57eff579759f626fb3999d @brewski committed Apr 18, 2012
Showing with 15 additions and 10 deletions.
  1. +1 −1 lib/fedex/version.rb
  2. +11 −6 lib/fedex/web_services/request/get_rates.rb
  3. +3 −3 lib/fedex/web_services/service/rate.rb
View
2 lib/fedex/version.rb
@@ -1,3 +1,3 @@
module Fedex
- VERSION = "1.0.42"
+ VERSION = "1.1.42"
end
View
17 lib/fedex/web_services/request/get_rates.rb
@@ -2,13 +2,13 @@ module Fedex::WebServices
module Request
class GetRates < Base
- def initialize(service, service_type, rate_request_type, shipper, recipient, weight)
+ def initialize(service, service_type, rate_request_type, from_address, to_address, weight)
super(service)
@service_type = service_type
- @shipper = shipper
- @recipient = recipient
+ @from_address = from_address
+ @to_address = to_address
@rate_request_type = rate_request_type
@requested_package_line_items = [
RequestedPackageLineItem.new.tap do |o|
@@ -31,11 +31,16 @@ def contents
o.requestedShipment = RequestedShipment.new.tap do |o|
o.shipTimestamp = Time.now.iso8601
- o.serviceType = @service_type
+ o.serviceType = @service_type
o.packagingType = PackagingType::YOUR_PACKAGING
- o.shipper = @shipper
- o.recipient = @recipient
+ o.shipper = Party.new.tap do |o|
+ o.address = @from_address
+ end
+
+ o.recipient = Party.new.tap do |o|
+ o.address = @to_address
+ end
o.shippingChargesPayment = Payment.new.tap do |o|
o.paymentType = PaymentType::SENDER
View
6 lib/fedex/web_services/service/rate.rb
@@ -4,12 +4,12 @@ module Fedex::WebServices
module Service
class Rate < Base
- def get_rates(service_type, rate_request_type, shipper, recipient, weight, &process_contents)
+ def get_rates(service_type, rate_request_type, from, to, weight, &process_contents)
request = GetRates.new(self,
service_type,
rate_request_type,
- shipper,
- recipient,
+ from,
+ to,
weight
)

0 comments on commit c80e7e4

Please sign in to comment.