Class: Polycom::Poller
- Inherits:
-
Object
- Object
- Polycom::Poller
- Defined in:
- lib/polycom/poller.rb
Instance Attribute Summary collapse
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #call_line_info ⇒ Object
- #device_information ⇒ Object
-
#initialize(args) ⇒ Poller
constructor
A new instance of Poller.
- #network_information ⇒ Object
Constructor Details
#initialize(args) ⇒ Poller
Returns a new instance of Poller.
12 13 14 15 16 |
# File 'lib/polycom/poller.rb', line 12 def initialize(args) args.each do |k, v| instance_variable_set("@#{k}", v) unless v.nil? end end |
Instance Attribute Details
#ip_address ⇒ Object
Returns the value of attribute ip_address.
10 11 12 |
# File 'lib/polycom/poller.rb', line 10 def ip_address @ip_address end |
#password ⇒ Object
Returns the value of attribute password.
10 11 12 |
# File 'lib/polycom/poller.rb', line 10 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
10 11 12 |
# File 'lib/polycom/poller.rb', line 10 def username @username end |
Instance Method Details
#call_line_info ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/polycom/poller.rb', line 53 def call_line_info xml = fetch_xml('callstateHandler') list = [] xml.elements.each('PolycomIPPhone/CallLineInfo') do |node| h = {} h[:line_key_num] = node.elements["LineKeyNum"].text h[:line_dir_num] = node.elements["LineDirNum"].text h[:line_state] = node.elements["LineState"].text unless node.elements["CallInfo"].nil? h[:call_info] = {} h[:call_info][:call_state] = node.elements["CallInfo/CallState"].text h[:call_info][:call_type] = node.elements["CallInfo/CallType"].text h[:call_info][:ui_appearance_index] = node.elements["CallInfo/UIAppearanceIndex"].text h[:call_info][:called_party_name] = node.elements["CallInfo/CalledPartyName"].text h[:call_info][:called_party_dir_num] = node.elements["CallInfo/CalledPartyDirNum"].text h[:call_info][:calling_party_name] = node.elements["CallInfo/CallingPartyName"].text h[:call_info][:calling_party_dir_num] = node.elements["CallInfo/CallingPartyDirNum"].text h[:call_info][:call_reference] = node.elements["CallInfo/CallReference"].text h[:call_info][:call_duration] = node.elements["CallInfo/CallDuration"].text end list << h end list end |
#device_information ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/polycom/poller.rb', line 18 def device_information xml = fetch_xml('deviceHandler') node = xml.elements["PolycomIPPhone/DeviceInformation"] h = {} h[:mac_address] = node.elements["MACAddress"].text h[:phone_dn] = node.elements["PhoneDN"].text h[:app_load_id] = node.elements["AppLoadID"].text h[:updater_id] = node.elements["UpdaterID"].text h[:model_number] = node.elements["ModelNumber"].text h[:timestamp] = node.elements["TimeStamp"].text h end |
#network_information ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/polycom/poller.rb', line 33 def network_information xml = fetch_xml('networkHandler') node = xml.elements["PolycomIPPhone/NetworkConfiguration"] h = {} h[:dhcp_server] = node.elements["DHCPServer"].text h[:mac_address] = node.elements["MACAddress"].text h[:dns_suffix] = node.elements["DNSSuffix"].text h[:ip_address] = node.elements["IPAddress"].text h[:subnet_mask] = node.elements["SubnetMask"].text h[:provisioning_server] = node.elements["ProvServer"].text h[:default_router] = node.elements["DefaultRouter"].text h[:dns_server1] = node.elements["DNSServer1"].text h[:dns_server2] = node.elements["DNSServer2"].text h[:vlan_id] = node.elements["VLANID"].text h[:dhcp_enabled] = node.elements["DHCPEnabled"].text h end |