Sha256: 0da4ba39d8ed5746bd22f8b7911371f3699c9ebfe0427789413c6a5e269f45f3

Contents?: true

Size: 1.09 KB

Versions: 46

Compression:

Stored size: 1.09 KB

Contents

module Fog
  module Image
    class OpenStack
      class Real
        def update_image_members(image_id, members)
          # Sample members
          # [
          #   {'member_id' => 'tenant1', 'can_share' => true  },
          #   {'member_id' => 'tenant2', 'can_share' => false }
          # ]
          data = { 'memberships' => members }

          request(
            :body    => MultiJson.encode(data),
            :expects => [200, 202],
            :method  => 'PUT',
            :path    => "images/#{image_id}/members"
          )
        end
      end # class Real

      class Mock
        def update_image_members(image_id, members)
          response = Excon::Response.new
          response.status = [200, 202][rand(1)]
          response.body = {
            'members' => [
              { 'member_id'=>'ff528b20431645ebb5fa4b0a71ca002f', 'can_share' => false },
              { 'member_id'=>'ff528b20431645ebb5fa4b0a71ca002f', 'can_share' => true  }
            ]
          }
          response
        end
      end # class Mock
    end # class OpenStack
  end # module Identity
end # module Fog

Version data entries

46 entries across 46 versions & 10 rubygems

Version Path
cifrado-0.2.1 vendor/fog/lib/fog/openstack/requests/image/update_image_members.rb
cifrado-0.2.0 vendor/fog/lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/openstack/requests/image/update_image_members.rb
gapinc-fog-1.12.1.2.1 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/openstack/requests/image/update_image_members.rb
fog-1.18.0 lib/fog/openstack/requests/image/update_image_members.rb
fog-1.17.0 lib/fog/openstack/requests/image/update_image_members.rb
fog-1.16.0 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.15.0.20130927082724 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/openstack/requests/image/update_image_members.rb
fog-1.15.0 lib/fog/openstack/requests/image/update_image_members.rb
gapinc-fog-1.14.0 lib/fog/openstack/requests/image/update_image_members.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/openstack/requests/image/update_image_members.rb
fog-1.14.0 lib/fog/openstack/requests/image/update_image_members.rb
fog-1.13.0 lib/fog/openstack/requests/image/update_image_members.rb
gapinc-fog-1.12.1.2 lib/fog/openstack/requests/image/update_image_members.rb