Class: XBMC_JSONRPC::APIBase

Inherits:
Object
  • Object
show all
Defined in:
lib/xbmc-jsonrpc.rb

Overview

utility class for others to inherit from. For now uses method missing to make all calls to the send_command because there is no meaningful difference between namespaces / methods at the moment.

Class Method Summary collapse

Class Method Details

.commandsObject

show commands for namespace



139
140
141
# File 'lib/xbmc-jsonrpc.rb', line 139

def self.commands
  XBMC_JSONRPC.commands.keys.grep(/#{self.namespace}\./) {|command| XBMC_JSONRPC.pp_command(command) }
end

.method_missing(method, args = {}) ⇒ Object

pass on namespace + method and arguments



134
135
136
# File 'lib/xbmc-jsonrpc.rb', line 134

def self.method_missing(method, args = {})
  XBMC_JSONRPC.command("#{self.namespace}.#{method}", args)
end

.namespaceObject

get the correct api namespace to use



129
130
131
# File 'lib/xbmc-jsonrpc.rb', line 129

def self.namespace
  @namespace = @namespace || self.name.to_s.split('::')[1]
end