Class: AastraXmlApi::PhoneTextMenuEntry

Inherits:
Phone
  • Object
show all
Defined in:
lib/aastra_xml_api/phone_text_menu_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, #setTimeout, #setTitle, #setTitleWrap

Constructor Details

#initialize(name, url, selection, icon, dial) ⇒ PhoneTextMenuEntry

Create new text menu entry with given name to be displayed, url to be called when selected. Selection is the value appended to a custom URI attached to a softkey. This will be added as either ?selection=value or &selection=value depending on if the URI already has parameters. icon is the index of the icon to be displayed to the left of the given entry. dial is the number to call if the user pushes a softkey with URI SoftKey:Dial2.



25
26
27
28
29
30
31
32
33
34
# File 'lib/aastra_xml_api/phone_text_menu_entry.rb', line 25

def initialize(name, url, selection, icon, dial)
  @name = name
  @url = url
  @selection = selection
  @icon = icon
  @dial = dial
  @selection = nil if @selection == ''
  @icon = nil if @icon == ''
  @dial = nil if @dial == ''
end

Instance Method Details

#getNameObject

Returns the name associated with this entry.



37
38
39
# File 'lib/aastra_xml_api/phone_text_menu_entry.rb', line 37

def getName
  return @name
end

#renderObject

Create XML text output of this entry.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/aastra_xml_api/phone_text_menu_entry.rb', line 42

def render
  xml = "<MenuItem"
  xml += " icon=\"#{@icon}\"" if not @icon.nil?
  xml += ">\n"
  xml += "<Prompt>#{escape(@name)}</Prompt>\n"
  xml += "<URI>#{escape(@url)}</URI>\n"
  xml += "<Selection>#{escape(@selection)}</Selection>\n" if not @selection.nil?
  xml += "<Dial>#{@dial}</Dial>\n" if not @dial.nil?
  xml += "</MenuItem>\n"
  return xml
end