/**
  * Request company data from AngelList.
  * Populate data in the class
  *
  * @since 1.0
  */
 private function populate_data()
 {
     if (!class_exists('AngelList_API')) {
         require_once dirname(dirname(__FILE__)) . '/api.php';
     }
     $company = AngelList_API::get_company($this->id);
     if (empty($company)) {
         return;
     }
     // are we sharing a secret?
     if (isset($company->hidden) && $company->hidden === true) {
         return;
     }
     // we should at least be able to reference a startup by its name
     if (isset($company->name)) {
         $this->name = trim($company->name);
     } else {
         return;
     }
     // is the startup participating in AngelList and has claimed their profile?
     if (isset($company->community_profile) && $company->community_profile === false) {
         $this->claimed = true;
     } else {
         $this->claimed = false;
     }
     if (isset($company->company_url)) {
         $url = esc_url($company->company_url, array('http', 'https'));
         if ($url) {
             $this->url = $url;
         }
         unset($url);
     }
     if (isset($company->angellist_url)) {
         $url = esc_url($company->angellist_url, array('http', 'https'));
         if ($url) {
             $this->profile_url = $url;
         }
         unset($url);
     }
     if (isset($company->thumb_url) && $company->thumb_url !== AngelList_API::DEFAULT_IMAGE) {
         $url = AngelList_API::filter_static_asset_url($company->thumb_url);
         if ($url) {
             $image = new stdClass();
             $image->url = $url;
             $image->width = $image->height = 100;
             $this->thumbnail = $image;
             unset($image);
         }
         unset($url);
     }
     if (isset($company->logo_url) && $company->thumb_url !== AngelList_API::DEFAULT_IMAGE) {
         $url = AngelList_API::filter_static_asset_url($company->logo_url);
         if ($url) {
             $this->logo_url = $url;
         }
         unset($url);
     }
     if (isset($company->high_concept)) {
         $concept = trim($company->high_concept);
         if ($concept) {
             $this->concept = $concept;
         }
         unset($concept);
     }
     if (isset($company->product_desc)) {
         $description = trim($company->product_desc);
         if ($description) {
             $this->description = $description;
         }
         unset($description);
     }
     // first location with all the data we want is considered the HQ and displayed
     if (isset($company->locations) && is_array($company->locations)) {
         // iterate until we find a URL + name
         foreach ($company->locations as $location) {
             if (!(isset($location->angellist_url) && isset($location->display_name))) {
                 continue;
             }
             $url = esc_url($location->angellist_url, array('http', 'https'));
             if (!$url) {
                 continue;
             }
             $hq_location = new stdClass();
             $hq_location->url = $url;
             unset($url);
             $hq_location->name = trim($location->display_name);
             $this->location = $hq_location;
             unset($hq_location);
             break;
         }
     }
     // first market with the data we want is considered the main market
     if (isset($company->markets) && is_array($company->markets)) {
         // iterate until we find a URL + name
         foreach ($company->markets as $tag) {
             if (!(isset($tag->angellist_url) && isset($tag->display_name))) {
                 continue;
             }
             $url = esc_url($tag->angellist_url, array('https', 'http'));
             if (!$url) {
                 continue;
             }
             $main_tag = new stdClass();
             $main_tag->url = $url;
             unset($url);
             $main_tag->name = trim($tag->display_name);
             $this->tag = $main_tag;
             unset($main_tag);
             break;
         }
     }
 }