def _get_json_table(console, address, parameters = {}, page_size = 500, records = nil, post = true)
      parameters['dir']        = 'DESC'
      parameters['startIndex'] = -1
      parameters['results']    = -1
      if post
        request = lambda { |p| AJAX.form_post(console, address, p) }
      else
        request = lambda { |p| AJAX.get(console, address.dup, AJAX::CONTENT_TYPE::JSON, p) }
      end

      response = request.call(parameters)
      data     = JSON.parse(response)
      # Don't attept to grab more records than there are.
      total = data['totalRecords']
      return [] if total.zero?
      total = records.nil? ? total : [records, total].min
      rows  = []
      parameters['results'] = page_size
      while rows.length < total
        parameters['startIndex'] = rows.length
        data = JSON.parse(request.call(parameters))
        rows.concat data['records']
      end
      rows
    end
def _get_json_table(console, address, parameters = {}, page_size = 500, records = nil, post = true)
      parameters['dir']        = 'DESC'
      parameters['startIndex'] = -1
      parameters['results']    = -1
      if post
        request = lambda { |p| AJAX.form_post(console, address, p) }
      else
        request = lambda { |p| AJAX.get(console, address.dup, AJAX::CONTENT_TYPE::JSON, p) }
      end

      response = request.call(parameters)
      data     = JSON.parse(response)
      # Don't attept to grab more records than there are.
      total = data['totalRecords']
      return [] if total.zero?
      total = records.nil? ? total : [records, total].min
      rows  = []
      parameters['results'] = page_size
      while rows.length < total
        parameters['startIndex'] = rows.length
        data = JSON.parse(request.call(parameters))
        rows.concat data['records']
      end
      rows
    end
Helper method to get the YUI tables into a consumable Ruby object.

 @param [Connection] console API connection to a Nexpose console.
 @param [String] address Controller address relative to https://host:port
 @param [Hash] parameters Parameters that need to be sent to the controller
    The following attributes may need to be provided:
      'sort' Column to sort by
      'table-id' The ID of the table to get from this controller
 @param [Fixnum] page_size Number of records to include per page.
   Value must conform to supported defaults: -1, 10, 25, 50, 100, 500.
 @param [Fixnum] records number of records to return, gets all if not
   specified.
 @param [Boolean] post Whether to use form post or get to retrieve data.
 @return [Array[Hash]] An array of hashes representing the requested table.

 Example usage:
   DataTable._get_json_table(@console,
                             '/data/asset/site',
                             { 'sort' => 'assetName',
                               'table-id' => 'site-assets',
                               'siteID' => site_id })