示例#1
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;
 }
示例#2
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;
 }
示例#3
0
 /**
  * Get Workdiary by Contract
  *
  * @param   string $contract Contract ID
  * @param   string $fromDate Start date
  * @param   string $tillDate Till date
  * @param   array $params (Optional) Parameters
  * @return  object
  */
 public function getByContract($contract, $fromDate, $tillDate, $params = array())
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/team/v2/workdays/contracts/' . $company . '/' . $fromDate . ',' . $tillDate, $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
示例#4
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;
 }
示例#5
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->put('/hr/v3/fp/submissions/' . $submissionId . '/reject', $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
示例#6
0
 /**
  * Get specific application
  *
  * @param   integer $reference Application reference
  * @return  object
  */
 public function getSpecific($reference)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/hr/v3/contractors/applications/' . $reference);
     ApiDebug::p('found response info', $response);
     return $response;
 }
示例#7
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;
 }
示例#8
0
 /**
  * Assign to specific engagement the list of activities
  *
  * @param   integer $engagement Engagement
  * @param   array   $params Parameters
  * @return  object
  */
 public function assignToEngagement($engagement, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->put('/tasks/v2/tasks/contracts/' . $engagement, $params);
     ApiDebug::p('found response info', $response);
     return $response;
 }
示例#9
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;
 }
示例#10
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;
 }
示例#11
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;
 }
示例#12
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;
 }
示例#13
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;
 }
示例#14
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;
 }
示例#15
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;
 }
示例#16
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;
 }
示例#17
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;
 }
示例#18
0
 /**
  * Get specific Freelancer Profile
  *
  * @param   string $key Profile key
  * @return  object
  */
 public function getSpecific($key)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->get('/profiles/v1/providers/' . $key);
     ApiDebug::p('found response info', $response);
     return $response;
 }
示例#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 ? 'UPWORK_BASE_URL_' . strtoupper($ep) : 'UPWORK_BASE_URL';
     $fullUrl = constant($name) . $url;
     ApiDebug::p('url', $fullUrl);
     return $fullUrl;
 }
示例#20
0
 /**
  * @test
  */
 public function testPrintDebugMessage()
 {
     $reflection = new \ReflectionClass('Upwork\\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);
 }
示例#21
0
 /**
  * Delete snapshot by specific contract
  *
  * @param   string $contractId Contract ID
  * @param   string $ts Timestamp
  * @return  object
  */
 public function deleteByContract($contractId, $ts)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->delete('/team/v2/snapshots/contracts/' . $contractId . '/' . $ts);
     ApiDebug::p('found response info', $response);
     return $response;
 }
示例#22
0
 /**
  * Generate Earning 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 . '/earnings', $params);
     ApiDebug::p('found report info', $report);
     return $report;
 }
示例#23
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;
 }
示例#24
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;
 }
示例#25
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;
 }
示例#26
0
 /**
  * Reply to existend thread
  *
  * @param   string $username User ID
  * @param   integer $threadId Thread ID
  * @param   array $params Parameters
  * @access  public
  * @return  object
  */
 public function replyToThread($username, $threadId, $params)
 {
     ApiDebug::p(__FUNCTION__);
     $response = $this->_client->post('/mc/v1/threads/' . $username . '/' . $threadId, $params);
     ApiDebug::p('found response', $response);
     return $response;
 }
示例#27
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;
 }
示例#28
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;
 }
示例#29
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;
 }
示例#30
0
 /**
  * Get OAuth instance
  *
  * @param   integer $authType (Optional) Auth type
  * @access  protected
  * @return  object
  */
 protected function _getOAuthInstance($authType = null)
 {
     ApiDebug::p('get OAuth instance');
     $options = array('consumer_key' => self::$_apiKey, 'consumer_secret' => self::$_secret, 'server_uri' => UPWORK_BASE_URL, 'request_token_uri' => ApiUtils::getFullUrl(self::URL_RTOKEN, 'api'), 'authorize_uri' => self::URL_AUTH, 'access_token_uri' => ApiUtils::getFullUrl(self::URL_ATOKEN, 'api'));
     $oauth = \OAuthStore::instance('Session', $options);
     return $oauth;
 }