Class: Xbmc::Command

Inherits:
Object show all
Defined in:
lib/xbmc/command.rb

Overview

Representation of a XBMC JSON RPC method

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_meta) ⇒ Command

Initializes a new command from the meta data hash given in JSONRPC.Introspect



6
7
8
9
10
11
# File 'lib/xbmc/command.rb', line 6

def initialize(command_meta)
  @command_meta = command_meta.with_indifferent_access
  @description = command_meta[:description]
  @command = command_meta[:command]
  parse_command!
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



3
4
5
# File 'lib/xbmc/command.rb', line 3

def command
  @command
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/xbmc/command.rb', line 3

def description
  @description
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



3
4
5
# File 'lib/xbmc/command.rb', line 3

def method_name
  @method_name
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



3
4
5
# File 'lib/xbmc/command.rb', line 3

def namespace
  @namespace
end

#original_methodObject (readonly)

Returns the value of attribute original_method.



3
4
5
# File 'lib/xbmc/command.rb', line 3

def original_method
  @original_method
end

Instance Method Details

#invoke(params = {}) ⇒ Object

Invokes this command and processes the result



14
15
16
# File 'lib/xbmc/command.rb', line 14

def invoke(params={})
  process_result(Xbmc.invoke_and_process(command, params))
end

#klass_nameObject

The ruby class name this command should end up in



19
20
21
# File 'lib/xbmc/command.rb', line 19

def klass_name
  "Xbmc::#{namespace}"
end