Sha256: 070ac0288556a58c8aab8d15971e2911350f04627e8b0b048a287617c63940e8

Contents?: true

Size: 1.78 KB

Versions: 14

Compression:

Stored size: 1.78 KB

Contents

module Fog
  module Image
    class OpenStack
      class V2
        class Real
          def update_image(id, json_patch)
            request(
                :headers => {'Content-Type' => 'application/openstack-images-v2.1-json-patch'},
                :expects => [200],
                :method => 'PATCH',
                :path => "images/#{id}",
                :body => Fog::JSON.encode(json_patch)
            )
          end
        end

        class Mock
          def update_image(attributes)
            response = Excon::Response.new
            response.status = 200
            image = self.images.last
            response.body = {
                'image' => {
                    'name' => attributes[:name] || image.name,
                    'size' => image.size,
                    'min_disk' => (attributes[:min_disk] || image.min_disk).to_i,
                    'disk_format' => attributes[:disk_format] || image.disk_format,
                    'created_at' => image.created_at,
                    'container_format' => attributes[:container_format] || image.container_format,
                    'deleted_at' => nil,
                    'updated_at' => Time.now.to_s,
                    'checksum' => image.checksum,
                    'id' => attributes[:id],
                    'deleted' => false,
                    'protected' => false,
                    'is_public' => attributes[:is_public] || image.is_public,
                    'status' => image.status,
                    'min_ram' => (attributes[:min_ram] || image.min_ram).to_i,
                    'owner' => attributes[:owner] || image.owner,
                    'properties' => attributes[:properties] || image.properties
                }
            }
            response
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/requests/image_v2/update_image.rb
fog-openstack-0.1.9 lib/fog/openstack/requests/image_v2/update_image.rb
fog-openstack-0.1.8 lib/fog/openstack/requests/image_v2/update_image.rb
fog-openstack-0.1.7 lib/fog/openstack/requests/image_v2/update_image.rb
fog-openstack-0.1.6 lib/fog/openstack/requests/image_v2/update_image.rb
fog-openstack-0.1.5 lib/fog/openstack/requests/image_v2/update_image.rb
fog-openstack-0.1.4 lib/fog/openstack/requests/image_v2/update_image.rb
fog-openstack-0.1.3 lib/fog/openstack/requests/image_v2/update_image.rb
fog-openstack-0.1.2 lib/fog/openstack/requests/image_v2/update_image.rb
fog-openstack-0.1.1 lib/fog/openstack/requests/image_v2/update_image.rb
fog-openstack-0.1.0 lib/fog/openstack/requests/image_v2/update_image.rb
fog-1.37.0 lib/fog/openstack/requests/image_v2/update_image.rb
fog-1.36.0 lib/fog/openstack/requests/image_v2/update_image.rb
fog-1.35.0 lib/fog/openstack/requests/image_v2/update_image.rb