Class: AkamaiApi::ECCU::BaseEditRequest Abstract
- Inherits:
-
BaseRequest
- Object
- BaseRequest
- AkamaiApi::ECCU::BaseEditRequest
- Defined in:
- lib/akamai_api/eccu/base_edit_request.rb
Overview
This class is abstract.
This class is intended as a generic superclass for all requests that operate on an existing purge request submitted through the Akamai ECCU interface.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ String
readonly
ECCU Request code.
Instance Method Summary collapse
-
#initialize(code) ⇒ BaseEditRequest
constructor
A new instance of BaseEditRequest.
-
#request_body(*args, &block) ⇒ SoapBody
protected
Creates the request body filling it with all necessary arguments.
-
#with_soap_error_handling(&block) ⇒ Object
protected
Wrapper method that you can use inside your custom ECCU request to handle common errors.
Methods inherited from BaseRequest
Constructor Details
#initialize(code) ⇒ BaseEditRequest
Returns a new instance of BaseEditRequest.
16 17 18 |
# File 'lib/akamai_api/eccu/base_edit_request.rb', line 16 def initialize code @code = code.to_i end |
Instance Attribute Details
#code ⇒ String (readonly)
ECCU Request code
13 14 15 |
# File 'lib/akamai_api/eccu/base_edit_request.rb', line 13 def code @code end |
Instance Method Details
#request_body(*args, &block) ⇒ SoapBody (protected)
Creates the request body filling it with all necessary arguments
The base implementation fills only the request code. If the request needs additional arguments you’ll want to overwrite it like the following:
class MyCustomRequest < AkamaiApi::ECCU::BaseEditRequest
def request_body code, name, surname
super code do |block|
block.string(:name, name).string(:surname, surname)
end
end
end
34 35 36 37 38 39 |
# File 'lib/akamai_api/eccu/base_edit_request.rb', line 34 def request_body *args, &block SoapBody.new.tap do |block| block.integer :fileId, code yield block if block_given? end end |
#with_soap_error_handling(&block) ⇒ Object (protected)
Wrapper method that you can use inside your custom ECCU request to handle common errors
44 45 46 47 48 49 |
# File 'lib/akamai_api/eccu/base_edit_request.rb', line 44 def with_soap_error_handling &block super rescue Savon::SOAPFault => e e = ::AkamaiApi::ECCU::NotFound if e.to_hash[:fault][:faultstring] =~ /fileId .* does not exist/ raise e end |