コード例 #1
0
 /**
  * @param array       $vars
  * @param Client      $client
  * @param HttpRequest $httpRequest
  * @return mixed
  */
 public function relay($vars, Client $client, HttpRequest $httpRequest)
 {
     $url = $client->webHookEndPoint();
     $httpRequest->setAuth($client->name(), $client->apiKey());
     $httpRequest->post($url, $vars);
     return $httpRequest->statusCode() == 200 ? true : false;
 }
コード例 #2
0
 /**
  * @test
  */
 function it_has_some_fields_that_can_be_set_and_recalled()
 {
     $client = new Client($this->clientData);
     $this->assertEquals(1, $client->id());
     $this->assertEquals('Vendirun', $client->name());
     $this->assertEquals('123456', $client->apiKey());
     $this->assertEquals('http://my.web/hook', $client->webHookEndPoint());
     $this->assertEquals('2015-03-01 09:25:37', $client->createdAt());
     $this->assertEquals('2015-03-05 19:15:32', $client->updatedAt());
 }
コード例 #3
0
 /**
  * @param Client $client
  * @return Client
  */
 public function save($client)
 {
     $data = ['id' => $client->id(), 'name' => $client->name(), 'api_key' => $client->apiKey(), 'web_hook_end_point' => $client->webHookEndPoint(), 'created_at' => $client->createdAt(), 'updated_at' => $client->updatedAt()];
     return $this->saveEntity($client, $data);
 }