Class: Hikvision::Streaming
- Inherits:
-
Object
- Object
- Hikvision::Streaming
- Defined in:
- lib/hikvision/streaming.rb,
lib/hikvision/streaming/channel.rb
Defined Under Namespace
Classes: Channel
Instance Method Summary collapse
- #channel(id) ⇒ Object
- #channels ⇒ Object
-
#initialize(isapi) ⇒ Streaming
constructor
A new instance of Streaming.
- #load_channels(options = {}) ⇒ Object
Constructor Details
#initialize(isapi) ⇒ Streaming
Returns a new instance of Streaming.
3 4 5 |
# File 'lib/hikvision/streaming.rb', line 3 def initialize(isapi) @isapi = isapi end |
Instance Method Details
#channel(id) ⇒ Object
11 12 13 |
# File 'lib/hikvision/streaming.rb', line 11 def channel(id) load_channels[id] end |
#channels ⇒ Object
7 8 9 |
# File 'lib/hikvision/streaming.rb', line 7 def channels load_channels.values end |
#load_channels(options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hikvision/streaming.rb', line 15 def load_channels( = {}) return @channels if .fetch(:cache, true) && instance_variable_defined?(:@channels) @channels = {} xml = @isapi.get_xml('/ISAPI/Streaming/channels', ) xml.xpath('StreamingChannelList/StreamingChannel').each do |c| channel = Channel.new(@isapi, Nokogiri::XML(c.to_s)) @channels[channel.id] = channel end @channels end |