Class: KodiClient::Methods::System

Inherits:
KodiMethod show all
Defined in:
lib/kodi_client/methods/system.rb

Overview

contains all Kodi System methods

Constant Summary collapse

EJECT_OPTICAL_DRIVE =
'System.EjectOpticalDrive'
GET_PROPERTIES =
'System.GetProperties'
HIBERNATE =
'System.Hibernate'
REBOOT =
'System.Reboot'
SHUTDOWN =
'System.Shutdown'
SUSPEND =
'System.Suspend'

Instance Method Summary collapse

Methods inherited from KodiMethod

#apply_options, #invoke_api

Instance Method Details

#eject_optical_drive(kodi_id = 1) ⇒ Object



15
16
17
18
19
# File 'lib/kodi_client/methods/system.rb', line 15

def eject_optical_drive(kodi_id = 1)
  request = KodiRequest.new(kodi_id, EJECT_OPTICAL_DRIVE, {})
  json = invoke_api(request)
  KodiResponse.new(json)
end

#get_properties(properties = Types::System::PropertyName.all_properties, kodi_id = 1) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/kodi_client/methods/system.rb', line 21

def get_properties(properties = Types::System::PropertyName.all_properties, kodi_id = 1)
  request = KodiRequest.new(kodi_id, GET_PROPERTIES, { 'properties' => properties })
  json = invoke_api(request)
  result = Types::System::PropertyValue.create(json['result'])
  json['result'] = result
  KodiResponse.new(json)
end

#hibernate(kodi_id = 1) ⇒ Object



29
30
31
32
33
# File 'lib/kodi_client/methods/system.rb', line 29

def hibernate(kodi_id = 1)
  request = KodiRequest.new(kodi_id, HIBERNATE, {})
  json = invoke_api(request)
  KodiResponse.new(json)
end

#reboot(kodi_id = 1) ⇒ Object



35
36
37
38
39
# File 'lib/kodi_client/methods/system.rb', line 35

def reboot(kodi_id = 1)
  request = KodiRequest.new(kodi_id, REBOOT, {})
  json = invoke_api(request)
  KodiResponse.new(json)
end

#shutdown(kodi_id = 1) ⇒ Object



41
42
43
44
45
# File 'lib/kodi_client/methods/system.rb', line 41

def shutdown(kodi_id = 1)
  request = KodiRequest.new(kodi_id, SHUTDOWN, {})
  json = invoke_api(request)
  KodiResponse.new(json)
end

#suspend(kodi_id = 1) ⇒ Object



47
48
49
50
51
# File 'lib/kodi_client/methods/system.rb', line 47

def suspend(kodi_id = 1)
  request = KodiRequest.new(kodi_id, SUSPEND, {})
  json = invoke_api(request)
  KodiResponse.new(json)
end