Class: Fedex::Request::Pickup
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
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(credentials, options = {}) ⇒ Pickup
constructor
A new instance of Pickup.
-
#process_request ⇒ Object
Sends post request to Fedex web service and parse the response, a Pickup object is created if the response is successful.
Constructor Details
#initialize(credentials, options = {}) ⇒ Pickup
Returns a new instance of Pickup.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fedex/request/pickup.rb', line 6 def initialize(credentials, ={}) requires!(, :packages, :ready_timestamp, :close_time, :carrier_code, :country_relationship) @debug = ENV['DEBUG'] == 'true' @credentials = credentials @packages = [:packages] @ready_timestamp = [:ready_timestamp] @close_time = [:close_time] @carrier_code = [:carrier_code] @remarks = [:remarks] if [:remarks] @pickup_location = [:pickup_location] @commodity_description = [:commodity_description] if [:commodity_description] @country_relationship = [:country_relationship] end |
Instance Method Details
#process_request ⇒ Object
Sends post request to Fedex web service and parse the response, a Pickup object is created if the response is successful
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fedex/request/pickup.rb', line 22 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) success_response(api_response, response) else failure_response(api_response, response) end end |