Sha256: f8e44ef372871676b9aa408eccd62011d2e1c4910332fb2e7d84601bff64ef2f

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

module Fog
  module Compute
    class OneAndOne

      class Real

        ##
        # Returns information about an image
        # URL: [https://cloudpanel-api.1and1.com/documentation/1and1/v1/en/documentation.html#images__image_id__get]
        ##
        def get_image(image_id)
          
          params = {
            'method' => :get,
            'endpoint' => "/images/#{image_id}"
          }

          request(params)

        end

      end # Real

      
      class Mock

        def get_image(image_id)
          
          # Search for image to return
          if image = self.data[:images].find {
            |hash| hash['id'] == image_id
          }
          else
            raise Fog::Errors::NotFound.new('The requested resource could
              not be found.')
          end

          # Return Response Object to User
          response = Excon::Response.new
          response.status = 200
          response.body = image
          response

        end

      end # Mock

    end # OneAndOne
  end # Compute
end # Fog

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-oneandone-1.2 lib/oneandone/requests/compute/get_image.rb
fog-oneandone-1.0 lib/oneandone/requests/compute/get_image.rb