Class: Fedex::Request::GroundClose
- Defined in:
- lib/fedex/request/ground_close.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 collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#up_to_time ⇒ Object
readonly
Returns the value of attribute up_to_time.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(credentials, options = {}) ⇒ GroundClose
constructor
A new instance of GroundClose.
- #process_request ⇒ Object
Constructor Details
#initialize(credentials, options = {}) ⇒ GroundClose
Returns a new instance of GroundClose.
10 11 12 13 14 15 16 17 |
# File 'lib/fedex/request/ground_close.rb', line 10 def initialize(credentials, ={}) requires!(, :up_to_time) @credentials = credentials @up_to_time = [:up_to_time] @filename = [:filename] @debug = ENV['DEBUG'] == 'true' end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
8 9 10 |
# File 'lib/fedex/request/ground_close.rb', line 8 def filename @filename end |
#up_to_time ⇒ Object (readonly)
Returns the value of attribute up_to_time.
8 9 10 |
# File 'lib/fedex/request/ground_close.rb', line 8 def up_to_time @up_to_time end |
Instance Method Details
#process_request ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fedex/request/ground_close.rb', line 19 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(response) else = if response[:ground_close_reply] [response[:ground_close_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 |