Sha256: 1249fc8128c3d09a1eec19f56a977ec836047ed9f3ff1abc8e5f0ec69e4072b7

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

module Fog
  module Identity
    class OpenStack
      class Real

        def create_user(name, password, email, tenantId=nil, enabled=true)
          data = {
            'user' => {
              'name'      => name,
              'password'  => password,
              'tenantId'  => tenantId,
              'email'     => email,
              'enabled'   => enabled,
            }
          }

          request(
            :body     => MultiJson.encode(data),
            :expects  => [200, 202],
            :method   => 'POST',
            :path     => '/users'
          )
        end

      end

      class Mock

        def create_user(name, password, email, tenantId=nil, enabled=true)
          response = Excon::Response.new
          response.status = 200
          data = {
            'id'       => Fog::Mock.random_numbers(6).to_s,
            'name'     => name,
            'email'    => email,
            'tenantId' => tenantId,
            'enabled'  => enabled
          }
          self.data[:users][data['id']] = data
          response.body = { 'user' => data }
          response
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 4 rubygems

Version Path
fog-parser-fix-1.6.1 lib/fog/openstack/requests/identity/create_user.rb
fog-test-again-1.6.0 lib/fog/openstack/requests/identity/create_user.rb
fog-parser-fix-1.6.0 lib/fog/openstack/requests/identity/create_user.rb
fog-1.6.0 lib/fog/openstack/requests/identity/create_user.rb
fog-1.5.0 lib/fog/openstack/requests/identity/create_user.rb
rackspace-fog-1.4.2 lib/rackspace-fog/openstack/requests/identity/create_user.rb
fog-1.4.0 lib/fog/openstack/requests/identity/create_user.rb