Class: Fedex::Request::Delete
Constant Summary
Constants inherited from Base
Base::CARRIER_CODES, Base::CLEARANCE_BROKERAGE_TYPE, Base::DROP_OFF_TYPES, Base::PACKAGING_TYPES, Base::PAYMENT_TYPE, Base::PRODUCTION_URL, Base::RECIPIENT_CUSTOM_ID_TYPE, Base::SERVICE_TYPES, Base::TEST_URL
Instance Attribute Summary collapse
-
#tracking_number ⇒ Object
readonly
Returns the value of attribute tracking_number.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(credentials, options = {}) ⇒ Delete
constructor
A new instance of Delete.
- #process_request ⇒ Object
Constructor Details
#initialize(credentials, options = {}) ⇒ Delete
Returns a new instance of Delete.
9 10 11 12 13 14 15 |
# File 'lib/fedex/request/delete.rb', line 9 def initialize(credentials, ={}) requires!(, :tracking_number) @tracking_number = [:tracking_number] @deletion_control = [:deletion_control] || 'DELETE_ALL_PACKAGES' @credentials = credentials end |
Instance Attribute Details
#tracking_number ⇒ Object (readonly)
Returns the value of attribute tracking_number.
7 8 9 |
# File 'lib/fedex/request/delete.rb', line 7 def tracking_number @tracking_number end |
Instance Method Details
#process_request ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fedex/request/delete.rb', line 17 def process_request api_response = self.class.post(api_url, :body => build_xml) puts api_response if @debug == true response = parse_response(api_response) unless success?(response) = if response[:shipment_reply] [response[:shipment_reply][:notifications]].flatten.first[:message] else "#{api_response["Fault"]["detail"]["fault"]["reason"]}\n --#{api_response["Fault"]["detail"]["fault"]["details"]["ValidationFailureDetail"]["message"].join("\n--")}" end rescue $1 raise RateError, end end |