Class: Nibble::Client

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializeClient

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, options = {})
  response = @conn.get("/cgi-bin/#{method}", options)
  JSON.parse(response.body)
end

#say(text, options = {}) ⇒ Object



23
24
25
# File 'lib/nibble/client.rb', line 23

def say(text, options = {})
  tts(options.merge(text: text))
end