/**
  * @param int    $orderUnitId
  * @param string $text
  * @return int
  */
 public function post($orderUnitId, $text)
 {
     $data = new ClaimAddTransfer();
     $data->id_order_unit = (int) $orderUnitId;
     $data->text = $text;
     $endpoint = new Post($this->getTransport());
     $endpoint->setTransfer($data);
     $resultRequest = $endpoint->performRequest();
     return Response::extractId($resultRequest, '/claims/%d/');
 }
Exemple #2
0
 public function testInstance()
 {
     /** @var \Mockery\Mock|\Hitmeister\Component\Api\Transfers\ClaimAddTransfer $transfer */
     $transfer = \Mockery::mock('\\Hitmeister\\Component\\Api\\Transfers\\ClaimAddTransfer');
     $transfer->shouldReceive('toArray')->once()->andReturn(['id_order_unit' => 2716841, 'text' => 'message']);
     $decide = new Post($this->transport);
     $decide->setTransfer($transfer);
     $this->assertInstanceOf('\\Hitmeister\\Component\\Api\\Transfers\\ClaimAddTransfer', $decide->getTransfer());
     $this->assertEquals([], $decide->getParamWhiteList());
     $this->assertEquals('POST', $decide->getMethod());
     $this->assertEquals('claims/', $decide->getURI());
     $body = $decide->getBody();
     $this->assertArrayHasKey('id_order_unit', $body);
     $this->assertArrayHasKey('text', $body);
 }