Sha256: 2da40584b9255e0894b7c13dc81fd1187fb6f5c3cb64c5feaf8c0c215a91a603

Contents?: true

Size: 841 Bytes

Versions: 25

Compression:

Stored size: 841 Bytes

Contents

module Fog
  module Identity
    class OpenStack
      class V2
        class Real
          def get_user_by_id(user_id)
            request(
              :expects => [200, 203],
              :method  => 'GET',
              :path    => "users/#{user_id}"
            )
          end
        end

        class Mock
          def get_user_by_id(user_id)
            response = Excon::Response.new
            response.status = 200

            existing_user = data[:users].find do |u|
              u[0] == user_id || u[1]['name'] == 'mock'
            end
            existing_user = existing_user[1] if existing_user

            response.body = {
              'user' => existing_user || create_user('mock', 'mock', 'mock@email.com').body['user']
            }
            response
          end
        end
      end
    end
  end
end

Version data entries

25 entries across 23 versions & 3 rubygems

Version Path
fog-openstack-0.1.31 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.3.10 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.1.30 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.1.29 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.3.9 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.1.28 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.3.8 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.3.7 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.3.6 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.3.5 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.3.4 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.3.3 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.3.2 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.3.0 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.2.4 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.2.3 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.2.2 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.2.1 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-openstack-0.2.0 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb
fog-zj-0.1.28 lib/fog/identity/openstack/v2/requests/get_user_by_id.rb