class Dasher::Client
Attributes
host[R]
port[R]
ssl[R]
token[R]
Public Class Methods
new(host, token, options = {})
click to toggle source
# File lib/dasher/client.rb, line 8 def initialize(host, token, options = {}) @host = host @token = token @port = options[:port] @ssl = options[:ssl] end
Public Instance Methods
add_list_item(square, identifier, properties = {})
click to toggle source
# File lib/dasher/client.rb, line 29 def add_list_item(square, identifier, properties = {}) api.lists.add!(:square => square, :identifier => identifier, :properties => properties) end
insert_list_item(square, index, identifier, properties = {})
click to toggle source
# File lib/dasher/client.rb, line 33 def insert_list_item(square, index, identifier, properties = {}) api.lists.add!(:square => square, :index => index, :identifier => identifier, :properties => properties) end
replace_list(square, items = [])
click to toggle source
# File lib/dasher/client.rb, line 37 def replace_list(square, items = []) api.lists.replace!(:square => square, :items => items) rescue MoonropeClient::RequestError => e puts e.result.data end
screen(id)
click to toggle source
# File lib/dasher/client.rb, line 19 def screen(id) api.screens.details!(:id => id).data end
screens()
click to toggle source
# File lib/dasher/client.rb, line 15 def screens api.screens.list!.data end
update_property(square, key, value)
click to toggle source
# File lib/dasher/client.rb, line 23 def update_property(square, key, value) api.squares.update_property!(:square => square, :key => key, :value => value).data rescue MoonropeClient::RequestError => e e.result.data["code"] == "ValidationError" ? false : raise end
Private Instance Methods
api()
click to toggle source
# File lib/dasher/client.rb, line 45 def api @client ||= begin MoonropeClient::Connection.new(host, :headers => {'X-Auth-Token' => token}, :ssl => port == 443, :port => port) end end