Class: KodiClient::KodiMethod
- Inherits:
-
Object
- Object
- KodiClient::KodiMethod
- Defined in:
- lib/kodi_client/kodi_method.rb
Overview
the client that stores
Direct Known Subclasses
Methods::Addons, Methods::Application, Methods::AudioLibrary, Methods::Favourites, Methods::Files, Methods::GUI, Methods::Input, Methods::Player, Methods::Profiles, Methods::System, Methods::VideoLibrary
Instance Method Summary collapse
Instance Method Details
#apply_options(options) ⇒ Object
8 9 10 11 |
# File 'lib/kodi_client/kodi_method.rb', line 8 def () @endpoint_url = "#{.tls ? 'https://' : 'http://'}#{.ip}:#{.port}/jsonrpc" @options = end |
#invoke_api(request) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/kodi_client/kodi_method.rb', line 13 def invoke_api(request) h = request.instance_variables.each_with_object({}) do |var, hash| hash[var.to_s.delete('@')] = request.instance_variable_get(var) end @http_client ||= build_client response = @http_client.post(@endpoint_url, json: h).to_s JSON.parse(response) end |