Sha256: e8372b3d7fa1c2f1780cc61868bbf7bcb211dafdc7bce69ae96d80ac2d0fbf0a

Contents?: true

Size: 852 Bytes

Versions: 14

Compression:

Stored size: 852 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 # class V2
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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