Moved code into methods on PuppetDB::Connection class