/** * @return mixed * @throws \ErrorException */ public function getShortList() { $result = Request::get('/corporations/corporation_list.json', $this->instanceIdentifier); if (!empty($result->error)) { Error::exception($result->setFlash[0]->msg); } return $result->corporations; }
public function loadVacancies() { $result = Request::get('/vacancies/index.json', $this->instanceIdentifier); $this->companies = $result->companies; if (empty($result->vacancies)) { $this->vacancies = array(); $this->indexes = array(); } else { $this->vacancies = $result->vacancies; $this->rebuildIndexes(); } }
public function getShortInfo() { $result = Request::get('/users/user_work.json', $this->instanceIdentifier); if (!$result->worker) { $this->worker = false; } else { $this->worker = true; $this->professionId = $result->profession_type_id; $this->professionName = $result->profession_name; $this->salary = $result->salary; $this->companyId = $result->company_id; $this->companyWorkerId = $result->company_worker_id; $this->companyName = $result->company_name; } }
/** * @param string $currency (vdollars OR vgold) * @param $itemTypeId * @param string $sort (price or date) * @param string $direction (asc OR desc) * @return mixed */ public function getLotsOffer($currency, $itemTypeId, $sort = 'price', $direction = 'asc') { $result = Request::get('/exchanges/lot_offers/' . $currency . '/' . $itemTypeId . '/' . $sort . '/' . $direction . '.json', $this->instanceIdentifier); return $this->validateResponse($result, 'offers'); }
/** * @throws \ErrorException */ public function getWorkers() { $result = Request::get('/company_workers/list_workers/' . $this->id . '.json'); if (!empty($result->error)) { Error::exception($result->setFlash[0]->msg); } $this->workplaces = $result->currentCompany->Company->company_level * 5; $this->workersAllCnt = count($result->currentCompany->CompanyWorker) + count($result->currentCompany->UserForeignWorker); $this->workersForeignCnt = count($result->currentCompany->UserForeignWorker); $this->workers = array(); $this->vacancy = array_shift($result->currentCompany->CompanyVacancy); if (!empty($result->currentCompany->CompanyWorker)) { foreach ($result->currentCompany->CompanyWorker as $item) { $this->workers[] = new Worker($item, $this->instanceIdentifier); } } if (!empty($result->currentCompany->UserForeignWorker)) { foreach ($result->currentCompany->UserForeignWorker as $item) { $this->workers[] = new Worker($item, $this->instanceIdentifier); } } }
/** * @return bool * @throws \ErrorException */ public function getInfo() { $result = Request::get('/corporations/corporation_office/' . $this->id . '.json', $this->instanceIdentifier); $this->name = $result->currentCorporation->name; $this->vd_balance = $result->currentCorporation->vd_balance; $this->vg_balance = $result->currentCorporation->vg_balance; if (!empty($result->error)) { Error::exception($result->setFlash[0]->msg); return false; } if (!empty($result->companies)) { foreach ($result->companies as $item) { $this->companies[] = new Company($item); } } }
/** * Get all companies that belong to user * * @return \VCAPI\Common\Collection * @throws \ErrorException */ public function getCompanies() { $result = Request::get('/companies/user_companies.json', $this->instanceIdentifier); if (empty($result->userId)) { return Error::exception('Authorization error'); } $companies = new Collection(); foreach ($result->companies as $company) { $companies->add(new Company($company->Company, $this->instanceIdentifier)); } return $companies; }