public function request($options)
 {
     if (count($options) < 1) {
         $this->outputAndExit('Error: you must supply the method you want to call (ex: adm request Company.GetReportSuites)');
     }
     $token = null;
     // grab the default token
     $config = $this->loadConfigFile();
     $endpoint = $this->parser->endpoint ? $this->parser->endpoint : $config['default']['endpoint'];
     foreach ($config as $clientId => $clientConf) {
         if (isset($clientConf[$endpoint]['default'])) {
             $token = $clientConf[$endpoint]['default'];
             break;
         }
         if (isset($clientConf[$endpoint]['tokens'])) {
             // grab the last token to use as a final default
             $token = array_pop($clientConf[$endpoint]['tokens']);
         }
     }
     if (!$token) {
         if ($options[0] != 'Company.GetEndpoint') {
             $this->outputAndExit('Error: No tokens found for this endpoint.  Use "authorize" method to store your credentials before making a request');
         }
     }
     $curlConf = isset($clientConf[$endpoint]) ? $clientConf[$endpoint] : array();
     $auth = new OAuth2();
     $adm = new Client(new Curl(array('endpoint' => $endpoint) + $curlConf + $config['default'], $auth));
     $adm->authenticate($token);
     $parameters = array();
     if (isset($options[1])) {
         // load parameters from file
         if (0 === strpos($options[1], 'file://')) {
             $file = substr($options[1], 7);
             if (!file_exists($file)) {
                 $this->outputAndExit(sprintf('File %s not found', $file));
             }
             $contents = trim(file_get_contents($file));
             switch (pathinfo($file, PATHINFO_EXTENSION)) {
                 case 'ini':
                     $parameters = parse_ini_string($contents);
                     break;
                 case 'xml':
                     $parameters = simplexml_load_string($contents);
                     break;
                 case 'json':
                     $parameters = json_decode($contents, 1);
                     break;
                 default:
                     parse_str($contents, $parameters);
                     break;
             }
         } else {
             // use querystring format
             parse_str($options[1], $parameters);
         }
     }
     $response = $adm->getSuiteApi()->post($options[0], $parameters);
     if (is_string($response)) {
         echo "{$response}\n";
     } elseif (is_array($response)) {
         echo $this->formatJson(json_encode($response));
     } else {
         print_r($adm->getLastResponse());
     }
 }