Class: Nibble::Client
- Inherits:
-
Object
- Object
- Nibble::Client
- Defined in:
- lib/nibble/client.rb
Constant Summary collapse
- METHODS =
%i(leds tts ears ears_mode ears_random ears_reset squeezebox radio_list sound_list sound sound_control wakeup sleep get_version status voice_list display_cache clear_cache)
Instance Method Summary collapse
- #execute(method, options = {}) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #say(text, options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 12 |
# File 'lib/nibble/client.rb', line 6 def initialize @conn = Faraday.new(url: "http://#{Config[:connection][:ip]}") do |faraday| faraday.request(:url_encoded) faraday.response(:logger) faraday.adapter(Faraday.default_adapter) end end |
Instance Method Details
#execute(method, options = {}) ⇒ Object
27 28 29 30 |
# File 'lib/nibble/client.rb', line 27 def execute(method, = {}) response = @conn.get("/cgi-bin/#{method}", ) JSON.parse(response.body) end |
#say(text, options = {}) ⇒ Object
23 24 25 |
# File 'lib/nibble/client.rb', line 23 def say(text, = {}) tts(.merge(text: text)) end |