aastra_xml_api 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/README.md +10 -2
  4. data/aastra_xml_api.gemspec +1 -1
  5. data/lib/aastra_xml_api.rb +1 -1
  6. data/lib/aastra_xml_api/array_extensions.rb +61 -0
  7. data/lib/aastra_xml_api/phone.rb +205 -0
  8. data/lib/aastra_xml_api/phone_configuration.rb +56 -0
  9. data/lib/aastra_xml_api/phone_configuration_entry.rb +43 -0
  10. data/lib/aastra_xml_api/phone_directory.rb +122 -0
  11. data/lib/aastra_xml_api/phone_directory_entry.rb +34 -0
  12. data/lib/aastra_xml_api/phone_execute.rb +60 -0
  13. data/lib/aastra_xml_api/phone_execute_entry.rb +32 -0
  14. data/lib/aastra_xml_api/phone_formatted_text_screen.rb +119 -0
  15. data/lib/aastra_xml_api/phone_formatted_text_screen_entry.rb +50 -0
  16. data/lib/aastra_xml_api/phone_gd_image.rb +187 -0
  17. data/lib/aastra_xml_api/phone_icon_entry.rb +29 -0
  18. data/lib/aastra_xml_api/phone_image_menu.rb +145 -0
  19. data/lib/aastra_xml_api/phone_image_menu_entry.rb +27 -0
  20. data/lib/aastra_xml_api/phone_image_screen.rb +141 -0
  21. data/lib/aastra_xml_api/phone_input_screen.rb +251 -0
  22. data/lib/aastra_xml_api/phone_input_screen_entry.rb +86 -0
  23. data/lib/aastra_xml_api/phone_softkey_entry.rb +39 -0
  24. data/lib/aastra_xml_api/phone_status.rb +68 -0
  25. data/lib/aastra_xml_api/phone_status_entry.rb +58 -0
  26. data/lib/aastra_xml_api/phone_text_menu.rb +148 -0
  27. data/lib/aastra_xml_api/phone_text_menu_entry.rb +54 -0
  28. data/lib/aastra_xml_api/phone_text_screen.rb +95 -0
  29. data/lib/aastra_xml_api/version.rb +1 -1
  30. metadata +28 -27
  31. data/lib/aastra_xml_api/AastraIPPhone.rb +0 -203
  32. data/lib/aastra_xml_api/AastraIPPhoneConfiguration.rb +0 -55
  33. data/lib/aastra_xml_api/AastraIPPhoneConfigurationEntry.rb +0 -41
  34. data/lib/aastra_xml_api/AastraIPPhoneDirectory.rb +0 -119
  35. data/lib/aastra_xml_api/AastraIPPhoneDirectoryEntry.rb +0 -32
  36. data/lib/aastra_xml_api/AastraIPPhoneExecute.rb +0 -58
  37. data/lib/aastra_xml_api/AastraIPPhoneExecuteEntry.rb +0 -30
  38. data/lib/aastra_xml_api/AastraIPPhoneFormattedTextScreen.rb +0 -117
  39. data/lib/aastra_xml_api/AastraIPPhoneFormattedTextScreenEntry.rb +0 -48
  40. data/lib/aastra_xml_api/AastraIPPhoneGDImage.rb +0 -185
  41. data/lib/aastra_xml_api/AastraIPPhoneIconEntry.rb +0 -27
  42. data/lib/aastra_xml_api/AastraIPPhoneImageMenu.rb +0 -143
  43. data/lib/aastra_xml_api/AastraIPPhoneImageMenuEntry.rb +0 -25
  44. data/lib/aastra_xml_api/AastraIPPhoneImageScreen.rb +0 -139
  45. data/lib/aastra_xml_api/AastraIPPhoneInputScreen.rb +0 -249
  46. data/lib/aastra_xml_api/AastraIPPhoneInputScreenEntry.rb +0 -84
  47. data/lib/aastra_xml_api/AastraIPPhoneSoftkeyEntry.rb +0 -37
  48. data/lib/aastra_xml_api/AastraIPPhoneStatus.rb +0 -66
  49. data/lib/aastra_xml_api/AastraIPPhoneStatusEntry.rb +0 -56
  50. data/lib/aastra_xml_api/AastraIPPhoneTextMenu.rb +0 -145
  51. data/lib/aastra_xml_api/AastraIPPhoneTextMenuEntry.rb +0 -52
  52. data/lib/aastra_xml_api/AastraIPPhoneTextScreen.rb +0 -93
  53. data/lib/aastra_xml_api/arraynatsort.rb +0 -63
@@ -0,0 +1,95 @@
1
+ ################################################################################
2
+ # Aastra XML API Classes - PhoneTextScreen
3
+ # Copyright Aastra Telecom 2008
4
+ #
5
+ # Ruby adaptation by Carlton O'Riley
6
+ #
7
+ # PhoneTextScreen object.
8
+ #
9
+ # Public methods
10
+ #
11
+ # Inherited from Phone
12
+ # setTitle(Title) to setup the title of an object (optional)
13
+ # setTitleWrap to set the title to be wrapped on 2 lines (optional)
14
+ # setDestroyOnExit to set DestroyonExit parameter to 'yes', 'no' by default (optional)
15
+ # setCancelAction(uri) to set the cancel parameter with the URI to be called on Cancel (optional)
16
+ # setBeep to enable a notification beep with the object (optional)
17
+ # setLockIn to set the Lock-in tag to 'yes' (optional)
18
+ # setAllowAnswer to set the allowAnswer tag to 'yes' (optional)
19
+ # setTimeout(timeout) to define a specific timeout for the XML object (optional)
20
+ # addSoftkey(index,label,uri,iconindex) to add custom softkeys to the object (optional)
21
+ # addIcon(index,icon) to add custom icons to the object (optional)
22
+ # setRefresh(timeout,URL) to add Refresh parameters to the object (optional)
23
+ #
24
+ # Specific to the object
25
+ # setText(text) to set the text to be displayed.
26
+ # setDoneAction(uri) to set the URI to be called when the user selects the default "Done" key (optional)
27
+ # setAllowDTMF to allow DTMF passthrough on the object
28
+ #
29
+ # Example
30
+ # require 'PhoneTextScreen.rb'
31
+ # text = PhoneTextScreen.new
32
+ # text.setTitle('Title')
33
+ # text.setText('Text to be displayed.')
34
+ # text.setDestroyOnExit
35
+ # text.addSoftkey('1', 'Mail', 'http://myserver.com/script.php?action=1', '1')
36
+ # text.addSoftkey('6', 'Exit', 'SoftKey:Exit')
37
+ # text.addIcon('1', 'Icon:Envelope')
38
+ # aastra_output text
39
+ #
40
+ ################################################################################
41
+
42
+ module AastraXmlApi
43
+ class PhoneTextScreen < Phone
44
+ @text
45
+ @doneAction
46
+ @allowDTMF
47
+
48
+ # Set the text to be displayed on this screen.
49
+ def setText(text)
50
+ @text = text
51
+ end
52
+
53
+ # Set the URI to be called when done viewing this screen.
54
+ def setDoneAction(uri)
55
+ @doneAction = uri
56
+ end
57
+
58
+ # When set allows DTMF tones to be sent while viewing this screen.
59
+ def setAllowDTMF
60
+ @allowDTMF = "yes"
61
+ end
62
+
63
+ # Create XML text output.
64
+ def render
65
+ xml = "<PhoneTextScreen"
66
+ xml += " destroyOnExit=\"yes\"" if @destroyOnExit == "yes"
67
+ xml += " cancelAction=\"#{escape(@cancelAction)}\"" if not @cancelAction.nil?
68
+ xml += " doneAction=\"#{escape(@doneAction)}\"" if not @doneAction.nil?
69
+ xml += " Beep=\"yes\"" if @beep == "yes"
70
+ xml += " Timeout=\"#{@timeout}\"" if @timeout != 0
71
+ xml += " LockIn=\"yes\"" if @lockin == "yes"
72
+ xml += " allowAnswer=\"yes\"" if @allowAnswer == "yes"
73
+ xml += " allowDTMF=\"yes\"" if @allowDTMF == "yes"
74
+ xml += ">\n"
75
+ if not @title.nil? then
76
+ xml += "<Title"
77
+ xml += " wrap=\"yes\"" if @title_wrap == "yes"
78
+ xml += ">#{escape(@title)}</Title>\n"
79
+ end
80
+ xml += "<Text>#{escape(@text)}</Text>\n"
81
+ @softkeys.each { |softkey| xml += softkey.render }
82
+ iconList = 0
83
+ @icons.each do |icon|
84
+ if iconList == 0 then
85
+ xml += "<IconList>\n"
86
+ iconList = 1
87
+ end
88
+ xml += icon.render
89
+ end
90
+ xml += "</IconList>\n" if iconList != 0
91
+ xml += "</PhoneTextScreen>\n"
92
+ return xml
93
+ end
94
+ end
95
+ end
@@ -1,3 +1,3 @@
1
1
  module AastraXmlApi
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aastra_xml_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emery A. Miller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-11 00:00:00.000000000 Z
11
+ date: 2014-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -32,37 +32,38 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - ".gitignore"
35
+ - ".ruby-version"
35
36
  - Gemfile
36
37
  - LICENSE.txt
37
38
  - README.md
38
39
  - Rakefile
39
40
  - aastra_xml_api.gemspec
40
41
  - lib/aastra_xml_api.rb
41
- - lib/aastra_xml_api/AastraIPPhone.rb
42
- - lib/aastra_xml_api/AastraIPPhoneConfiguration.rb
43
- - lib/aastra_xml_api/AastraIPPhoneConfigurationEntry.rb
44
- - lib/aastra_xml_api/AastraIPPhoneDirectory.rb
45
- - lib/aastra_xml_api/AastraIPPhoneDirectoryEntry.rb
46
- - lib/aastra_xml_api/AastraIPPhoneExecute.rb
47
- - lib/aastra_xml_api/AastraIPPhoneExecuteEntry.rb
48
- - lib/aastra_xml_api/AastraIPPhoneFormattedTextScreen.rb
49
- - lib/aastra_xml_api/AastraIPPhoneFormattedTextScreenEntry.rb
50
- - lib/aastra_xml_api/AastraIPPhoneGDImage.rb
51
- - lib/aastra_xml_api/AastraIPPhoneIconEntry.rb
52
- - lib/aastra_xml_api/AastraIPPhoneImageMenu.rb
53
- - lib/aastra_xml_api/AastraIPPhoneImageMenuEntry.rb
54
- - lib/aastra_xml_api/AastraIPPhoneImageScreen.rb
55
- - lib/aastra_xml_api/AastraIPPhoneInputScreen.rb
56
- - lib/aastra_xml_api/AastraIPPhoneInputScreenEntry.rb
57
- - lib/aastra_xml_api/AastraIPPhoneSoftkeyEntry.rb
58
- - lib/aastra_xml_api/AastraIPPhoneStatus.rb
59
- - lib/aastra_xml_api/AastraIPPhoneStatusEntry.rb
60
- - lib/aastra_xml_api/AastraIPPhoneTextMenu.rb
61
- - lib/aastra_xml_api/AastraIPPhoneTextMenuEntry.rb
62
- - lib/aastra_xml_api/AastraIPPhoneTextScreen.rb
63
- - lib/aastra_xml_api/arraynatsort.rb
42
+ - lib/aastra_xml_api/array_extensions.rb
43
+ - lib/aastra_xml_api/phone.rb
44
+ - lib/aastra_xml_api/phone_configuration.rb
45
+ - lib/aastra_xml_api/phone_configuration_entry.rb
46
+ - lib/aastra_xml_api/phone_directory.rb
47
+ - lib/aastra_xml_api/phone_directory_entry.rb
48
+ - lib/aastra_xml_api/phone_execute.rb
49
+ - lib/aastra_xml_api/phone_execute_entry.rb
50
+ - lib/aastra_xml_api/phone_formatted_text_screen.rb
51
+ - lib/aastra_xml_api/phone_formatted_text_screen_entry.rb
52
+ - lib/aastra_xml_api/phone_gd_image.rb
53
+ - lib/aastra_xml_api/phone_icon_entry.rb
54
+ - lib/aastra_xml_api/phone_image_menu.rb
55
+ - lib/aastra_xml_api/phone_image_menu_entry.rb
56
+ - lib/aastra_xml_api/phone_image_screen.rb
57
+ - lib/aastra_xml_api/phone_input_screen.rb
58
+ - lib/aastra_xml_api/phone_input_screen_entry.rb
59
+ - lib/aastra_xml_api/phone_softkey_entry.rb
60
+ - lib/aastra_xml_api/phone_status.rb
61
+ - lib/aastra_xml_api/phone_status_entry.rb
62
+ - lib/aastra_xml_api/phone_text_menu.rb
63
+ - lib/aastra_xml_api/phone_text_menu_entry.rb
64
+ - lib/aastra_xml_api/phone_text_screen.rb
64
65
  - lib/aastra_xml_api/version.rb
65
- homepage: http://www.easyofficephone.com
66
+ homepage: https://github.com/EasyOfficePhone/aastra_xml_api
66
67
  licenses:
67
68
  - GNU GPL v2
68
69
  metadata: {}
@@ -82,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
83
  version: '0'
83
84
  requirements: []
84
85
  rubyforge_project:
85
- rubygems_version: 2.2.0
86
+ rubygems_version: 2.2.2
86
87
  signing_key:
87
88
  specification_version: 4
88
89
  summary: Aastra XML API for Ruby
@@ -1,203 +0,0 @@
1
- ###############################################################################
2
- # Aastra XML API Classes - AastraIPPhone
3
- # Copyright Aastra Telecom 2008
4
- #
5
- # Ruby adaptation by Carlton O'Riley
6
- #
7
- # AastraIPPhone is the root class for all the Aastra XML objects.
8
- #
9
- # Public methods
10
- # setTitle(Title) to setup the title of an object (optional)
11
- # setTitleWrap to set the title to be wrapped on 2 lines (optional)
12
- # setCancelAction(uri) to set the cancel parameter with the URI to be called on Cancel (optional)
13
- # setDestroyOnExit to set DestroyonExit parameter to 'yes', 'no' by default (optional)
14
- # setBeep to enable a notification beep with the object (optional)
15
- # setLockIn to set the Lock-in tag to 'yes' (optional)
16
- # setAllowAnswer to set the allowAnswer tag to 'yes' (optional)
17
- # setTimeout(timeout) to define a specific timeout for the XML object (optional)
18
- # addSoftkey(index,label,uri,icon_index) to add custom soktkeys to the object (optional)
19
- # setRefresh(timeout,URL) to add Refresh parameters to the object (optional)
20
- # addIcon(index,icon) to add custom icons to the object (optional)
21
- #
22
- ###############################################################################
23
-
24
- class AastraIPPhone
25
- @entries
26
- @softkeys
27
- @icons
28
- @title
29
- @title_wrap
30
- @destroyOnExit
31
- @cancelAction
32
- @refreshTimeout
33
- @refreshURL
34
- @beep
35
- @lockin
36
- @timeout
37
- @allowAnswer
38
-
39
- HIGHASCII = {
40
- "!\xc0!" => 'A', # A`
41
- "!\xe0!" => 'a', # a`
42
- "!\xc1!" => 'A', # A'
43
- "!\xe1!" => 'a', # a'
44
- "!\xc2!" => 'A', # A^
45
- "!\xe2!" => 'a', # a^
46
- "!\xc4!" => 'Ae', # A:
47
- "!\xe4!" => 'ae', # a:
48
- "!\xc3!" => 'A', # A~
49
- "!\xe3!" => 'a', # a~
50
- "!\xc8!" => 'E', # E`
51
- "!\xe8!" => 'e', # e`
52
- "!\xc9!" => 'E', # E'
53
- "!\xe9!" => 'e', # e'
54
- "!\xca!" => 'E', # E^
55
- "!\xea!" => 'e', # e^
56
- "!\xcb!" => 'Ee', # E:
57
- "!\xeb!" => 'ee', # e:
58
- "!\xcc!" => 'I', # I`
59
- "!\xec!" => 'i', # i`
60
- "!\xcd!" => 'I', # I'
61
- "!\xed!" => 'i', # i'
62
- "!\xce!" => 'I', # I^
63
- "!\xee!" => 'i', # i^
64
- "!\xcf!" => 'Ie', # I:
65
- "!\xef!" => 'ie', # i:
66
- "!\xd2!" => 'O', # O`
67
- "!\xf2!" => 'o', # o`
68
- "!\xd3!" => 'O', # O'
69
- "!\xf3!" => 'o', # o'
70
- "!\xd4!" => 'O', # O^
71
- "!\xf4!" => 'o', # o^
72
- "!\xd6!" => 'Oe', # O:
73
- "!\xf6!" => 'oe', # o:
74
- "!\xd5!" => 'O', # O~
75
- "!\xf5!" => 'o', # o~
76
- "!\xd8!" => 'Oe', # O/
77
- "!\xf8!" => 'oe', # o/
78
- "!\xd9!" => 'U', # U`
79
- "!\xf9!" => 'u', # u`
80
- "!\xda!" => 'U', # U'
81
- "!\xfa!" => 'u', # u'
82
- "!\xdb!" => 'U', # U^
83
- "!\xfb!" => 'u', # u^
84
- "!\xdc!" => 'Ue', # U:
85
- "!\xfc!" => 'ue', # u:
86
- "!\xc7!" => 'C', # ,C
87
- "!\xe7!" => 'c', # ,c
88
- "!\xd1!" => 'N', # N~
89
- "!\xf1!" => 'n', # n~
90
- "!\xdf!" => 'ss'
91
- }
92
-
93
- # Create an AastraIPPhone object and set initial values. Everything
94
- # sent to the phone will inherit from this class.
95
- def initialize
96
- @entries = []
97
- @softkeys = []
98
- @icons = []
99
- @refreshTimeout = 0
100
- @timeout = 0
101
- end
102
-
103
- # Set the title of the AastraIPPhone object. Typically displayed on the
104
- # top of the phone.
105
- def setTitle(title)
106
- @title = title
107
- end
108
-
109
- # Allow the title to wrap over multiple lines when displayed.
110
- def setTitleWrap
111
- @title_wrap = "yes"
112
- end
113
-
114
- # Set refresh timeout (seconds) and the URI to load when the
115
- # timeout is reached.
116
- def setRefresh(timeout, url)
117
- @refreshTimeout = timeout
118
- @refreshURL = url
119
- end
120
-
121
- # Beep phone when XML is received.
122
- def setBeep
123
- @beep = "yes"
124
- end
125
-
126
- # Do not keep the object in the phone browser after exit.
127
- def setDestroyOnExit
128
- @destroyOnExit = "yes"
129
- end
130
-
131
- # Defines the URI to call when the user cancels the XML object.
132
- def setCancelAction(cancelAction)
133
- @cancelAction = cancelAction
134
- end
135
-
136
- # Ignores all keys that would cause the screen to exit without using
137
- # keys defined by the object.
138
- def setLockIn
139
- @lockin = "yes"
140
- end
141
-
142
- # Override the default 45 second timeout. A value of 0 will disable
143
- # timeout.
144
- def setTimeout(timeout)
145
- @timeout = timeout
146
- end
147
-
148
- # Applies only to the non-softkey phones (53i). When set, the phone
149
- # displays 'Ignore' and 'Answer' if the XML object is displayed when
150
- # the phone is ringing.
151
- def setAllowAnswer
152
- @allowAnswer = "yes"
153
- end
154
-
155
- # Returns the set refresh timeout value.
156
- def getRefreshTimeout
157
- return @refreshTimeout
158
- end
159
-
160
- # Returns the set refresh URI.
161
- def getRefreshURL
162
- return @refreshURL
163
- end
164
-
165
- # Add a softkey to be displayed while the XML object is on the screen.
166
- # Only available on the 9480i, 9480iCT, 55i, 57i, and 57iCT. Softkey
167
- # will be at position index. label is what is displayed next to the
168
- # softkey button. uri is what is called when the softkey is pressed.
169
- # Optionally, icon is the index of the icon to display to the left of
170
- # the label.
171
- def addSoftkey(index, label, uri, icon=nil)
172
- @softkeys += [AastraIPPhoneSoftkeyEntry.new(index, escape(label), escape(uri), icon)]
173
- end
174
-
175
- # Add an icon to be used by either a softkey of AastraIPPhoneTextMenu.
176
- # Only available on the 55i, 57i, and 57iCT. The index is the same as
177
- # what is referenced by addSoftkey or AastraIPPhoneTextMenu.addEntry.
178
- # The icon can be either a predefined icon or the hex of an icon image.
179
- def addIcon(index, icon)
180
- @icons += [AastraIPPhoneIconEntry.new(index, icon)]
181
- end
182
-
183
- # Convert any HTML characters to the proper escaped format.
184
- # i.e. > becomes &gt;
185
- def escape(s)
186
- return nil if s.nil?
187
- CGI.escapeHTML(s)
188
- end
189
-
190
- # Convert characters when using double sized text in
191
- # AastraIPPhoneFormattedTextScreen.
192
- def convert_high_ascii(s)
193
- ret = ""
194
- s.each do |char|
195
- if not HIGHASCII[char].nil? then
196
- ret += HIGHASCII[char]
197
- else
198
- ret += char
199
- end
200
- end
201
- return ret
202
- end
203
- end
@@ -1,55 +0,0 @@
1
- ################################################################################
2
- # Aastra XML API Classes - AastraIPPhoneConfiguration
3
- # Copyright Aastra Telecom 8007
4
- #
5
- # Ruby adaptation by Carlton O'Riley
6
- #
7
- # AastraIPPhoneConfiguration object.
8
- #
9
- # Public methods
10
- #
11
- # Inherited from AastraIPPhone
12
- # setBeep to enable a notification beep with the object (optional)
13
- #
14
- # Specific to the object
15
- # addEntry(parameter,value) to add a configuration change.
16
- # setTriggerDestroyOnExit to set the triggerDestroyOnExit tag to
17
- # "yes" (optional)
18
- #
19
- # Example
20
- # require 'AastraIPPhoneConfiguration.rb'
21
- # configuration = AastraIPPhoneConfiguration.new
22
- # configuration.addEntry('softkey1 label','Test')
23
- # configuration.addEntry('softkey1 type','xml')
24
- # configuration.setTriggerDestroyOnExit
25
- # configuration.setBeep
26
- # aastra_output configuration
27
- #
28
- ################################################################################
29
-
30
- class AastraIPPhoneConfiguration < AastraIPPhone
31
-
32
- # Adds a parameter and value entry to the list.
33
- def addEntry(parameter, value)
34
- @entries += [AastraIPPhoneConfigurationEntry.new(parameter, value)]
35
- end
36
-
37
- # When set, the previous user interface XML object is destroyed
38
- # if its destroyOnExit tag is also set to yes.
39
- def setTriggerDestroyOnExit
40
- @triggerDestroyOnExit = "yes"
41
- end
42
-
43
- # Create XML text output.
44
- def render
45
- out = "<AastraIPPhoneConfiguration"
46
- out += " Beep=\"yes\"" if @beep == "yes"
47
- out += " triggerDestroyOnExit=\"yes\"" if @triggerDestroyOnExit == "yes"
48
- out += ">\n"
49
- @entries.each do |entry|
50
- out += entry.render
51
- end
52
- out += "</AastraIPPhoneConfiguration>\n"
53
- return out
54
- end
55
- end