Class: Avaya::UserList

Inherits:
Object
  • Object
show all
Defined in:
lib/avaya/user_list.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(list_id = "") ⇒ UserList

Returns a new instance of UserList.



5
6
7
# File 'lib/avaya/user_list.rb', line 5

def initialize(list_id ="")
  @user_list = Avaya::TFTP.read(:user_list, list_id)
end

Instance Attribute Details

#user_listObject (readonly)

Returns the value of attribute user_list.



3
4
5
# File 'lib/avaya/user_list.rb', line 3

def user_list
  @user_list
end

Class Method Details

.get(list_id = "") ⇒ Object



9
10
11
12
13
# File 'lib/avaya/user_list.rb', line 9

def self.get(list_id = "")
  hunt_list = self.new(list_id)
  hunt_list.get

end

Instance Method Details

#getObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/avaya/user_list.rb', line 15

def get
  list= []
  user_list.each do |row|
    row     = row.split(",")
    new_row = {
        name:      row[0],
        ext:       row[1],
        full_name: row[2],
        user_id:   row.last

    }
    unless @list_id == "" or @list_id == "2"
      new_row.merge! ex_directory: (row[3] =="1")
      new_row.merge! active: (row[4] == "1")
    end
    list << new_row
  end

  list
end