Class: AkamaiApi::ECCU::PublishRequest
- Inherits:
-
BaseRequest
- Object
- BaseRequest
- AkamaiApi::ECCU::PublishRequest
- Defined in:
- lib/akamai_api/eccu/publish_request.rb
Overview
PublishRequest is responsible of publishing a new ECCU request.
Instance Attribute Summary collapse
-
#property_exact_match ⇒ true, false
readonly
Digital property match type (true if exact).
-
#property_name ⇒ String
readonly
Digital property name.
-
#property_type ⇒ String
readonly
Digital property type.
Instance Method Summary collapse
-
#execute(content, args = {}) ⇒ Object
Publishes a new ECCU request.
-
#initialize(property_name, args = {}) ⇒ PublishRequest
constructor
A new instance of PublishRequest.
-
#request_body(content, args) ⇒ SoapBody
protected
Creates the request body filling it with all necessary arguments.
- #with_soap_error_handling(&block) ⇒ Object protected
Methods inherited from BaseRequest
Constructor Details
#initialize(property_name, args = {}) ⇒ PublishRequest
Returns a new instance of PublishRequest.
29 30 31 32 33 |
# File 'lib/akamai_api/eccu/publish_request.rb', line 29 def initialize property_name, args = {} @property_name = property_name @property_type = args.fetch(:type, 'hostheader') @property_exact_match = args.fetch(:exact_match, true) == true end |
Instance Attribute Details
#property_exact_match ⇒ true, false (readonly)
Returns Digital property match type (true if exact).
23 24 25 |
# File 'lib/akamai_api/eccu/publish_request.rb', line 23 def property_exact_match @property_exact_match end |
#property_name ⇒ String (readonly)
Returns Digital property name.
19 20 21 |
# File 'lib/akamai_api/eccu/publish_request.rb', line 19 def property_name @property_name end |
#property_type ⇒ String (readonly)
Returns Digital property type.
21 22 23 |
# File 'lib/akamai_api/eccu/publish_request.rb', line 21 def property_type @property_type end |
Instance Method Details
#execute(content, args = {}) ⇒ Object
Publishes a new ECCU request
42 43 44 45 46 47 |
# File 'lib/akamai_api/eccu/publish_request.rb', line 42 def execute content, args = {} with_soap_error_handling do response = client_call :upload, message_tag: 'upload', message: request_body(content, args).to_s response[:file_id].to_i end end |
#request_body(content, args) ⇒ SoapBody (protected)
Creates the request body filling it with all necessary arguments
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/akamai_api/eccu/publish_request.rb', line 53 def request_body content, args SoapBody.new.tap do |body| body.string :filename, args.fetch(:file_name, '') body.text :contents, content body.string :notes, args.fetch(:notes, "ECCU Request using AkamaiApi #{AkamaiApi::VERSION}") body.string :versionString, args.fetch(:version, '') if args[:emails] body.string :statusChangeEmail, Array.wrap(args[:emails]).join(',') end body.string :propertyName, property_name body.string :propertyType, property_type body.boolean :propertyNameExactMatch, property_exact_match end end |
#with_soap_error_handling(&block) ⇒ Object (protected)
68 69 70 71 72 73 |
# File 'lib/akamai_api/eccu/publish_request.rb', line 68 def with_soap_error_handling &block super rescue Savon::SOAPFault => e e = AkamaiApi::ECCU::InvalidDomain if e.to_hash[:fault][:faultstring].include? 'You are not authorized to specify this digital property' raise e end |