Sha256: 7c64163f260158f8e43d578b4fcf18aa99ac43185e5550f68c47e75bec273987

Contents?: true

Size: 787 Bytes

Versions: 5

Compression:

Stored size: 787 Bytes

Contents

require 'fog/core/collection'
require 'fog/openstack/models/identity/user'

module Fog
  module Identity
    class OpenStack
      class Users < Fog::Collection
        model Fog::Identity::OpenStack::User

        attribute :tenant_id

        def all
          load(connection.list_users(tenant_id).body['users'])
        end

        def find_by_id(id)
          self.find {|user| user.id == id} ||
            Fog::Identity::OpenStack::User.new(
              connection.get_user_by_id(id).body['user'].merge(
                'connection' => connection
              )
            )
        end

        def destroy(id)
          user = self.find_by_id(id)
          user.destroy
        end
      end # class Users
    end # class OpenStack
  end # module Identity
end # module Fog

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/openstack/models/identity/users.rb
fog-nirvanix-1.8.1 lib/fog/openstack/models/identity/users.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/openstack/models/identity/users.rb
fog-sgonyea-1.8.1 lib/fog/openstack/models/identity/users.rb
fog-1.8.0 lib/fog/openstack/models/identity/users.rb