Class: Five9::UserManagement

Inherits:
Base
  • Object
show all
Defined in:
lib/five9/user_management.rb

Instance Method Summary collapse

Constructor Details

#initialize(adminuser, password) ⇒ UserManagement

This class is essentially a cut-paste of the User Management methods from the Five9 API. Arguments to the methods should be hashes of the data values required in the API, unless otherwise specified.



7
8
9
10
11
# File 'lib/five9/user_management.rb', line 7

def initialize(adminuser, password)
  # arguments should be strings
  super(adminuser, password,
  "https://api.five9.com/wsadmin/v2/AdminWebService?wsdl&user=")
end

Instance Method Details

#add_user_skill(user_skill) ⇒ Object



84
85
86
87
88
89
90
91
92
93
# File 'lib/five9/user_management.rb', line 84

def add_user_skill(user_skill)
  # user_skill is a userSkill hash 
  affect_user_skill(:user_skill_add, user_skill)
  # begin
  #   @client.call :userSkillAdd, message: { userSkill: user_skill }    
  # rescue => error
  #   puts error.to_s.inspect
  #   return false
  # end
end

#create_user(args = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/five9/user_management.rb', line 13

def create_user(args = {})
  # Use this method to create a user. 
  # An exception is thrown if the user already exists, if the limit number of users is reached, or if user attributes are invalid.
  begin
    @client.call :create_user, message: args
  rescue => error
    puts error.to_s.inspect
    return false
  end
end

#delete_user(username) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/five9/user_management.rb', line 24

def delete_user(username)
  # Use this method to delete the specified user. 
  # An exception is thrown if the user does not exist.
  # username is a string
  begin
    @client.call :delete_user, message: { user_name: username }
  rescue => error
    puts error.to_s.inspect
    return false
  end
end

#get_users_general_info(username_pattern = nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/five9/user_management.rb', line 36

def get_users_general_info(username_pattern = nil)
  # Use this method to obtain general information about each user name that matches a pattern.
    # username_pattern should be a regular expression.
    # If omitted or equal to an empty string, all objects are returned.
    # For example, a pattern may be the first characters of the user name.
  begin
    @client.call :get_users_general_info, message: { userNamePattern: username_pattern }
  rescue => error
    puts error.to_s.inspect
    return false
  end
end

#get_users_info(username_pattern = nil) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/five9/user_management.rb', line 49

def get_users_info(username_pattern = nil)
  # Use this method to obtain information about roles and skills 
  # in addition to general information for the user, 
  # for each user name that matches a pattern.
  # username_pattern should be a regular expression
  begin
    @client.call :get_users_info, message: { userNamePattern: username_pattern }      
  rescue => error
    puts error.to_s.inspect
    return false
  end
end

#modify_user(args = {}) ⇒ Object



62
63
64
65
66
67
68
69
70
71
# File 'lib/five9/user_management.rb', line 62

def modify_user(args = {})
  # Use this method to modify user attributes
  # args may include userGeneralInfo, rolesToSet, and rolesToRemove
  begin
    @client.call :modify_user, message: args
  rescue => error
    puts error.to_s.inspect
    return false
  end
end

#modify_user_canned_reports(args = {}) ⇒ Object



73
74
75
76
77
78
79
80
81
82
# File 'lib/five9/user_management.rb', line 73

def modify_user_canned_reports(args = {})
  # Use this method to modify the list of canned reports associated with a specific user.
  # args may incldue user, cannedReportsToAdd, and cannedReportsToRemove
  begin
    @client.call :modify_user_canned_reports, message: args
  rescue => error
    puts error.to_s.inspect
    return false
  end
end

#modify_user_skill(user_skill) ⇒ Object



95
96
97
98
99
100
101
102
103
104
# File 'lib/five9/user_management.rb', line 95

def modify_user_skill(user_skill)
  # user_skill is a userSkill hash 
  affect_user_skill(:user_skill_modify, user_skill)
  # begin
  #   @client.call :userSkillModify, message: { userSkill: user_skill }
  # rescue => error
  #   puts error.to_s.inspect
  #   return false
  # end
end

#remove_user_skill(user_skill) ⇒ Object



106
107
108
109
110
111
112
113
114
115
# File 'lib/five9/user_management.rb', line 106

def remove_user_skill(user_skill)
  # user_skill is a userSkill hash 
  affect_user_skill(:user_skill_remove, user_skill)
  # begin
  #   @client.call :userSkillRemove, message: { userSkill: user_skill }
  # rescue => error
  #   puts error.to_s.inspect
  #   return false
  # end
end