Sha256: 0f0984f8f78a6229fe53c2f7dd7209880d3c4b116927ee9ecea9a2337c80a3f7

Contents?: true

Size: 1.27 KB

Versions: 14

Compression:

Stored size: 1.27 KB

Contents

module Fog
  module Identity
    class OpenStack
      class V2
        class Real
          def list_users(options = {})
            if options.kind_of?(Hash)
              tenant_id = options.delete(:tenant_id)
              query = options
            else
              Fog::Logger.deprecation('Calling OpenStack[:identity].list_users(tenant_id) is deprecated, use .list_users(:tenant_id => value)')
              tenant_id = options
              query = {}
            end

            path = tenant_id ? "tenants/#{tenant_id}/users" : 'users'
            request(
              :expects => [200, 204],
              :method  => 'GET',
              :path    => path,
              :query   => query
            )
          end
        end # class Real

        class Mock
          def list_users(options = {})
            tenant_id = options[:tenant_id]

            users = data[:users].values

            if tenant_id
              users = users.select do |user|
                user['tenantId'] == tenant_id
              end
            end

            Excon::Response.new(
              :body   => {'users' => users},
              :status => 200
            )
          end
        end # class Mock
      end # class V2
    end # class OpenStack
  end # module Identity
end # module Fog

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fog-openstack-0.1.25 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.24 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.23 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.22 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.21 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.20 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.19 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.18 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.17 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.15 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.14 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.13 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.12 lib/fog/identity/openstack/v2/requests/list_users.rb
fog-openstack-0.1.11 lib/fog/identity/openstack/v2/requests/list_users.rb