Ejemplo n.º 1
0
 /**
  * Reject an existing Submission
  *
  * @param   integer Submission ID
  * @param   array $params Parameters
  * @return  object
  */
 public function reject($submissionId, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->delete('/hr/v3/fp/submissions/' . $submissionId . '/reject', $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 2
0
 /**
  * Generate Financial Reports for a Specific Account
  *
  * @param   integer $entityReference Entity reference
  * @param   array $params Parameters
  * @return  object
  */
 public function getSpecific($entityReference, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $report = $this->_client->get('/finreports/v2/financial_accounts/' . $entityReference, $params);
     ApiDebug::p('found auth info', $report);
     return $report;
 }
Ejemplo n.º 3
0
 /**
  * Get specific team or company
  *
  * @param   string $team Teamroom or company ID
  * @param   array $params (Optional) Parameters
  * @return  object
  */
 public function getSpecific($team, $params = array())
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/team/v2/teamrooms/' . $team, $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 4
0
 /**
  * My Info
  *
  * @return object
  */
 public function getUserInfo()
 {
     ApiDebug::p(__FUNCTION__);
     $info = $this->_client->get('/auth/v1/info');
     ApiDebug::p('found auth info', $info);
     return $info;
 }
Ejemplo n.º 5
0
 /**
  * Get Users in Team
  *
  * @param   integer $teamReference Team reference
  * @return  object
  */
 public function getUsersInTeam($teamReference)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/hr/v2/teams/' . $teamReference . '/users');
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 6
0
 /**
  * Get specific engagement
  *
  * @param   integer $reference Engagement's reference
  * @return  object
  */
 public function getSpecific($reference)
 {
     ApiDebug::p(__FUNCTION__);
     $engagement = $this->_client->get('/hr/v2/engagements/' . $reference);
     ApiDebug::p('found response info', $engagement);
     return $engagement;
 }
Ejemplo n.º 7
0
 /**
  * End Contract
  *
  * @param   integer $reference Contract reference
  * @param   array $params Parameters
  * @return  object
  */
 public function endContract($reference, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->delete('/hr/v2/contracts/' . $reference, $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 8
0
 /**
  * Get by specific user
  *
  * @param   integer $reference User reference
  * @return  object
  */
 public function getBySpecificUser($reference)
 {
     ApiDebug::p(__FUNCTION__);
     $roles = $this->_client->get('/hr/v2/userroles/' . $reference);
     ApiDebug::p('found auth info', $roles);
     return $roles;
 }
Ejemplo n.º 9
0
 /**
  * Submit a Custom Payment
  *
  * @param   integer $teamReference Team reference
  * @param   array $params Parameters
  * @return  object
  */
 public function submitBonus($teamReference, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $adjustments = $this->_client->post('/hr/v2/teams/' . $teamReference . '/adjustments', $params);
     ApiDebug::p('found adjustments info', $adjustments);
     return $adjustments;
 }
Ejemplo n.º 10
0
 /**
  * Assign engagements to the list of activities
  *
  * @param   string  $company Company ID
  * @param   string  $team Team ID
  * @param   integer $engagement Engagement
  * @param   array   $params Parameters
  * @return  object
  */
 public function assign($company, $team, $engagement, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->put('/otask/v1/tasks/companies/' . $company . '/teams/' . $team . '/engagements/' . $engagement . '/tasks', $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 11
0
 /**
  * Send offer
  *
  * @param   array $params Parameters
  * @return  object
  */
 public function makeOffer($params)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->post('/offers/v1/clients/offers', $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 12
0
 /**
  * Search jobs
  *
  * @param   array $params (Optional) Parameters
  * @return  object
  */
 public function find($params = array())
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/profiles/v2/search/jobs', $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 13
0
 /**
  * Run a specific action
  *
  * @param   integer $reference  Offer reference
  * @param   array   $params     Prameters
  * @return  object
  */
 public function actions($reference, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->post('/offers/v1/contractors/actions/' . $reference, $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 14
0
 /**
  * Get specific Job Profile
  *
  * @param   string $key Profile key
  * @return  object
  */
 public function getSpecific($key)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/profiles/v1/jobs/' . $key);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 15
0
 /**
  * Get Specific User Info
  *
  * @param integer $userReference User Reference
  * @return object
  */
 public function getSpecific($userReference)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/hr/v2/users/' . $userReference);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 16
0
 /**
  * Invite to Interview
  *
  * @param   string $jobKey Job key
  * @param   array $params Parameters
  * @return  object
  */
 public function invite($jobKey, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->post('/hr/v1/jobs/' . $jobKey . '/candidates', $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 17
0
 /**
  * Get Workdiary by Contract
  *
  * @param   string $contract Contract ID
  * @param   string $date Date
  * @param   array $params (Optional) Parameters
  * @return  object
  */
 public function getByContract($contract, $date, $params = array())
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/team/v2/workdiaries/contracts/' . $contract . '/' . $date, $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 18
0
 /**
  * Get specific application
  *
  * @param   integer $reference Application reference
  * @param   array $params Parameters
  * @return  object
  */
 public function getSpecific($reference, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/hr/v3/clients/applications/' . $reference, $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 19
0
 /**
  * Get full url, based on global constant
  *
  * @param	string $url Relative URL
  * @param	string $ep (Optional) Entry point
  * @static
  * @access	public
  * @return	string
  */
 public static function getFullUrl($url, $ep = null)
 {
     ApiDebug::p('create full url, based on global constant');
     $name = $ep ? 'ODESK_BASE_URL_' . strtoupper($ep) : 'ODESK_BASE_URL';
     $fullUrl = constant($name) . $url;
     ApiDebug::p('url', $fullUrl);
     return $fullUrl;
 }
Ejemplo n.º 20
0
 /**
  * @test
  */
 public function testPrintDebugMessage()
 {
     $reflection = new \ReflectionClass('oDesk\\API\\Debug');
     $property = $reflection->getProperty('_debug');
     $property->setAccessible(true);
     $helper = new ApiDebug();
     $property->setValue($helper, true);
     $this->assertAttributeEquals(true, '_debug', $helper);
     ob_start();
     ApiDebug::p('test message');
     $output = ob_get_contents();
     ob_end_clean();
     $this->assertContains('test message', $output);
     $property->setValue($helper, false);
 }
Ejemplo n.º 21
0
 /**
  * Generate Billing Reports for a Specific Buyer's Company
  *
  * @param   integer $buyerCompanyReference Buyer company reference
  * @param   array $params Parameters
  * @return  object
  */
 public function getByBuyersCompany($buyerCompanyReference, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $report = $this->_client->get('/finreports/v2/buyer_companies/' . $buyerCompanyReference . '/billings', $params);
     ApiDebug::p('found report info', $report);
     return $report;
 }
Ejemplo n.º 22
0
 /**
  * Unarchive specific oTask/Activity record within a Team
  *
  * @param   string $company Company ID
  * @param   string $team Team ID
  * @param   string $code Specific code(s)
  * @return  object
  */
 public function unarchiveActivities($company, $team, $code)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->put('/otask/v1/tasks/companies/' . $company . '/teams/' . $team . '/unarchive/' . $code);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 23
0
 /**
  * Get Users in Company
  *
  * @param   integer $cmpReference Company reference
  * @return  object
  */
 public function getUsers($cmpReference)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/hr/v2/companies/' . $cmpReference . '/users');
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 24
0
 /**
  * Get reasons
  *
  * @param   array $params Parameters
  * @return  object
  */
 public function getReasons($params)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/profiles/v1/metadata/reasons', $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 25
0
 /**
  * Delete an existing Milestone
  *
  * @param   integer $milestoneId Milestone ID
  * @return  object
  */
 public function delete($milestoneId)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->delete('/hr/v3/fp/milestones/' . $milestoneId);
     ApiDebug::p('found response info', $response);
     return $response;
 }
Ejemplo n.º 26
0
 /**
  * Delete existend job
  *
  * @param   string $key Job key
  * @param   array $params Parameters
  * @return  object
  */
 public function deleteJob($key, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $job = $this->_client->delete('/hr/v2/jobs/' . $key, $params);
     ApiDebug::p('found response info', $job);
     return $job;
 }
Ejemplo n.º 27
0
 /**
  * Auth process 
  * 
  * @access  public
  * @return  string
  */
 public function auth()
 {
     ApiDebug::p('running auth process in ' . __CLASS__);
     if (self::$_accessToken === null && self::$_verifier === null) {
         if (self::$_requestToken === null && self::$_requestSecret === null) {
             // web-based application should setup and save request token itself
             // to be able use it after callback
             $this->setupRequestToken();
         }
         $authUrl = ApiUtils::getFullUrl(self::URL_AUTH) . '?oauth_token=' . self::$_requestToken;
         if (self::$_mode === 'web') {
             // authorize web application via browser
             header('Location: ' . $authUrl);
         } elseif (self::$_mode === 'nonweb') {
             // authorize nonweb application
             ApiDebug::p('found [nonweb] mode, need to autorize application manually');
             $prompt = 'Visit ' . $authUrl . "\n" . 'and provide oauth_verifier for further authorization' . "\n" . '$ ';
             if (PHP_OS == 'WINNT') {
                 echo $prompt;
                 $verifier = stream_get_line(STDIN, 1024, PHP_EOL);
             } else {
                 $verifier = readline($prompt);
             }
             // get access token
             $this->_setupAccessToken($verifier);
         }
     } elseif (self::$_accessToken == null && self::$_verifier !== null) {
         // get access token, web-based callback
         $this->_setupAccessToken(self::$_verifier);
     } else {
         // access_token isset
     }
     return array('access_token' => self::$_accessToken, 'access_secret' => self::$_accessSecret);
 }
Ejemplo n.º 28
0
 /**
  * Get OAuth instance
  *
  * @param   integer $authType Auth type
  * @access  protected
  * @return  object
  */
 protected function _getOAuthInstance($authType)
 {
     ApiDebug::p('get OAuth instance');
     $oauth = new \OAuth(self::$_apiKey, self::$_secret, self::$_sigMethod, $authType);
     if (ApiConfig::get('debug')) {
         $oauth->enableDebug();
     }
     if (!self::$_verifySsl) {
         $oauth->disableSSLChecks();
     }
     return $oauth;
 }
Ejemplo n.º 29
0
 /**
  * Generating Freelancer Specific Reports (with financial info)
  *
  * @param   string $freelancerId Freelancer ID
  * @param   array $params Parameters
  * @return  object
  */
 public function getByFreelancerFull($freelancerId, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $report = $this->_client->get('/timereports/v1/providers/' . $freelancerId, $params);
     ApiDebug::p('found report info', $report);
     return $report;
 }
Ejemplo n.º 30
0
 /**
  * Do DELETE request 
  * 
  * @param   string $url API URL
  * @param   array $params (Optional) Additional parameters
  * @access  public
  * @return  mixed
  */
 public function delete($url, $params = array())
 {
     ApiDebug::p('starting DELETE request');
     return $this->_request('DELETE', $url, $params);
 }