Class: Hikvision::System

Inherits:
Base
  • Object
show all
Defined in:
lib/hikvision/system.rb,
lib/hikvision/system/face.rb,
lib/hikvision/system/time.rb,
lib/hikvision/system/person.rb,
lib/hikvision/system/reboot.rb,
lib/hikvision/system/status.rb,
lib/hikvision/system/time/ntp.rb,
lib/hikvision/system/acs_event.rb,
lib/hikvision/system/device_info.rb,
lib/hikvision/system/diagnosed_data.rb

Defined Under Namespace

Classes: Time

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(isapi) ⇒ System

Returns a new instance of System.



5
6
7
8
9
# File 'lib/hikvision/system.rb', line 5

def initialize(isapi)
  @isapi = isapi
  @network = Network.new(isapi)
  @time = Time.new(isapi)
end

Instance Attribute Details

#networkObject (readonly)

Returns the value of attribute network.



3
4
5
# File 'lib/hikvision/system.rb', line 3

def network
  @network
end

#timeObject (readonly)

Returns the value of attribute time.



3
4
5
# File 'lib/hikvision/system.rb', line 3

def time
  @time
end

Instance Method Details

#add_face(options = { cache: false }) ⇒ Object



3
4
5
# File 'lib/hikvision/system/face.rb', line 3

def add_face(options = { cache: false })
  @isapi.post('/ISAPI/Intelligent/FDLib/FaceDataRecord?format=json', options).response.body
end

#add_person(options = { cache: false }) ⇒ Object



3
4
5
# File 'lib/hikvision/system/person.rb', line 3

def add_person(options = { cache: false })
  @isapi.post('/ISAPI/AccessControl/UserInfo/Record?format=json', options).response.body
end

#delete_person(options = { cache: false }) ⇒ Object



7
8
9
# File 'lib/hikvision/system/person.rb', line 7

def delete_person(options = { cache: false })
  @isapi.put('/ISAPI/AccessControl/UserInfo/Delete?format=json', options).response.body
end

#diagnosed_data(options = { cache: false }) ⇒ Object



3
4
5
# File 'lib/hikvision/system/diagnosed_data.rb', line 3

def diagnosed_data(options = { cache: false })
  @isapi.get('/ISAPI/System/diagnosedData', options).response.body
end

#get_event(options = { cache: false }) ⇒ Object



3
4
5
# File 'lib/hikvision/system/acs_event.rb', line 3

def get_event(options = { cache: false })
  @isapi.post('/ISAPI/AccessControl/AcsEvent?format=json', options).response.body
end

#get_event_photo(url, file_path, options = { cache: false }) ⇒ Object

保存刷脸照片



8
9
10
11
12
13
# File 'lib/hikvision/system/acs_event.rb', line 8

def get_event_photo(url, file_path, options = { cache: false })
  file_content = @isapi.get_original(url, options).response.body
  File.open(file_path, 'wb') do |f|
    f.write(file_content)
  end
end

#rebootObject



3
4
5
# File 'lib/hikvision/system/reboot.rb', line 3

def reboot
  @isapi.put('/ISAPI/System/reboot')
end