Sha256: 0f589107a6f1b23f66c89a232a16370c41fdb7d57c70c6ebf6b96a830c4c9039

Contents?: true

Size: 1.1 KB

Versions: 45

Compression:

Stored size: 1.1 KB

Contents

module Fog
  module AzureRM
    # class for Async Response
    class AsyncResponse
      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

      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

      def state
        @promise.state
      end

      def reason
        @promise.reason
      end

      def pending?
        @promise.pending?
      end

      def fulfilled?
        @promise.fulfilled?
      end

      def rejected?
        @promise.rejected?
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 4 rubygems

Version Path
gitlab-fog-azure-rm-2.2.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-2.1.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-2.0.1 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-2.0.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.9.1 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.9.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.8.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.7.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.6.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.5.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.4.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.3.0 lib/fog/azurerm/async_response.rb
fog-azure-rm-0.6.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.2.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.1.1 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.0.1 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-1.0.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-0.9.0 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-0.8.1 lib/fog/azurerm/async_response.rb
gitlab-fog-azure-rm-0.8.0 lib/fog/azurerm/async_response.rb