예제 #1
0
파일: SignerTest.php 프로젝트: matiit/wkop
 /**
  * @expectedException \Wkop\Exceptions\UrlMissingException
  */
 public function testResetsAfterGetKey()
 {
     $signer = new Signer('a', 'b');
     $signer->setUrl('http://a.wykop.pl');
     $signer->getSigningKey();
     $signer->getSigningKey();
 }
예제 #2
0
파일: Client.php 프로젝트: matiit/wkop
 /**
  * Post data
  *
  * @param $resource
  * @param array $params
  * @param array $methodParams
  * @param array $postData
  * @return mixed
  * @throws Exceptions\UrlMissingException
  */
 public function post($resource, $params = [], $methodParams = [], $postData = [])
 {
     $url = $this->prepareUrl($resource, $params, $methodParams);
     $this->signer->setUrl($url)->setPostData($postData);
     $signingKey = $this->signer->getSigningKey();
     $response = $this->httpClient->post($url, ['headers' => ['apisign' => $signingKey], 'body' => $postData]);
     return $response->json();
 }