Class: Fedex::Request::Address
- Defined in:
- lib/fedex/request/address.rb
Constant Summary
Constants inherited from Base
Base::CLEARANCE_BROKERAGE_TYPE, Base::DROP_OFF_TYPES, Base::PACKAGING_TYPES, 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 = {}) ⇒ Address
constructor
A new instance of Address.
- #process_request ⇒ Object
Constructor Details
#initialize(credentials, options = {}) ⇒ Address
Returns a new instance of Address.
8 9 10 11 12 |
# File 'lib/fedex/request/address.rb', line 8 def initialize(credentials, ={}) requires!(, :address) @credentials = credentials @address = [:address] end |
Instance Method Details
#process_request ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fedex/request/address.rb', line 14 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) = response[:address_validation_reply][:address_results][:proposed_address_details] Fedex::Address.new() else = if response[:address_validation_reply] [response[:address_validation_reply][:notifications]].flatten.first[:message] else api_response["Fault"]["detail"]["fault"]["reason"] end rescue $1 raise RateError, end end |