public function load($org = null)
 {
     $org = isset($org) ? $org : $this->name;
     $cache_manager = CacheFactory::getCacheManager(null);
     $organization = $cache_manager->get('mngmt_organization:' . $org, null);
     if (!isset($organization)) {
         $url = rawurlencode($org);
         $this->get($url);
         $organization = $this->responseObj;
         $cache_manager->set('mngmt_organization:' . $org, $organization);
     }
     $this->name = $organization['name'];
     $this->displayName = $organization['displayName'];
     $this->environments = $organization['environments'];
     $this->type = $organization['type'];
     $this->createAt = $organization['createdAt'];
     $this->createdBy = $organization['createdBy'];
     $this->lastModifiedAt = $organization['lastModifiedAt'];
     $this->lastModifiedBy = $organization['lastModifiedBy'];
     $this->properties = array();
     if (isset($organization['properties'])) {
         foreach ($organization['properties'] as $prop) {
             list($property) = $prop;
             $this->properties[$property['name']] = $property['value'];
         }
     }
 }
Beispiel #2
0
 public function getList($page_num = null, $page_size = 20)
 {
     $cache_manager = CacheFactory::getCacheManager(null);
     $data = $cache_manager->get('developer_accepted_rateplan:' . $this->developer_or_company_id, null);
     if (!isset($data)) {
         $this->get();
         $data = $this->responseObj;
         $cache_manager->set('developer_accepted_rateplan:' . $this->developer_or_company_id, $data);
     }
     $return_objects = array();
     foreach ($data[$this->wrapperTag] as $response_data) {
         $obj = $this->instantiateNew();
         $obj->loadFromRawData($response_data);
         $return_objects[] = $obj;
     }
     return $return_objects;
 }
Beispiel #3
0
 public function getList($page_num = null, $page_size = 20)
 {
     $cache_manager = CacheFactory::getCacheManager(null);
     $data = $cache_manager->get('suborg_product:' . $this->productId, null);
     if (!isset($data)) {
         $this->get();
         $data = $this->responseObj;
         $cache_manager->set('suborg_product:' . $this->productId, $data);
     }
     $return_objects = array();
     foreach ($data[$this->wrapperTag] as $response_data) {
         $obj = $this->instantiateNew();
         $obj->loadFromRawData($response_data);
         $return_objects[] = $obj;
     }
     return $return_objects;
 }
Beispiel #4
0
 public function getAcceptedDevTermsAndConditions($developer_id, $current = null)
 {
     $cache_manager = CacheFactory::getCacheManager(null);
     $data = $cache_manager->get('developer_accepted_tncs:' . $developer_id, null);
     if (!isset($data)) {
         $url = '/mint/organizations/' . rawurlencode($this->config->orgName) . '/developers/' . rawurlencode($developer_id) . '/developer-tncs';
         if ($current) {
             $url .= '?current=true';
         }
         $this->setBaseUrl($url);
         $this->get();
         $this->restoreBaseUrl();
         $data = $this->responseObj;
         $cache_manager->set('developer_accepted_tncs:' . $developer_id, $data);
     }
     $dev_tncs = array();
     foreach ($data['developerTnc'] as $tnc) {
         $dev_tnc = new DeveloperTnc($tnc);
         if (isset($tnc['tnc'])) {
             $tncs = new TermAndCondition($this->config);
             $tncs->loadFromRawData($tnc['tnc']);
             $dev_tnc->setTnc($tncs);
             $dev_tncs[] = $dev_tnc;
         }
     }
     return $dev_tncs;
 }
Beispiel #5
0
 public function load($id = null)
 {
     if (!isset($id)) {
         $id = $this->{$this->idField};
     }
     if (!isset($id)) {
         throw new ParameterException('No object identifier was specified.');
     }
     $cache_manager = CacheFactory::getCacheManager(null);
     $data = $cache_manager->get('package:' . $id, null);
     if (!isset($data)) {
         $url = rawurlencode($id);
         $this->get($url);
         $data = $this->responseObj;
         $cache_manager->set('package:' . $id, $data);
     }
     $this->initValues();
     $this->loadFromRawData($data);
 }
Beispiel #6
0
 /**
  *
  * Retrieve Parent organization along with its siblings
  *
  * @param $id Parent organization id
  *
  * @return array of \Apigee\Mint\Organization
  */
 public function getOrganizationFamily($id)
 {
     if (!isset($id)) {
         $id = $this->name;
     }
     if (!isset($id)) {
         $id = $this->config->orgName;
     }
     $cache_manager = CacheFactory::getCacheManager(null);
     $data = $cache_manager->get('mint_organization-family:' . $id, null);
     if (!isset($data)) {
         $url = rawurlencode($id) . '/organization-family';
         $this->get($url);
         $data = $this->responseObj;
         $cache_manager->set('mint_organization-family:' . $id, $data);
     }
     $orgs = array();
     foreach ($data['organization'] as $org) {
         $orgObj = $this->instantiateNew();
         self::$logger = $this->config->logger;
         $orgObj->initValues();
         $orgObj->loadFromRawData($org);
         $orgs[$orgObj->getId()] = $orgObj;
     }
     return $orgs;
 }