public function testGetResponseDataShouldReturnResponse()
 {
     $anyStdClass = new \stdClass();
     $anyStdClass->string = "abc";
     $anyStdClass->int = 123;
     $response = new Response($anyStdClass);
     $this->assertEquals($anyStdClass, $response->getResponseData());
 }
 /**
  * @param Response $response
  *
  * @return SitePagesModel
  */
 public function process(Response $response)
 {
     $siteUrl = new SiteModel($response->getResponseData()->siteUrl->url, $response->getResponseData()->siteUrl->status);
     $pages = [];
     foreach ($response->getResponseData()->pages as $page) {
         $pages[] = new Page($page->path, $page->wixPageId, $page->appPageId);
     }
     return new SitePagesModel($siteUrl, $pages);
 }
 /**
  * @param Response $response
  *
  * @return PagingActivitiesResultModel
  */
 public function process(Response $response)
 {
     $results = [];
     foreach ($response->getResponseData()->results as $result) {
         $activity = new ActivityModel($result->id, new \DateTime($result->createdAt), $result->activityType, $result->activityInfo, $result->activityLocationUrl, new ActivityDetails($result->activityDetails->additionalInfoUrl, $result->activityDetails->summary));
         $results[] = $activity;
     }
     return new PagingActivitiesResultModel($response->getResponseData()->pageSize, $response->getResponseData()->previousCursor, $response->getResponseData()->nextCursor, $results);
 }
 /**
  * @param Response $response
  *
  * @return PagingContactsResultModel
  */
 public function process(Response $response)
 {
     $results = [];
     foreach ($response->getResponseData()->results as $result) {
         $emails = [];
         foreach ($result->emails as $email) {
             $emails[] = new ContactEmail($email->id, $email->tag, $email->email, $email->emailStatus);
         }
         $phones = [];
         foreach ($result->phones as $phone) {
             $phones[] = new ContactPhone($phone->id, $phone->tag, $phone->phone, $phone->normalizedPhone);
         }
         $addresses = [];
         foreach ($result->addresses as $address) {
             $addresses[] = new Address($address->id, $address->tag, $address->address, $address->neighborhood, $address->city, $address->region, $address->country, $address->postalCode);
         }
         $urls = [];
         foreach ($result->urls as $url) {
             $urls[] = new ContactUrl($url->id, $url->tag, $url->url);
         }
         $dates = [];
         foreach ($result->dates as $date) {
             $dates[] = new ImportantDate($date->id, $date->tag, new \DateTime($date->date));
         }
         $links = [];
         foreach ($result->links as $link) {
             $links[] = new StateLink($link->href, $link->rel);
         }
         $results[] = new ContactModel($result->id, new ContactName($result->name->prefix, $result->name->first, $result->name->middle, $result->name->last, $result->name->suffix), $result->picture, new Company($result->company->role, $result->company->name), $emails, $phones, $addresses, $urls, $dates, $links, new \DateTime($result->createdAt), new \DateTime($result->modifiedAt));
     }
     return new PagingContactsResultModel($response->getResponseData()->total, $response->getResponseData()->pageSize, $response->getResponseData()->previousCursor, $response->getResponseData()->nextCursor, $results);
 }
 /**
  * @param Command  $command
  * @param Response $response
  *
  * @return mixed
  * @throws WixHiveException
  */
 public static function process(Command $command, Response $response)
 {
     if (isset($response->getResponseData()->errorCode)) {
         $message = isset($response->getResponseData()->message) ? $response->getResponseData()->message : "No message";
         throw new WixHiveException($message, $response->getResponseData()->errorCode);
     }
     return $command->getResponseProcessor()->process($response);
 }
 /**
  * @param Response $response
  *
  * @return ActivitySummaryModel
  */
 public function process(Response $response)
 {
     $activityTypes = array();
     foreach ($response->getResponseData()->activityTypes as $type) {
         $from = new \DateTime($type->from, new \DateTimeZone("UTC"));
         $until = isset($type->until) ? new \DateTime($type->until, new \DateTimeZone("UTC")) : null;
         $activityTypes[] = new ActivityTypeSummary($type->activityType, $type->total, $from, $until);
     }
     $from = new \DateTime($response->getResponseData()->from, new \DateTimeZone("UTC"));
     $until = isset($response->getResponseData()->until) ? new \DateTime($response->getResponseData()->until, new \DateTimeZone("UTC")) : null;
     return new ActivitySummaryModel($activityTypes, $response->getResponseData()->total, $from, $until);
 }
Beispiel #7
0
 /**
  * @param Response $response
  *
  * @return SiteModel
  */
 public function process(Response $response)
 {
     return new SiteModel($response->getResponseData()->url, $response->getResponseData()->status);
 }
 /**
  * @param Response $response
  *
  * @return ActivityTypesModel
  */
 public function process(Response $response)
 {
     $types = (array) $response->getResponseData()->types;
     return new ActivityTypesModel($types);
 }
 /**
  * @param Response $response
  *
  * @return ContactResultModel
  */
 public function process(Response $response)
 {
     return new ContactResultModel($response->getResponseData()->contactId);
 }
Beispiel #10
0
 /**
  * @param Response $response
  *
  * @return ActivityModel
  */
 public function process(Response $response)
 {
     $activityModel = new ActivityModel($response->getResponseData()->id, new \DateTime($response->getResponseData()->createdAt), $response->getResponseData()->activityType, $response->getResponseData()->activityInfo, $response->getResponseData()->activityLocationUrl, new ActivityDetails($response->getResponseData()->activityDetails->additionalInfoUrl, $response->getResponseData()->activityDetails->summary));
     return $activityModel;
 }