Method: Fedex::Request::Rate#process_request
- Defined in:
- lib/fedex/request/rate.rb
#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 |