public function testGetInfo()
 {
     $quotes = new AssetQuotes();
     $quotes->setVendor('yahoo');
     // stock symbols must seperated by url encode commas
     $data = $quotes->getInfo('aapl%2Cmcd');
     // confirm the $data is of length 2 and first quote is for AAPL
     $this->assertTrue(count($data) === 2 && isset($data[0]['symbol']) && $data[0]['symbol'] === 'AAPL');
 }
Exemplo n.º 2
0
 public function show()
 {
     /**
      * get a list of OR single stock symbols from the front end
      * symbols should be seperated by URL encoded commas
      */
     $symbols = Input::get('symbols');
     if ($symbols === null || $symbols === '') {
         return array('status' => 400, 'message' => 'missing symbols paramater');
     }
     $quotes = new AssetQuotes();
     // optional ability to set an API thirdparty vendor, like YAHOO, Markit, ect
     $vendor = Input::get('vendor');
     // set the vendor if an over ride was given
     if ($vendor !== null && !$quotes->setVendor($vendor)) {
         return array('status' => 400, 'message' => 'invalid vendor');
     }
     return $quotes->getInfo($symbols);
 }