Sha256: 72d1b74c7e1e7e7926f2b99b097e677c801d1fb13ac70ca75258f28918f7c957

Contents?: true

Size: 782 Bytes

Versions: 20

Compression:

Stored size: 782 Bytes

Contents

module Fog
  module Identity
    class OpenStack
      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 = self.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

Version data entries

20 entries across 20 versions & 4 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/openstack/requests/identity/get_user_by_id.rb
fog-1.30.0 lib/fog/openstack/requests/identity/get_user_by_id.rb
fog-1.29.0 lib/fog/openstack/requests/identity/get_user_by_id.rb
fog-1.28.0 lib/fog/openstack/requests/identity/get_user_by_id.rb
fog-1.27.0 lib/fog/openstack/requests/identity/get_user_by_id.rb
fog-1.26.0 lib/fog/openstack/requests/identity/get_user_by_id.rb
fog-1.25.0 lib/fog/openstack/requests/identity/get_user_by_id.rb
nsidc-fog-1.24.1 lib/fog/openstack/requests/identity/get_user_by_id.rb
fog-1.24.0 lib/fog/openstack/requests/identity/get_user_by_id.rb
ns-fog-1.22.11 lib/fog/openstack/requests/identity/get_user_by_id.rb
ns-fog-1.22.10 lib/fog/openstack/requests/identity/get_user_by_id.rb
ns-fog-1.22.9 lib/fog/openstack/requests/identity/get_user_by_id.rb
ns-fog-1.22.8 lib/fog/openstack/requests/identity/get_user_by_id.rb
ns-fog-1.22.7 lib/fog/openstack/requests/identity/get_user_by_id.rb
ns-fog-1.22.6 lib/fog/openstack/requests/identity/get_user_by_id.rb
fog-1.23.0 lib/fog/openstack/requests/identity/get_user_by_id.rb
ns-fog-1.22.4 lib/fog/openstack/requests/identity/get_user_by_id.rb
ns-fog-1.22.3 lib/fog/openstack/requests/identity/get_user_by_id.rb
ns-fog-1.22.2 lib/fog/openstack/requests/identity/get_user_by_id.rb
fog-1.22.1 lib/fog/openstack/requests/identity/get_user_by_id.rb