/** * @expectedException \Robin\Connect\SEOShop\Exceptions\PropertyDoesNotExistsException */ public function testAccessingNotExistingPropertyResultsInException() { $model = $this->getModel("customer"); $client = Mockery::mock(Retriever::class); $customer = new Customer($client); $customer->makeFromJson($model); $customer->foo; }
/** * @param null $id * @param array $options * @return Customers|\Robin\Connect\SEOShop\Models\Customer[] */ public function customers($id = null, $options = []) { //reassign $id when it's an array if (is_array($id)) { list($id, $options) = [null, $id]; } $customers = new Customers(); if ($id == null) { foreach ($this->api->customers->get($id, $options) as $seoCustomer) { $customer = new SEOShopCustomer($this, $this->logger); $customers->push($customer->makeFromArray($seoCustomer)); } return $customers; } $customer = $this->api->customers->get($id, $options); return (new SEOShopCustomer($this, $this->logger))->makeFromArray($customer); }
/** * @param $json * @return \Psr\Http\Message\ResponseInterface */ public function customers($json) { $customer = $this->customer->makeFromArray($json); $customers = Customers::make([$this->makeRobinCustomer($customer)]); try { return $this->robin->customers($customers); } catch (RobinSendFailedException $exception) { $this->error($customers, $exception, $customer); return new Response("", 500); } }