예제 #1
0
 /**
  * @param Interesant $interesant 
  * @return bool
  */
 public function saveInteresant($interesant)
 {
     $serializer = new \Itav\Component\Serializer\Serializer();
     $params['interesant'] = $serializer->normalize($interesant);
     $client = new \GuzzleHttp\Client();
     $res = $client->post("http://interesant.dev/add", ['form_params' => $params]);
     if ($res->getStatusCode() == 200) {
         return true;
     }
     return false;
 }
예제 #2
0
 /**
  * @param string $id 
  * @return Tax
  */
 public function getTaxById($id)
 {
     $tax = new Tax();
     $client = new \GuzzleHttp\Client();
     $res = $client->get("http://product.dev/tax/info/{$id}", ['headers' => ['Accept' => 'application/json']]);
     if ($res->getStatusCode() == 200) {
         $json = $res->getBody()->getContents();
         $serializer = new \Itav\Component\Serializer\Serializer();
         $serializer->unserialize($json, Tax::class, $tax);
     }
     return $tax;
 }