lib/fedex/request/rate.rb in fedex-3.6.1 vs lib/fedex/request/rate.rb in fedex-3.8.0
- old
+ new
@@ -13,10 +13,11 @@
rate_reply_details = [rate_reply_details] if rate_reply_details.is_a?(Hash)
rate_reply_details.map do |rate_reply|
rate_details = [rate_reply[:rated_shipment_details]].flatten.first[:shipment_rate_detail]
rate_details.merge!(service_type: rate_reply[:service_type])
+ rate_details.merge!(transit_time: rate_reply[:transit_time])
Fedex::Rate.new(rate_details)
end
else
error_message = if response[:rate_reply]
[response[:rate_reply][:notifications]].flatten.first[:message]
@@ -42,17 +43,23 @@
xml.RateRequestTypes "ACCOUNT"
add_packages(xml)
}
end
+ # Add transite time options
+ def add_transit_time(xml)
+ xml.ReturnTransitAndCommit true
+ end
+
# Build xml Fedex Web Service request
def build_xml
ns = "http://fedex.com/ws/rate/v#{service[:version]}"
builder = Nokogiri::XML::Builder.new do |xml|
xml.RateRequest(:xmlns => ns){
add_web_authentication_detail(xml)
add_client_detail(xml)
add_version(xml)
+ add_transit_time(xml)
add_requested_shipment(xml)
}
end
builder.doc.root.to_xml
end