Class: Fog::AzureRM::AsyncResponse
- Inherits:
-
Object
- Object
- Fog::AzureRM::AsyncResponse
- Defined in:
- lib/fog/azurerm/async_response.rb
Overview
class for Async Response
Instance Method Summary collapse
- #fulfilled? ⇒ Boolean
-
#initialize(model, promise, delete_extra_resource = false, post_method_execute = nil) ⇒ AsyncResponse
constructor
A new instance of AsyncResponse.
- #pending? ⇒ Boolean
- #reason ⇒ Object
- #rejected? ⇒ Boolean
- #state ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(model, promise, delete_extra_resource = false, post_method_execute = nil) ⇒ AsyncResponse
Returns a new instance of AsyncResponse.
5 6 7 8 9 10 |
# File 'lib/fog/azurerm/async_response.rb', line 5 def initialize(model, promise, delete_extra_resource = false, post_method_execute = nil) @fog_model = model @promise = promise @delete_extra_resource = delete_extra_resource @post_method_execute = post_method_execute end |
Instance Method Details
#fulfilled? ⇒ Boolean
35 36 37 |
# File 'lib/fog/azurerm/async_response.rb', line 35 def fulfilled? @promise.fulfilled? end |
#pending? ⇒ Boolean
31 32 33 |
# File 'lib/fog/azurerm/async_response.rb', line 31 def pending? @promise.pending? end |
#reason ⇒ Object
27 28 29 |
# File 'lib/fog/azurerm/async_response.rb', line 27 def reason @promise.reason end |
#rejected? ⇒ Boolean
39 40 41 |
# File 'lib/fog/azurerm/async_response.rb', line 39 def rejected? @promise.rejected? end |
#state ⇒ Object
23 24 25 |
# File 'lib/fog/azurerm/async_response.rb', line 23 def state @promise.state end |
#value ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fog/azurerm/async_response.rb', line 12 def value response = @promise.value.body @fog_model.merge_attributes(@fog_model.class.parse(response)) @fog_model.delete_extra_resources if @delete_extra_resource # This code block will execute the method mentioned in post_method_execute after getting the response unless @post_method_execute.nil? @fog_model.public_send(@post_method_execute) if @fog_model.respond_to? @post_method_execute end @fog_model end |