Sha256: b0e50b666ea5316adada9f96c4e18f7e050399e2349c77f8cf35ebeeba099784
Contents?: true
Size: 1.07 KB
Versions: 31
Compression:
Stored size: 1.07 KB
Contents
module Onering class API class Devices < API def show(id) get("/devices/#{id}").parsed_response end def get_field(id, field) get("/devices/#{id}/get/#{field}").response.body end def set_field(id, field, value) get("/devices/#{id}/set/#{field}/#{value}").response.body end def list(field, options={ :unique => true, :sort => true, :filter => nil }) qs = { :q => make_filter(options[:filter]) } if options[:filter] rv = get("/devices/list/#{field}", { :query => qs }).parsed_response rv = rv.uniq if options[:unique] rv = rv.sort if options[:sort] return rv end def find(filter, options={}) get("/devices/find/#{make_filter(filter)}").parsed_response end def save(id, data=nil, &block) if block_given? post("/devices/#{id}", {}, &block) else post("/devices/#{id}", { :body => data }) end end end end end
Version data entries
31 entries across 31 versions & 1 rubygems