Class: AastraXmlApi::PhoneStatusEntry

Inherits:
Phone
  • Object
show all
Defined in:
lib/aastra_xml_api/phone_status_entry.rb

Constant Summary

Constants inherited from Phone

AastraXmlApi::Phone::HIGHASCII

Instance Method Summary collapse

Methods inherited from Phone

#addIcon, #addSoftkey, #convert_high_ascii, #escape, #getRefreshTimeout, #getRefreshURL, #setAllowAnswer, #setBeep, #setCancelAction, #setDestroyOnExit, #setLockIn, #setRefresh, #setTitle, #setTitleWrap

Constructor Details

#initialize(index, message, type = nil, timeout = nil) ⇒ PhoneStatusEntry

Create new status message at index. Type can only be “alert” or left blank. If the type is anything but blank, it is automatically set to “alert”. The timeout overrides the default 3 seconds for an alert message.



21
22
23
24
25
26
# File 'lib/aastra_xml_api/phone_status_entry.rb', line 21

def initialize(index, message, type=nil, timeout=nil)
  @index = index
  @message = message
  setType(type)
  @timeout = timeout
end

Instance Method Details

#renderObject

Create XML text output of this entry



50
51
52
53
54
55
56
# File 'lib/aastra_xml_api/phone_status_entry.rb', line 50

def render
  xml = "<Message index=\"#{escape(@index)}\""
  xml += " type=\"#{escape(@type)}\"" if not @type.nil?
  xml += " Timeout=\"#{@timeout}\"" if not @timeout.nil?
  xml += ">#{escape(@message)}</Message>\n"
  return xml
end

#setIndex(index) ⇒ Object

Set the index of this message.



29
30
31
# File 'lib/aastra_xml_api/phone_status_entry.rb', line 29

def setIndex(index)
  @index = index
end

#setMessage(message) ⇒ Object

Set the text of the message.



34
35
36
# File 'lib/aastra_xml_api/phone_status_entry.rb', line 34

def setMessage(message)
  @message = message
end

#setTimeout(timeout) ⇒ Object

Set the timeout (in seconds) of an alert message



45
46
47
# File 'lib/aastra_xml_api/phone_status_entry.rb', line 45

def setTimeout(timeout)
  @timeout = timeout
end

#setType(type) ⇒ Object

Set the type of the message. Either “alert” or normal (blank and default)



39
40
41
42
# File 'lib/aastra_xml_api/phone_status_entry.rb', line 39

def setType(type)
  @type = type if type.nil?
  @type = "alert" if not type.nil?
end