require 'net/http' require 'uri' require 'json' require 'yaml' module Onering module API module Errors class NotConnected < Exception; end class ClientError < Exception; end end class Base class<= 400 rv = JSON.load(response.body) if rv['errors'] msg = "#{rv['errors']['type']}: #{rv['errors']['message']}" end raise ClientError.new(msg) else rv = JSON.load(response.body) end rv end def make_filter(filter) filter = filter.collect{|k,v| "#{k}/#{v}" } if filter.is_a?(Hash) filter = filter.collect{|i| i.sub(':','/') }.join("/") if filter.is_a?(Array) filter end def echo(obj) if obj.is_a?(Array) obj.each do |i| puts i end end end end end end end