예제 #1
0
 public static function getInstance($fullpath, Method $method, $response)
 {
     if ($method->equals(Method::DELETE)) {
         return true;
     }
     $endpoint = explode('/', preg_replace("/[0-9]+/", "Id", rtrim($fullpath, '/')));
     if (count($endpoint) - 2 >= 0 && end($endpoint) === 'Id') {
         $path = mb_convert_case($endpoint[count($endpoint) - 2], MB_CASE_TITLE) . end($endpoint);
     } else {
         $path = mb_convert_case(end($endpoint), MB_CASE_TITLE);
     }
     $class = __NAMESPACE__ . '\\' . $path . $method->value();
     return new $class($response);
 }
예제 #2
0
 private function __construct($path)
 {
     $this->_path = $path;
     $this->_method = Method::GET();
     $this->_query = array();
     $this->_header = array();
     $this->_content = array();
 }
예제 #3
0
 protected function getRequest($path = '')
 {
     return $this->exec($path, Method::GET(), $this->request($path)->setQuery($this->paramWithReset()));
 }
예제 #4
0
 public function createTask(Param\CreateTask $param)
 {
     $this->setParam($param);
     return $this->postRequest(Method::POST(), 'tasks');
 }