Class: Fedex::Request::Rate
Constant Summary
Constants inherited from Base
Base::CLEARANCE_BROKERAGE_TYPE, Base::DROP_OFF_TYPES, Base::PACKAGING_TYPES, Base::PRODUCTION_URL, Base::RECIPIENT_CUSTOM_ID_TYPE, Base::SERVICE_TYPES, Base::TEST_URL
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#process_request ⇒ Object
Sends post request to Fedex web service and parse the response, a Rate object is created if the response is successful.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Fedex::Request::Base
Instance Method Details
#process_request ⇒ Object
Sends post request to Fedex web service and parse the response, a Rate object is created if the response is successful
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fedex/request/rate.rb', line 7 def process_request api_response = self.class.post(api_url, :body => build_xml) puts api_response if @debug response = parse_response(api_response) if success?(response) rate_details = [response[:rate_reply][:rate_reply_details][:rated_shipment_details]].flatten.first[:shipment_rate_detail] Fedex::Rate.new(rate_details) else = if response[:rate_reply] [response[:rate_reply][:notifications]].flatten.first[:message] else api_response["Fault"]["detail"]["fault"]["reason"] end rescue $1 raise RateError, end end |