Class: KodiClient::Methods::Profiles

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

Overview

contains all Kodi Application methods

Constant Summary collapse

GET_CURRENT_PROFILE =
'Profiles.GetCurrentProfile'
GET_PROFILES =
'Profiles.GetProfiles'
LOAD_PROFILE =
'Profiles.LoadProfile'

Instance Method Summary collapse

Methods inherited from KodiMethod

#apply_options, #invoke_api

Instance Method Details

#get_current_profile(properties = Types::Profiles::FieldsProfile.all_properties, kodi_id = 1) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/kodi_client/methods/profiles.rb', line 12

def get_current_profile(properties = Types::Profiles::FieldsProfile.all_properties, kodi_id = 1)
  request = KodiRequest.new(kodi_id, GET_CURRENT_PROFILE, { 'properties' => properties })
  json = invoke_api(request)
  result = Types::Profiles::DetailsProfile.create(json['result'])
  json['result'] = result
  KodiResponse.new(json)
end

#get_profiles(properties = Types::Profiles::FieldsProfile.all_properties, limits = Types::List::ListLimits.new(0, 50), sort = Types::List::ListSort.new, kodi_id = 1) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/kodi_client/methods/profiles.rb', line 20

def get_profiles(properties = Types::Profiles::FieldsProfile.all_properties,
                 limits = Types::List::ListLimits.new(0, 50),
                 sort = Types::List::ListSort.new, kodi_id = 1)
  request = KodiRequest.new(kodi_id, GET_PROFILES,
                            { 'properties' => properties,
                              'limits' => limits.to_h,
                              'sort' => sort.to_h })
  json = invoke_api(request)
  result = Types::Profiles::GetProfilesReturned.create(json['result'])
  json['result'] = result
  KodiResponse.new(json)
end

#load_profile(profile_name, password, prompt = false, kodi_id = 1) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/kodi_client/methods/profiles.rb', line 33

def load_profile(profile_name, password, prompt = false, kodi_id = 1)
  request = KodiRequest.new(kodi_id, LOAD_PROFILE,
                            { 'profile' => profile_name,
                              'password' => { 'value' => password.value, 'encryption' => password.encryption },
                              'prompt' => prompt })
  json = invoke_api(request)
  KodiResponse.new(json)
end