Class: OnSIP::User

Inherits:
Object
  • Object
show all
Extended by:
ClassMethods
Includes:
Model
Defined in:
lib/onsip/models/user.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary

Constants included from ClassMethods

ClassMethods::DEFAULT_OPTIONS

Constants included from Model::ClassMethods

Model::ClassMethods::DEFAULT_OPTIONS

Instance Attribute Summary

Attributes included from Model

#attributes, #session

Instance Method Summary collapse

Methods included from ClassMethods

browse, edit_status, generate_random_password, process_add_user_response, process_browse_user_response, process_change_role_user_response, process_delete_user_response, process_edit_user_status_response, process_read_user_response, read

Methods included from Model::ClassMethods

#merge_params

Methods included from Model

#initialize

Instance Method Details

#accountObject



37
38
39
# File 'lib/onsip/models/user.rb', line 37

def 
  Account.read self.
end

#account_idObject



9
10
11
# File 'lib/onsip/models/user.rb', line 9

def 
  @attributes.AccountId
end

#add(organization = nil) ⇒ Object



41
42
43
# File 'lib/onsip/models/user.rb', line 41

def add(organization = nil)
  self.class.add organization, @attributes
end

#auth_usernameObject



33
34
35
# File 'lib/onsip/models/user.rb', line 33

def auth_username
  @attributes.AuthUsername
end

#change_role(role) ⇒ Object



57
58
59
# File 'lib/onsip/models/user.rb', line 57

def change_role(role)
  self.class.change_role self.id, role
end

#delete!Object



45
46
47
# File 'lib/onsip/models/user.rb', line 45

def delete!
  self.class.delete! self.id
end

#disable!Object



61
62
63
# File 'lib/onsip/models/user.rb', line 61

def disable!
  self.class.edit_status self.id, {'Status' => 'disabled'}
end

#domainObject



21
22
23
# File 'lib/onsip/models/user.rb', line 21

def domain
  @attributes.Domain
end

#idObject



5
6
7
# File 'lib/onsip/models/user.rb', line 5

def id
  @attributes.UserId
end

#organizationObject



49
50
51
# File 'lib/onsip/models/user.rb', line 49

def organization
  @organization ||= Organization.read(self.organization_id)
end

#organization_idObject



13
14
15
# File 'lib/onsip/models/user.rb', line 13

def organization_id
  @attributes.OrganizationId
end

#passwordObject



29
30
31
# File 'lib/onsip/models/user.rb', line 29

def password
  @attributes.Password
end

#statusObject



17
18
19
# File 'lib/onsip/models/user.rb', line 17

def status
  @attributes.Status
end

#user_addressesObject



53
54
55
# File 'lib/onsip/models/user.rb', line 53

def user_addresses
  UserAddress.browse({'UserId' => self.id})
end

#usernameObject



25
26
27
# File 'lib/onsip/models/user.rb', line 25

def username
  @attributes.Username
end