Class: Fedex::Request::PickupAvailability
- Defined in:
- lib/fedex/request/pickup_availability.rb
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 = {}) ⇒ PickupAvailability
constructor
A new instance of PickupAvailability.
- #process_request ⇒ Object
Constructor Details
#initialize(credentials, options = {}) ⇒ PickupAvailability
Returns a new instance of PickupAvailability.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fedex/request/pickup_availability.rb', line 7 def initialize(credentials, ={}) requires!(, :country_code, :request_type, :carrier_code) @debug = ENV['DEBUG'] == 'true' @credentials = credentials @country_code = [:country_code] @postal_code = [:postal_code] if [:postal_code] @state_code = [:state_code] if [:state_code] @request_type = [:request_type] @carrier_code = [:carrier_code] @dispatch_date = [:dispatch_date] if [:dispatch_date] end |
Instance Method Details
#process_request ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fedex/request/pickup_availability.rb', line 21 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) success_response(api_response, response) else failure_response(api_response, response) end end |