class Tradfri::Client
Constants
- METHOD_GET
- METHOD_PUT
Public Instance Methods
connect_to(host, port, key)
click to toggle source
# File lib/tradfri/client.rb, line 17 def connect_to(host, port, key) Gateway.new(self, host, port, key) end
discover_gateways(keys)
click to toggle source
# File lib/tradfri/client.rb, line 11 def discover_gateways(keys) Service.discover.map do |service| connect_to service.host, service.port, keys[service.mac_address] end end
get(key, uri)
click to toggle source
# File lib/tradfri/client.rb, line 21 def get(key, uri) Tempfile.open do |file| args = '-k', key, '-m', METHOD_GET, '-o', file.path, uri.to_s Open3.capture3(coap_client_path, *args) file.read end end
put(key, uri, payload)
click to toggle source
# File lib/tradfri/client.rb, line 35 def put(key, uri, payload) args = '-k', key, '-m', METHOD_PUT, '-e', payload, uri.to_s Open3.capture3(coap_client_path, *args) end