/** * @param SegmentBilling $segment * * @return self */ public static function missingSegmentBillingId($segment) { return new self('Missing segment billing id for ' . serialize($segment->getId())); }
/** * @param SegmentBilling $segmentBilling * * @return RepositoryResponse * @throws RepositoryException */ public function update(SegmentBilling $segmentBilling) { if (!$segmentBilling->getId()) { throw RepositoryException::missingSegmentBillingId($segmentBilling); } $compiledUrl = $this->baseUrl . '?member_id=' . $segmentBilling->getMemberId(); $payload = ['segment-billing-category' => $segmentBilling->toArray()]; $response = $this->client->request('PUT', $compiledUrl, ['body' => json_encode($payload)]); $repositoryResponse = RepositoryResponse::fromResponse($response); return $repositoryResponse; }