polycom 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4f335f48c2856b49a6c0f4cbdd668f206c4247e6
4
+ data.tar.gz: 13534da3ee42017bf941f3415a4b46e91ff121be
5
+ SHA512:
6
+ metadata.gz: e359c5bc471c0e9f32f0c7c251cba6352986aae2fb99bd6d2620d76269406c652a5a9c35b3f1b927a256ccc05fd6275f331e059d1b361af90f15cb016928b9c5
7
+ data.tar.gz: 8744b8585909624c38b5e7cd644f3119b5c8c450dd0090ca0cea46d1549e082917b6af61e90b0295e86302d42fa735c34bdb6e85b9e3f0846e90a53905b121a5
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .DS_Store
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in polycom.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Sumit Birla
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # Polycom
2
+
3
+ This gem is used for communicating with IP Polycom phones using their XML application interface. It was tested with
4
+ the following phones:
5
+
6
+ * Polycom VVX 410
7
+
8
+ However, this gem should work with other phones as well.
9
+
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ gem 'polycom'
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install polycom
24
+
25
+
26
+
27
+ ## Using in ruby code
28
+
29
+ There are two classes available for you to query information and push data to your phone:
30
+
31
+ ### Poller
32
+
33
+ This class implements three methods for fetching various pieces of information:
34
+
35
+ ```ruby
36
+ poller = Polycom::Poller.new (
37
+ :username => 'admin',
38
+ :password => '456',
39
+ :ip_address => '10.0.5.7' )
40
+
41
+ puts poller.device_information
42
+ puts poller.network_information
43
+ puts poller.call_line_info
44
+ ```
45
+
46
+
47
+ ### Pusher
48
+
49
+ This class is used for pushing HTML data or URL to the phone.
50
+
51
+ ```ruby
52
+ pusher = Polycom::Pusher.new (
53
+ :username => 'admin',
54
+ :password => '456',
55
+ :ip_address => '10.0.5.7' )
56
+
57
+ pusher.send(:priority => :important, :data => "Hello NSA!")
58
+ pusher.send(:priority => :important, :url => "/index.html")
59
+ ```
60
+
61
+
62
+
63
+ ## Command Line Usage
64
+
65
+ This gem is bundled with an executable called `polycom`. Simplest usage is the following:
66
+
67
+ <pre>
68
+ % polycom admin:456@10.0.5.7 -i
69
+
70
+ Device Information
71
+ --------------------
72
+ mac_address : 0004fa839af9
73
+ phone_dn : Line1:3000
74
+ app_load_id : 4.1.4.7430 20-Mar-13 14:12
75
+ updater_id : 5.1.4.0844
76
+ model_number : VVX 410
77
+ timestamp : 2013-10-21T14:24:38-05:00
78
+
79
+
80
+ Network Information
81
+ --------------------
82
+ dhcp_server : 10.0.5.1
83
+ mac_address : 0004fa839af9
84
+ dns_suffix : example.com
85
+ ip_address : 10.0.5.7
86
+ subnet_mask : 255.255.0.0
87
+ provisioning_server : 10.0.5.2037
88
+ default_router : 10.0.5.7
89
+ dns_server1 : 8.8.4.4
90
+ dns_server2 : 0.0.0.0
91
+ vlan_id :
92
+ dhcp_enabled : Yes
93
+
94
+
95
+ Call Line Information
96
+ -----------------------
97
+ -
98
+ line_key_num : 1
99
+ line_dir_num : 3000
100
+ line_state : Inactive
101
+ -
102
+ </pre>
103
+
104
+
105
+ #### Displaying a message on the phones browser
106
+
107
+ <pre>
108
+ % polycom admin:456@10.0.5.7 -data critical "&lt;h1&gt;Hello World&lt;/h1&gt;"
109
+ </pre>
110
+
111
+
112
+ #### Pushing a URL to be displayed on the phone
113
+
114
+ You must set the `apps.push.serverRootURL` value in the
115
+ phone's configuration. The URL you send will be appended to this value.
116
+
117
+ <pre>
118
+ % polycom admin:456@10.0.5.7 -url important "/index.html"
119
+ </pre>
120
+
121
+
122
+ #### Receiving notifications from the phone
123
+
124
+ This requires you to configure `apps.telNotification.URL` in the
125
+ phones configuration to the URL printed upon running this commant. polycom somes with a built in web
126
+ server to received and print notifications.
127
+
128
+ <pre>
129
+
130
+ % polycom admin:456@10.0.5.7 -n
131
+
132
+
133
+ IMPORTANT:
134
+ Set up your Polycom phone to send 'Telephony Event Notification' to http://1.2.3.4:4567.
135
+ Please CRTL-C to end this script.
136
+
137
+ [2013-10-23 13:48:19] INFO WEBrick 1.3.1
138
+ [2013-10-23 13:48:19] INFO ruby 2.0.0 (2013-05-14) [x86_64-linux]
139
+ == Sinatra/1.4.3 has taken the stage on 4567 for development with backup from WEBrick
140
+ [2013-10-23 13:48:19] INFO WEBrick::HTTPServer#start: pid=32608 port=4567
141
+ ---
142
+ PolycomIPPhone:
143
+ CallStateChangeEvent:
144
+ CallReference: 41aa9c00
145
+ CallState: Dialtone
146
+ PhoneIP: 10.0.5.7
147
+ MACAddress: 0004f2839af9
148
+ TimeStamp: '2013-10-23T13:50:56-05:00'
149
+ CallLineInfo:
150
+ LineKeyNum: '1'
151
+ LineDirNum: '1006'
152
+ LineState: Active
153
+ CallInfo:
154
+ CallReference: 41aa9c00
155
+ CallState: Dialtone
156
+ CallType: Outgoing
157
+ UIAppearanceIndex: 1*
158
+ CalledPartyName:
159
+ CalledPartyDirNum:
160
+ CallingPartyName: '1006'
161
+ CallingPartyDirNum: sip:1006@example.com
162
+ CallDuration: '0'
163
+ </pre>
164
+
165
+
166
+
167
+ ## Contributing
168
+
169
+ 1. Fork it
170
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
171
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
172
+ 4. Push to the branch (`git push origin my-new-feature`)
173
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+ desc "Run tests"
8
+ task :default => :test
data/bin/polycom ADDED
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'polycom/pusher'
4
+ require 'polycom/poller'
5
+ require 'polycom/receiver'
6
+
7
+
8
+ def print_help
9
+ help_message =<<-EOF
10
+
11
+ Usage: polycom user:pass@1.2.3.4 [options]
12
+
13
+ Options:
14
+ -i Fetches device, network and active call information from the phone
15
+ -n Prints notifications from the phone
16
+ -data Pushes specified DATA to phone
17
+ -url Pushes specified URL to phone
18
+
19
+
20
+ Examples:
21
+ polycom admin:456@192.168.1.2 -i
22
+ polycom admin:456@192.168.1.2 -data critical "Hello World!"
23
+
24
+
25
+ EOF
26
+ puts help_message
27
+ end
28
+
29
+
30
+ if ARGV.length < 2
31
+ print_help
32
+ exit -1
33
+ end
34
+
35
+
36
+ tokens = ARGV[0].split('@')
37
+ ip_address = tokens[1]
38
+ user = tokens[0].split(':')[0]
39
+ pass = tokens[0].split(':')[1]
40
+ cmd = ARGV[1]
41
+
42
+ if ["-data", "-url"].include?(cmd) && ARGV.length < 4
43
+ print_help
44
+ exit -1
45
+ end
46
+
47
+ priority = ARGV[2]
48
+ data = ARGV[3]
49
+
50
+
51
+ case cmd
52
+ when "-data"
53
+ pusher = Polycom::Pusher.new(:username => user, :password => pass, :ip_address => ip_address)
54
+ pusher.send(:priority => priority, :data => data)
55
+
56
+ when "-url"
57
+ pusher = Polycom::Pusher.new(:username => user, :password => pass, :ip_address => ip_address)
58
+ pusher.send(:priority => priority, :url => data)
59
+
60
+ when "-i"
61
+ poller = Polycom::Poller.new(
62
+ :username => user,
63
+ :password => pass,
64
+ :ip_address => ip_address
65
+ )
66
+ device_info = poller.device_information
67
+ network_info = poller.network_information
68
+ call_line_info = poller.call_line_info
69
+
70
+ puts "\nDevice Information\n--------------------"
71
+ device_info.each_pair { |key, val| puts " #{key.to_s.ljust(20)}:\t #{val}" }
72
+ puts "\n"
73
+
74
+ puts "\nNetwork Information\n--------------------"
75
+ network_info.each_pair { |key, val| puts " #{key.to_s.ljust(20)}:\t #{val}" }
76
+ puts "\n"
77
+
78
+ puts "\nCall Line Information\n-----------------------"
79
+ call_line_info.each do |line|
80
+ puts ' -'
81
+ line.each_pair do |key, val|
82
+ if key.to_s == 'call_info'
83
+ puts "\n call_info:"
84
+ val.each_pair { |key, val| puts " #{key.to_s.ljust(20)}:\t #{val}" }
85
+ else
86
+ puts " #{key.to_s.ljust(20)}:\t #{val}"
87
+ end
88
+ end
89
+ puts ' -'
90
+ end
91
+
92
+ when "-n"
93
+ ip = Socket.ip_address_list.find {|a| !a.ipv4_loopback?}
94
+
95
+ puts "\n\nIMPORTANT:\nSet up your Polycom phone to send 'Telephony Event Notification' to http://#{ip.ip_address}:4567.\nPlease CRTL-C to end this script.\n\n"
96
+ Polycom::Receiver.run!
97
+
98
+ else
99
+ puts "ERROR: Unknown command switch"
100
+
101
+ end
102
+
103
+
data/bin/test ADDED
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require '../lib/polycom/pusher'
4
+ require '../lib/polycom/poller'
5
+ require '../lib/polycom/receiver'
6
+
7
+
8
+ def print_help
9
+ help_message =<<-EOF
10
+
11
+ Usage: polycom user:pass@1.2.3.4 [options]
12
+
13
+ Options:
14
+ -i Fetches device, network and active call information from the phone
15
+ -n Prints notifications from the phone
16
+ -data Pushes specified DATA to phone
17
+ -url Pushes specified URL to phone
18
+
19
+
20
+ Examples:
21
+ polycom admin:456@192.168.1.2 -i
22
+ polycom admin:456@192.168.1.2 -data critical "Hello World!"
23
+
24
+
25
+ EOF
26
+ puts help_message
27
+ end
28
+
29
+
30
+ if ARGV.length < 2
31
+ print_help
32
+ exit -1
33
+ end
34
+
35
+
36
+ tokens = ARGV[0].split('@')
37
+ ip_address = tokens[1]
38
+ user = tokens[0].split(':')[0]
39
+ pass = tokens[0].split(':')[1]
40
+ cmd = ARGV[1]
41
+
42
+ if ["-data", "-url"].include?(cmd) && ARGV.length < 4
43
+ print_help
44
+ exit -1
45
+ end
46
+
47
+ priority = ARGV[2]
48
+ data = ARGV[3]
49
+
50
+
51
+ case cmd
52
+ when "-data"
53
+ pusher = Polycom::Pusher.new(:username => user, :password => pass, :ip_address => ip_address)
54
+ pusher.send(:priority => priority, :data => data)
55
+
56
+ when "-url"
57
+ pusher = Polycom::Pusher.new(:username => user, :password => pass, :ip_address => ip_address)
58
+ pusher.send(:priority => priority, :url => data)
59
+
60
+ when "-i"
61
+ poller = Polycom::Poller.new(
62
+ :username => user,
63
+ :password => pass,
64
+ :ip_address => ip_address
65
+ )
66
+ device_info = poller.device_information
67
+ network_info = poller.network_information
68
+ call_line_info = poller.call_line_info
69
+
70
+ puts "\nDevice Information\n--------------------"
71
+ device_info.each_pair { |key, val| puts " #{key.to_s.ljust(20)}:\t #{val}" }
72
+ puts "\n"
73
+
74
+ puts "\nNetwork Information\n--------------------"
75
+ network_info.each_pair { |key, val| puts " #{key.to_s.ljust(20)}:\t #{val}" }
76
+ puts "\n"
77
+
78
+ puts "\nCall Line Information\n-----------------------"
79
+ call_line_info.each do |line|
80
+ puts ' -'
81
+ line.each_pair do |key, val|
82
+ if key.to_s == 'call_info'
83
+ puts "\n call_info:"
84
+ val.each_pair { |key, val| puts " #{key.to_s.ljust(20)}:\t #{val}" }
85
+ else
86
+ puts " #{key.to_s.ljust(20)}:\t #{val}"
87
+ end
88
+ end
89
+ puts ' -'
90
+ end
91
+
92
+ when "-n"
93
+ ip = Socket.ip_address_list.find {|a| !a.ipv4_loopback?}
94
+
95
+ puts "\n\nIMPORTANT:\nSet up your Polycom phone to send 'Telephony Event Notification' to http://#{ip.ip_address}:4567.\nPlease CRTL-C to end this script.\n\n"
96
+ Polycom::Receiver.run!
97
+
98
+ else
99
+ puts "ERROR: Unknown command switch"
100
+
101
+ end
102
+
103
+
data/lib/polycom.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "polycom/version"
2
+
3
+ module Polycom
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,107 @@
1
+ require 'ostruct'
2
+ require 'uri'
3
+ require 'net/http'
4
+ require 'net/http/digest_auth'
5
+ require 'rexml/document'
6
+
7
+ module Polycom
8
+
9
+ class Poller
10
+ attr_accessor :username, :password, :ip_address
11
+
12
+ def initialize(args)
13
+ args.each do |k, v|
14
+ instance_variable_set("@#{k}", v) unless v.nil?
15
+ end
16
+ end
17
+
18
+ def device_information
19
+ xml = fetch_xml('deviceHandler')
20
+ node = xml.elements["PolycomIPPhone/DeviceInformation"]
21
+
22
+ h = {}
23
+ h[:mac_address] = node.elements["MACAddress"].text
24
+ h[:phone_dn] = node.elements["PhoneDN"].text
25
+ h[:app_load_id] = node.elements["AppLoadID"].text
26
+ h[:updater_id] = node.elements["UpdaterID"].text
27
+ h[:model_number] = node.elements["ModelNumber"].text
28
+ h[:timestamp] = node.elements["TimeStamp"].text
29
+
30
+ h
31
+ end
32
+
33
+ def network_information
34
+ xml = fetch_xml('networkHandler')
35
+ node = xml.elements["PolycomIPPhone/NetworkConfiguration"]
36
+
37
+ h = {}
38
+ h[:dhcp_server] = node.elements["DHCPServer"].text
39
+ h[:mac_address] = node.elements["MACAddress"].text
40
+ h[:dns_suffix] = node.elements["DNSSuffix"].text
41
+ h[:ip_address] = node.elements["IPAddress"].text
42
+ h[:subnet_mask] = node.elements["SubnetMask"].text
43
+ h[:provisioning_server] = node.elements["ProvServer"].text
44
+ h[:default_router] = node.elements["DefaultRouter"].text
45
+ h[:dns_server1] = node.elements["DNSServer1"].text
46
+ h[:dns_server2] = node.elements["DNSServer2"].text
47
+ h[:vlan_id] = node.elements["VLANID"].text
48
+ h[:dhcp_enabled] = node.elements["DHCPEnabled"].text
49
+
50
+ h
51
+ end
52
+
53
+ def call_line_info
54
+ xml = fetch_xml('callstateHandler')
55
+ list = []
56
+
57
+ xml.elements.each('PolycomIPPhone/CallLineInfo') do |node|
58
+ h = {}
59
+ h[:line_key_num] = node.elements["LineKeyNum"].text
60
+ h[:line_dir_num] = node.elements["LineDirNum"].text
61
+ h[:line_state] = node.elements["LineState"].text
62
+
63
+ unless node.elements["CallInfo"].nil?
64
+ h[:call_info] = {}
65
+ h[:call_info][:call_state] = node.elements["CallInfo/CallState"].text
66
+ h[:call_info][:call_type] = node.elements["CallInfo/CallType"].text
67
+ h[:call_info][:ui_appearance_index] = node.elements["CallInfo/UIAppearanceIndex"].text
68
+ h[:call_info][:called_party_name] = node.elements["CallInfo/CalledPartyName"].text
69
+ h[:call_info][:called_party_dir_num] = node.elements["CallInfo/CalledPartyDirNum"].text
70
+ h[:call_info][:calling_party_name] = node.elements["CallInfo/CallingPartyName"].text
71
+ h[:call_info][:calling_party_dir_num] = node.elements["CallInfo/CallingPartyDirNum"].text
72
+ h[:call_info][:call_reference] = node.elements["CallInfo/CallReference"].text
73
+ h[:call_info][:call_duration] = node.elements["CallInfo/CallDuration"].text
74
+ end
75
+
76
+ list << h
77
+ end
78
+
79
+ list
80
+ end
81
+
82
+
83
+ private
84
+
85
+ def fetch_xml(slug)
86
+ digest_auth = Net::HTTP::DigestAuth.new
87
+
88
+ uri = URI.parse("http://#{@ip_address}/polling/#{slug}")
89
+ uri.user = @username
90
+ uri.password = @password
91
+
92
+ h = Net::HTTP.new uri.host, uri.port
93
+ req = Net::HTTP::Get.new uri.request_uri
94
+ res = h.request req
95
+
96
+ auth = digest_auth.auth_header(uri, res['www-authenticate'], 'GET')
97
+ req = Net::HTTP::Get.new(uri.request_uri)
98
+ req.add_field 'Authorization', auth
99
+ #req.add_field 'Content-Type', 'application/x-com-polycom-spipx'
100
+
101
+ resp = h.request(req)
102
+ doc = REXML::Document.new(resp.body)
103
+ end
104
+
105
+ end
106
+
107
+ end
@@ -0,0 +1,67 @@
1
+ require 'uri'
2
+ require 'net/http'
3
+ require 'net/http/digest_auth'
4
+
5
+ module Polycom
6
+
7
+ class Pusher
8
+ attr_accessor :username, :password, :ip_address
9
+
10
+ def initialize(args)
11
+ args.each do |k, v|
12
+ instance_variable_set("@#{k}", v) unless v.nil?
13
+ end
14
+ end
15
+
16
+
17
+ def send(h)
18
+ priority = h.fetch(:priority, :critical).to_s.capitalize
19
+ data = h.fetch(:data, nil)
20
+ url = h.fetch(:url, nil)
21
+
22
+ if data.nil? && url.nil?
23
+ raise "Either :data or :url must be passed to this method"
24
+ end
25
+
26
+ push_data(priority, data) unless data.nil?
27
+ push_url(priority, url) unless url.nil?
28
+ end
29
+
30
+
31
+ private
32
+
33
+ def push_data(priority, data)
34
+ resp = send_http "<PolycomIPPhone><Data priority=\"#{priority}\">#{data}</Data></PolycomIPPhone>"
35
+ raise "Polycom phone at #{@ip_address} said: [#{resp.code}] #{resp.message}" unless resp.code == '200'
36
+ end
37
+
38
+
39
+ def push_url(priority, url)
40
+ resp = send_http "<PolycomIPPhone><URL priority=\"#{priority}\">#{url}</URL></PolycomIPPhone>", true
41
+ raise "Polycom phone at #{@ip_address} said: [#{resp.code}] #{resp.message}" unless resp.code == '200'
42
+ end
43
+
44
+
45
+ def send_http(data, url = false)
46
+ digest_auth = Net::HTTP::DigestAuth.new
47
+
48
+ uri = URI.parse("http://#{@ip_address}/push")
49
+ uri.user = @username
50
+ uri.password = @password
51
+
52
+ h = Net::HTTP.new uri.host, uri.port
53
+ req = Net::HTTP::Post.new uri.request_uri
54
+ res = h.request req
55
+
56
+ auth = digest_auth.auth_header(uri, res['www-authenticate'], 'POST')
57
+ req = Net::HTTP::Post.new(uri.request_uri)
58
+ req.add_field 'Authorization', auth
59
+ req.add_field 'Content-Type', 'application/x-com-polycom-spipx' if url
60
+ req.body = data
61
+
62
+ resp = h.request(req)
63
+ end
64
+
65
+ end
66
+
67
+ end
@@ -0,0 +1,19 @@
1
+ require 'sinatra'
2
+ require 'active_support/core_ext/hash'
3
+ require 'yaml'
4
+
5
+
6
+ module Polycom
7
+
8
+ class Receiver < Sinatra::Base
9
+
10
+ set :bind, '0.0.0.0'
11
+ set :logging, false
12
+
13
+ post '/' do
14
+ puts Hash.from_xml(request.body.read).to_yaml
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,3 @@
1
+ module Polycom
2
+ VERSION = "0.1.0"
3
+ end
data/polycom.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'polycom/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "polycom"
8
+ spec.version = Polycom::VERSION
9
+ spec.authors = ["Sumit Birla"]
10
+ spec.email = ["sbirla@tampahost.net"]
11
+ spec.description = %q{Library and utility for interacting with Polycom IP Phones}
12
+ spec.summary = %q{Uses web-api of Polycom phones to do data push, read notifications and retrieve configuration information}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = ["polycom"]
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "sinatra"
24
+ spec.add_dependency "net-http-digest_auth"
25
+ spec.add_dependency "activesupport"
26
+ end
@@ -0,0 +1,18 @@
1
+ require 'test/unit'
2
+ require 'polycom/poller'
3
+
4
+ class PollerTest < Test::Unit::TestCase
5
+
6
+ def setup
7
+ @poller = Polycom::Poller.new(:username => 'admin', :password => '456', :ip_address => '1.2.3.4')
8
+ end
9
+
10
+ def test_poller_creation
11
+ assert_equal @poller.username, 'admin'
12
+ end
13
+
14
+ def test_poller_call
15
+ "YES"
16
+ end
17
+
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'test/unit'
2
+ require 'polycom/pusher'
3
+
4
+ class PusherTest < Test::Unit::TestCase
5
+
6
+ def setup
7
+ @pusher = Polycom::Pusher.new(:username => 'admin', :password => '456', :ip_address => '1.2.3.4')
8
+ end
9
+
10
+ def test_pusher_creation
11
+ assert_equal @pusher.username, 'admin'
12
+ end
13
+
14
+ def test_pusher_call
15
+ "YES"
16
+ end
17
+
18
+ end
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: polycom
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sumit Birla
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sinatra
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: net-http-digest_auth
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Library and utility for interacting with Polycom IP Phones
84
+ email:
85
+ - sbirla@tampahost.net
86
+ executables:
87
+ - polycom
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - .gitignore
92
+ - Gemfile
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - bin/polycom
97
+ - bin/test
98
+ - lib/polycom.rb
99
+ - lib/polycom/poller.rb
100
+ - lib/polycom/pusher.rb
101
+ - lib/polycom/receiver.rb
102
+ - lib/polycom/version.rb
103
+ - polycom.gemspec
104
+ - test/test_poller.rb
105
+ - test/test_pusher.rb
106
+ homepage: ''
107
+ licenses:
108
+ - MIT
109
+ metadata: {}
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubyforge_project:
126
+ rubygems_version: 2.0.3
127
+ signing_key:
128
+ specification_version: 4
129
+ summary: Uses web-api of Polycom phones to do data push, read notifications and retrieve
130
+ configuration information
131
+ test_files:
132
+ - test/test_poller.rb
133
+ - test/test_pusher.rb
134
+ has_rdoc: