Sha256: 3ff98707a0f072ad0e4064be4986dddfa43b0f778e8098151de2c940b9a85623
Contents?: true
Size: 690 Bytes
Versions: 1
Compression:
Stored size: 690 Bytes
Contents
require_relative "./commands" module Pinoccio class Scout include Commands attr_reader :troop, :id def initialize(client, troop, props) @client = client @troop = troop @id = props.id end def get(command, type=nil) run("print #{command}", type) end def run(command, type=nil) result = execute(command).reply.strip case type when :boolean result == "1" when :integer result.to_i when :json JSON.parse(result) else result end end def execute(command) @client.get("#{@troop.id}/#{@id}/command", command: command) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pinoccio-0.1.0 | lib/scout.rb |