Class: RSynology::Client::SurveillanceStationEvent

Inherits:
API
  • Object
show all
Defined in:
lib/rsynology/client/surveillance_station_event.rb

Defined Under Namespace

Classes: Event

Instance Attribute Summary

Attributes inherited from API

#client, #endpoint, #maxVersion, #minVersion, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from API

#api_name, #initialize, #request

Constructor Details

This class inherits a constructor from RSynology::Client::API

Class Method Details

.api_nameObject



25
26
27
# File 'lib/rsynology/client/surveillance_station_event.rb', line 25

def self.api_name
  'SYNO.SurveillanceStation.Event'
end

Instance Method Details

#query(params = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rsynology/client/surveillance_station_event.rb', line 29

def query(params = {})
  default_params = {
    offset: 0,
    limit: 10,
    mode: nil,
    locked: nil,
    camera_ids: nil,
    from_time: nil,
    to_time: nil
  }

  merged_params = default_params.merge(params).reject do |k, v|
    v.nil?
  end

  resp = request("Query", merged_params)
  event_collection = handle_response(resp)
  event_collection['events'].map! { |event_data| Event.new(event_data) }
  event_collection
end