Class: XBMC::Remote
- Inherits:
-
Object
- Object
- XBMC::Remote
- Defined in:
- lib/xbmc/remote.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
Instance Method Summary collapse
- #commands ⇒ Object
-
#initialize(xbmc_address) ⇒ Remote
constructor
A new instance of Remote.
- #send_command(method_name, params = {}) ⇒ Object
Constructor Details
#initialize(xbmc_address) ⇒ Remote
Returns a new instance of Remote.
7 8 9 |
# File 'lib/xbmc/remote.rb', line 7 def initialize(xbmc_address) self.address = xbmc_address end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
5 6 7 |
# File 'lib/xbmc/remote.rb', line 5 def address @address end |
Instance Method Details
#commands ⇒ Object
18 19 20 21 |
# File 'lib/xbmc/remote.rb', line 18 def commands response = HTTParty.get(base_address) response["methods"].map { |name, json| "#{name}: #{json["description"]}" } end |
#send_command(method_name, params = {}) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/xbmc/remote.rb', line 11 def send_command(method_name, params={}) HTTParty.post(base_address, :body => {:id => get_id, :method => method_name, :params => params, :jsonrpc => "2.0",}.to_json, :headers => { 'Content-Type' => 'application/json' }, ) end |