Class: AkamaiApi::CLI::CCU::PurgeRenderer
- Inherits:
-
Object
- Object
- AkamaiApi::CLI::CCU::PurgeRenderer
- Defined in:
- lib/akamai_api/cli/ccu/purge_renderer.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(response) ⇒ PurgeRenderer
constructor
A new instance of PurgeRenderer.
- #render ⇒ Object
- #render_error_response ⇒ Object
- #render_response ⇒ Object
- #render_successful_response ⇒ Object
Constructor Details
#initialize(response) ⇒ PurgeRenderer
Returns a new instance of PurgeRenderer.
5 6 7 |
# File 'lib/akamai_api/cli/ccu/purge_renderer.rb', line 5 def initialize response @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/akamai_api/cli/ccu/purge_renderer.rb', line 3 def response @response end |
Instance Method Details
#render ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/akamai_api/cli/ccu/purge_renderer.rb', line 9 def render [ "----------", render_response, "----------" ].join "\n" end |
#render_error_response ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/akamai_api/cli/ccu/purge_renderer.rb', line 25 def render_error_response [ "There was an error processing your request:", "\t* Result: #{response.code} - #{response.title} (#{response.})", "\t* Described by: #{response.described_by}" ] end |
#render_response ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/akamai_api/cli/ccu/purge_renderer.rb', line 17 def render_response if response.code == 201 render_successful_response else render_error_response end end |
#render_successful_response ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/akamai_api/cli/ccu/purge_renderer.rb', line 33 def render_successful_response result = [ "Purge request successfully submitted:", "\t* Result: #{response.code} - #{response.}", "\t* Purge ID: #{response.purge_id} | Support ID: #{response.support_id}", "\t* Estimated time: #{response.estimated_time} secs.", "\t* Progress URI: #{response.uri}", "\t* Time to wait before check: #{response.time_to_wait} secs." ] result end |