Method: Fedex::Request::TrackingInformation#process_request

Defined in:
lib/fedex/request/tracking_information.rb

#process_requestObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fedex/request/tracking_information.rb', line 27

def process_request
  api_response = self.class.post(api_url, :body => build_xml)
  puts api_response if @debug == true
  response = parse_response(api_response)

  if success?(response)
    options = response[:track_reply][:track_details]

    Fedex::TrackingInformation.new(options)
  else
    error_message = if response[:track_reply]
      response[:track_reply][:notifications][:message]
    else
      api_response["Fault"]["detail"]["fault"]["reason"]
    end rescue $1
    raise RateError, error_message
  end
end