Ejemplo n.º 1
0
 public function save($save_method = 'update')
 {
     $url = '/mint/organizations/' . rawurlencode($this->config->orgName) . '/developers/' . rawurlencode($this->developer_or_company_id) . '/developer-rateplans';
     $obj = array('developer' => array('id' => $this->developer_or_company_id), 'startDate' => $this->startDate, 'endDate' => $this->endDate, 'ratePlan' => array('id' => $this->ratePlan->getId()));
     try {
         $this->setBaseUrl($url);
         if ($save_method == 'create') {
             $this->post(null, $obj);
         } elseif ($save_method == 'update') {
             $obj['id'] = $this->id;
             $this->put($this->getId(), $obj);
         } else {
             throw new ParameterException('Unsupported save method argument: ' . $save_method);
         }
         $this->restoreBaseUrl();
     } catch (ResponseException $re) {
         $e = MintApiException::factory($re);
         throw $e;
     }
 }