class CloudDB::User

Attributes

name[R]

Public Class Methods

new(instance, name) click to toggle source

Creates a new CloudDB::User object representing a database.

# File lib/clouddb/user.rb, line 7
def initialize(instance, name)
  @connection     = instance.connection
  @instance       = instance
  @name           = name
  @dbmgmthost     = @connection.dbmgmthost
  @dbmgmtpath     = @connection.dbmgmtpath
  @dbmgmtport     = @connection.dbmgmtport
  @dbmgmtscheme   = @connection.dbmgmtscheme
  self
end

Public Instance Methods

destroy!() click to toggle source

Deletes the current User object and removes it from the instance. Returns true if successful, raises an exception if not.

# File lib/clouddb/user.rb, line 20
def destroy!
  response = @connection.dbreq("DELETE",@dbmgmthost,"#{@dbmgmtpath}/instances/#{CloudDB.escape(@instance.id.to_s)}/users/#{CloudDB.escape(@name.to_s)}",@dbmgmtport,@dbmgmtscheme)
  CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)
  true
end