Example #1
0
 /**
  * Page through search result sets. Returns events for given $searchId
  * @param $searchId
  * @param $pageCursor
  * @param null $userId
  * @param null $userEmail
  * @return array|bool
  */
 public function result($searchId, $pageCursor, $userId = null, $userEmail = null)
 {
     try {
         $this->response = $this->search->result($searchId, $pageCursor, $userId, $userEmail);
     } catch (JsonApiResponseException $e) {
         $this->errorMessages[$e->getCode()] = sprintf('%s - %s', $e->getApiCode(), $e->getMessage());
         return false;
     } catch (\Exception $e) {
         $this->errorMessages[$e->getCode()] = $e->getMessage();
         return false;
     }
     return $this->response->getEvents();
 }
Example #2
0
 public function testResult()
 {
     $transport = new \Echosign\Transports\GuzzleTransport();
     $client = $transport->getClient();
     // mock the request
     $json = '{
       "events": [
         {
           "agreementAssetId": "2BAABLblqZhARJcIh9hAZIrdTii8G2wvQzCNPWf9x7Mb83vrC6TzIlBunHE2m9f-qenIfQ9Vl2aE*",
           "agreementAssetName": "grid math.pdf",
           "agreementAssetType": "agreement",
           "documentHistoryEvent": {
             "actingUserEmail": "*****@*****.**",
             "date": "2014-10-21T09:40:00-07:00",
             "description": "Sent out for signature to test@gmail.com",
             "participantEmail": "*****@*****.**",
             "type": "SIGNATURE_REQUESTED"
           }
         }
       ],
       "nextPageCursor": "BwELAQYAAgEAAAICABC3ZbmoWj1h0-Yh4J_rTKgWDqg3GHWhshZTliKBxcTxfLM6jDjlKoH4Kg**"
     }';
     $jsonArray = json_decode($json, true);
     $stream = Stream::factory($json);
     $mock = new Mock([new Response(200, ['content-type' => 'application/json'], $stream)]);
     $client->getEmitter()->attach($mock);
     #$log = new Monolog\Logger('test');
     #$handler = new Monolog\Handler\TestHandler();
     #$log->pushHandler( $handler );
     $search = new Search('123465', $transport);
     #$search->setLogger( $log );
     $response = $search->result('search_id_doesnt_matter', 'lame_page_cursor');
     $this->assertInstanceOf('Echosign\\Responses\\AgreementAssetEventGetResponse', $response);
     $events = $response->getEvents();
     $this->assertEquals(1, count($events));
     $this->assertEquals($jsonArray['nextPageCursor'], $response->getNextPageCursor());
     //print_r( $handler->getRecords() );
 }