Sha256: 420b7e3672454091a08a70175d1f0a78ac4ce9bb153dea9819faec3cf0e0e7ed

Contents?: true

Size: 718 Bytes

Versions: 4

Compression:

Stored size: 718 Bytes

Contents

module Fog
  module Compute
    class HuaweiCloud
      class Real
        def get_image_details(image_id)
          request(
            :expects => [200, 203],
            :method  => 'GET',
            :path    => "images/#{image_id}"
          )
        end
      end

      class Mock
        def get_image_details(image_id)
          response = Excon::Response.new
          image = list_images_detail.body['images'].find { |im| im['id'] == image_id }
          if image
            response.status = [200, 203][rand(2)]
            response.body = {'image' => image}
            response
          else
            raise Fog::Compute::HuaweiCloud::NotFound
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/compute/huaweicloud/requests/get_image_details.rb
fog-huaweicloud-0.0.2 lib/fog/compute/huaweicloud/requests/get_image_details.rb
fog-huaweicloud-0.1.3 lib/fog/compute/huaweicloud/requests/get_image_details.rb
fog-huaweicloud-0.1.2 lib/fog/compute/huaweicloud/requests/get_image_details.rb