コード例 #1
0
 public function testCreate()
 {
     $doc = m::mock('Echosign\\Info\\DocumentCreationInfo');
     $doc->shouldReceive('toArray')->andReturn(['locale' => 'EN_US']);
     $opt = m::mock('Echosign\\Options\\InteractiveOptions');
     $opt->shouldReceive('toArray')->andReturn(['noChrome' => true]);
     $info = new AgreementCreationInfo($doc, $opt);
     $a = $info->toArray();
     $this->assertEquals('EN_US', $a['documentCreationInfo']['locale']);
     $this->assertTrue($a['options']['noChrome']);
 }
コード例 #2
0
ファイル: Agreement.php プロジェクト: nsbucky/echosign
 /**
  * @param DocumentCreationInfo $documentCreationInfo
  * @param InteractiveOptions $interactiveOptions
  * @param null $userId
  * @param null $userEmail
  * @return AgreementCreationResponse|Error
  */
 public function create(DocumentCreationInfo $documentCreationInfo, InteractiveOptions $interactiveOptions = null, $userId = null, $userEmail = null)
 {
     $this->headers = array_filter(['Content-Type' => 'application/json', 'Access-Token' => $this->token->getAccessToken(), 'X-User-Id' => $userId, 'X-User-Email' => $userEmail]);
     // set this data to be called by transport
     $agreementInfo = new AgreementCreationInfo($documentCreationInfo, $interactiveOptions);
     $this->data = $agreementInfo->toArray();
     $request = $this->getTransport();
     $response = $request->post($this);
     if ($response instanceof Error) {
         return $response;
     }
     return new AgreementCreationResponse($response);
 }