/** * @param \DevStub\KubernetesAPIClient\Entity\v1beta1\Endpoints $items * * @return \DevStub\KubernetesAPIClient\Entity\v1beta1\Endpoints */ public function setItems($items = self::UNIQUE_DEFAULT) { if ($items === self::UNIQUE_DEFAULT) { $items = new Endpoints(); $items->_setEntityCallback([$this, __METHOD__]); } $this->items = $items; return $this->items; }
/** * @test */ public function shouldForwarWithParamsAndQueryString() { $method = 'get'; $route = '/v1/charge/90?token=2039480293840923'; $this->requester->expects($this->once())->method('send')->with($this->equalTo($method), $this->equalTo($route), $this->equalTo([])); $endpoints = new Endpoints($this->options, $this->requester); $params = ['id' => '90', 'token' => '2039480293840923']; $endpoints->detailCharge($params, []); }
public function execute() { if ($this->done) { throw new CatapultApiException("You've already done this."); } $created = array(); foreach ($this->data as $k => $d) { $endpoint = new Endpoints(); $d['domainId'] = $this->domain; $created[$k] = $endpoint->create($d); $this->queued--; } $this->done = true; return $created; }
public function __construct() { // Pastikan bahwa PHP mendukung cURL if (!function_exists('curl_init')) { log_message('error', 'cURL Class - PHP was not built with cURL enabled. Rebuild PHP with --with-curl to use cURL.'); } $this->_ci =& get_instance(); $this->_ci->load->config('rajaongkir', TRUE); // Pastikan Anda sudah memasukkan API Key di application/config/rajaongkir.php if ($this->_ci->config->item('rajaongkir_api_key', 'rajaongkir') == "") { log_message("error", "Harap masukkan API KEY Anda di config."); } else { $this->api_key = $this->_ci->config->item('rajaongkir_api_key', 'rajaongkir'); $this->account_type = $this->_ci->config->item('rajaongkir_account_type', 'rajaongkir'); } parent::__construct($this->api_key, $this->account_type); }
<?php require_once "Endpoints.php"; try { $API = new Endpoints($_REQUEST['request']); echo $API->processAPI(); } catch (Exception $e) { echo json_encode(array('error' => $e->getMessage())); }