module Roku::Client

Constants

KEYS

Public Class Methods

active_app() click to toggle source
# File lib/roku/client.rb, line 49
def active_app
  app = get('/query/active-app').parsed_response['active_app']['app']
  App.parse(app)
end
apps() click to toggle source
# File lib/roku/client.rb, line 43
def apps
  get('/query/apps').parsed_response['apps']['app'].map do |app|
    App.parse(app)
  end
end
device_info() click to toggle source
# File lib/roku/client.rb, line 54
def device_info
  get('/query/device-info').parsed_response['device_info']
end
find_device!() click to toggle source
# File lib/roku/client.rb, line 38
def find_device!
  address = ENV.fetch('ROKU_HOST') { Roku::Discover.search }
  base_uri(address)
end
input(options = {}) click to toggle source
# File lib/roku/client.rb, line 96
def input(options = {})
  post('/input', options)
end
install(app_id) click to toggle source
# File lib/roku/client.rb, line 70
def install(app_id)
  post("/install/#{app_id}").success?
end
keydown(key) click to toggle source
# File lib/roku/client.rb, line 86
def keydown(key)
  return unless KEYS.include?(key.to_sym)
  post("/keydown/#{key}").success?
end
keypress(key) click to toggle source
# File lib/roku/client.rb, line 81
def keypress(key)
  return unless KEYS.include?(key.to_sym)
  post("/keypress/#{key}").success?
end
keyup(key) click to toggle source
# File lib/roku/client.rb, line 91
def keyup(key)
  return unless KEYS.include?(key.to_sym)
  post("/keyup/#{key}").success?
end
launch(app_id) click to toggle source
# File lib/roku/client.rb, line 66
def launch(app_id)
  post("/launch/#{app_id}").success?
end
send_text(string) click to toggle source
# File lib/roku/client.rb, line 74
def send_text(string)
  string.split('').map do |c|
    next if c == ' '
    post("/keypress/#{c}").success?
  end.all?
end
tv_active_channel() click to toggle source
# File lib/roku/client.rb, line 62
def tv_active_channel
  get('/query/tv-active-channel').parsed_response['tv_channel']
end
tv_channels() click to toggle source
# File lib/roku/client.rb, line 58
def tv_channels
  get('/query/tv-channels').parsed_response['tv_channels']
end