Sha256: 35d2dbb67c01e0a61a9457a396c8602333b9e8e84418ceab9b45adefaa5e599f
Contents?: true
Size: 1.53 KB
Versions: 2
Compression:
Stored size: 1.53 KB
Contents
# Copyright © 2014, Evercam. module Evercam module Logs # This method fetches activity log details for a specified camera from # the system. # # ==== Parameters # camera_id:: The unique identifier of the camera to fetch the logs for. # options:: A Hash of additional parameters for the request. Currently # recognised keys for this request are :from, :to, :limit, # :page, :types and :objects. def get_logs(camera_id, options={}) parameters = {} parameters[:from] = options[:from].to_i if options.include?(:from) parameters[:to] = options[:to].to_i if options.include?(:to) parameters[:limit] = options[:limit] if options.include?(:limit) parameters[:page] = options[:page] if options.include?(:page) if options.include?(:types) values = options[:types] if values.kind_of?(Array) parameters[:types] = options[:types].join(",") else parameters[:types] = options[:types] end end parameters[:objects] = (options[:objects] == true) if options.include?(:objects) data = handle_response(call("/cameras/#{camera_id}/logs", :get, parameters)) if !data.include?("logs") || !data.include?("pages") message = "Invalid response received from server." @logger.error message raise EvercamError.new(message) end {logs: data["logs"], pages: data["pages"]} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
evercam-0.1.2 | lib/evercam/logs.rb |
evercam-0.1.1 | lib/evercam/logs.rb |