/**
  * @param ClientProductConfigurationProperties[] $config
  *
  * @return array|\Guzzle\Http\EntityBodyInterface|string
  * @throws \Exception
  */
 public function updateMany($config)
 {
     try {
         $formatter = Formatter::create(\MsiClient\Client::Formart_Request);
         return $this->perform(['data' => $formatter->encode(['client_product_config' => $config])], \MsiClient\Client::PUT_REQUEST, $this->getUrl() . '/update-many');
     } catch (\Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 2
0
 public function setConfig(ProductConfigurationProperties $config)
 {
     try {
         $formatter = Formatter::create(\MsiClient\Client::Formart_Request);
         return $this->perform(['data' => $formatter->encode(['sci-online' => $config->toArray()])], Client::POST_REQUEST, $this->getUrl() . '/set-config');
     } catch (\Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 3
0
 public function save(BranchProperties $branch)
 {
     try {
         $formatter = Formatter::create(\MsiClient\Client::Formart_Request);
         $retorno = $this->perform(['data' => $formatter->encode(['branch' => $branch->toArray()])], \MsiClient\Client::POST_REQUEST);
         return $branch->fromStdClass($retorno->branch);
     } catch (\Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 4
0
 /**
  * @param ClientPlanProperties $planProperties
  *
  * @return Properties\ClientPlanProperties
  * @throws \Exception
  */
 public function save(ClientPlanProperties $planProperties)
 {
     try {
         $formatter = Formatter::create(\MsiClient\Client::Formart_Request);
         $result = $this->perform(['data' => $formatter->encode(['client_plan' => $planProperties->toArray()])], \MsiClient\Client::POST_REQUEST, $this->getUrl())->data;
         $plan = new ClientPlanProperties();
         return $plan->fromStdClass($result);
     } catch (\Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 5
0
 public function save(ClientProperties $client)
 {
     try {
         $formatter = Formatter::create(\MsiClient\Client::Formart_Request);
         if (!is_null($client->id)) {
             return $this->perform(['data' => $formatter->encode(['client' => $client->toArray()])], \MsiClient\Client::PUT_REQUEST, $this->getUrl() . '/' . $client->id);
         } else {
             return $this->perform(['data' => $formatter->encode(['client' => $client->toArray()])], \MsiClient\Client::POST_REQUEST);
         }
     } catch (ServerException $e) {
         throw $e;
     }
 }
Ejemplo n.º 6
0
 public function save(ClientProductProperties $properties)
 {
     try {
         $formatter = Formatter::create(\MsiClient\Client::Formart_Request);
         if (!is_null($properties->id)) {
             $result = $this->perform(['data' => $formatter->encode(['client_product' => $properties->toArray()])], \MsiClient\Client::PUT_REQUEST, $this->getUrl() . '/' . $properties->id);
         } else {
             $result = $this->perform(['data' => $formatter->encode(['client_product' => $properties->toArray()])], \MsiClient\Client::POST_REQUEST);
         }
         $clientProduct = new ClientProductProperties();
         return $clientProduct->fromStdClass($result->data);
     } catch (\Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 7
0
 private function _parse(ResponseInterface $response)
 {
     $contentType = $response->getHeader('Content-Type');
     if (is_null($contentType)) {
         return $response->getBody();
     }
     $formatter = Formatter::create($contentType[0]);
     if (is_null($formatter)) {
         return $response->getBody()->getContents();
     }
     return $formatter->decode($response->getBody());
 }
Ejemplo n.º 8
0
 public function syncPermissions($userId, $permissions)
 {
     $formatter = \MsiClient\Central\Factory\Formatter::create(\MsiClient\Client::Formart_Request);
     return $this->perform(['data' => $formatter->encode(['permission' => $permissions])], \MsiClient\Client::POST_REQUEST, $this->getUrl() . "/{$userId}/permission/sync");
 }
Ejemplo n.º 9
0
 protected function getSendData(PropertiesAbstract $type)
 {
     $formatter = Formatter::create(\MsiClient\Client::Formart_Request);
     return ['data' => $formatter->encode([$type->getContainer() => $type->toArray()])];
 }
Ejemplo n.º 10
0
 public function __construct()
 {
     $this->formatter = Formatter::create(Client::Mysuite_Request);
 }
Ejemplo n.º 11
0
 public function save(ClientUserProperties $clientUser)
 {
     $formatter = Formatter::create(\MsiClient\Client::Formart_Request);
     $retorno = $this->perform(['data' => $formatter->encode(['client-user' => $clientUser->toArray()])], \MsiClient\Client::POST_REQUEST);
     return $retorno;
 }