| @@ 77-84 (lines=8) @@ | ||
| 74 | * |
|
| 75 | * @return \Psr\Http\Message\ResponseInterface |
|
| 76 | */ |
|
| 77 | protected function post($endpoint, DocumentInterface $document = null) |
|
| 78 | { |
|
| 79 | return $this->client->getHttpClient()->post( |
|
| 80 | $endpoint, |
|
| 81 | self::JSON_CONTENT_TYPE, |
|
| 82 | $document ? $document->toJson() : '[]' |
|
| 83 | ); |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * put |
|
| @@ 94-103 (lines=10) @@ | ||
| 91 | * |
|
| 92 | * @return \Psr\Http\Message\ResponseInterface |
|
| 93 | */ |
|
| 94 | protected function put($endpoint, DocumentInterface $document = null) |
|
| 95 | { |
|
| 96 | $document->setCreatedAt(time()); |
|
| 97 | ||
| 98 | return $this->client->getHttpClient()->put( |
|
| 99 | $endpoint, |
|
| 100 | self::JSON_CONTENT_TYPE, |
|
| 101 | $document ? $document->toJson() : '[]' |
|
| 102 | ); |
|
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * patch |
|
| @@ 113-120 (lines=8) @@ | ||
| 110 | * |
|
| 111 | * @return \Psr\Http\Message\ResponseInterface |
|
| 112 | */ |
|
| 113 | protected function patch($endpoint, DocumentInterface $document = null) |
|
| 114 | { |
|
| 115 | return $this->client->getHttpClient()->patch( |
|
| 116 | $endpoint, |
|
| 117 | self::JSON_CONTENT_TYPE, |
|
| 118 | $document ? $document->toJson() : '[]' |
|
| 119 | ); |
|
| 120 | } |
|
| 121 | ||
| 122 | /** |
|
| 123 | * delete |
|
| @@ 130-137 (lines=8) @@ | ||
| 127 | * |
|
| 128 | * @return \Psr\Http\Message\ResponseInterface |
|
| 129 | */ |
|
| 130 | protected function delete($endpoint, DocumentInterface $document = null) |
|
| 131 | { |
|
| 132 | return $this->client->getHttpClient()->delete( |
|
| 133 | $endpoint, |
|
| 134 | self::JSON_CONTENT_TYPE, |
|
| 135 | $document ? $document->toJson() : '[]' |
|
| 136 | ); |
|
| 137 | } |
|
| 138 | } |
|
| 139 | ||